dotnet/aspnetcore

Create an analyzer to help verify and fix endpoint metadata of minimal APIs

DamianEdwards opened this issue · 3 comments

When authoring minimal APIs it might not be obvious that endpoint metadata can be defined for the APIs (via extension methods or attributes) that will help to accurately describe them in ApiExplorer and in turn OpenAPI documents generated by libraries like Swashbuckle.

Similar to the existing analyzer in MVC today, we could create an analyzer for minimal APIs that alerts the user when it detects that what a minimal API actually returns doesn't match what it's defined to return in its metadata. The analyzer could then offer a quick-fix to bring them inline.

This analyzer could potentially form the basis of a future source generator (see #34544) that automatically registers the metadata for minimal APIs based on what it detects they actually return.

We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process.

Thanks for contacting us.

We're moving this issue to the .NET 8 Planning milestone for future evaluation / consideration. We would like to keep this around to collect more feedback, which can help us with prioritizing this work. We will re-evaluate this issue, during our next planning meeting(s).
If we later determine, that the issue has no community involvement, or it's very rare and low-impact issue, we will close it - so that the team can focus on more important and high impact issues.
To learn more about what to expect next and how this issue will be handled you can read more about our triage process here.

We're opting to close this one in favor of more specific approaches like #45217.