-
Notifications
You must be signed in to change notification settings - Fork 10.7k
Automatically set OpenAPI endpoint metadata for minimal APIs #34544
Copy link
Copy link
Open
Labels
Needs: DesignThis issue requires design work before implementating.This issue requires design work before implementating.Priority:1Work that is critical for the release, but we could probably ship withoutWork that is critical for the release, but we could probably ship withoutarea-minimalIncludes minimal APIs, endpoint filters, parameter binding, request delegate generator etcIncludes minimal APIs, endpoint filters, parameter binding, request delegate generator etcfeature-minimal-actionsController-like actions for endpoint routingController-like actions for endpoint routing
Milestone
Metadata
Metadata
Assignees
Labels
Needs: DesignThis issue requires design work before implementating.This issue requires design work before implementating.Priority:1Work that is critical for the release, but we could probably ship withoutWork that is critical for the release, but we could probably ship withoutarea-minimalIncludes minimal APIs, endpoint filters, parameter binding, request delegate generator etcIncludes minimal APIs, endpoint filters, parameter binding, request delegate generator etcfeature-minimal-actionsController-like actions for endpoint routingController-like actions for endpoint routing
Type
Fields
Give feedbackNo fields configured for issues without a type.
Rather than having to manually specify the endpoint metadata associated with describing the response types a minimal API produces, it would be preferable to have these details automatically added based on what the minimal API actually does (its implemention) and/or by some convention based on how it's declared.
app.MapGet("/hello/{name}", (string name) => $"Hello {name}");might get an auto-generated name ofGetHelloByName.IResultreturning endpoint delegates, the status codes, content types, and response types the endpoint returns could be determined by analyzing the method body implementation and detecting the return paths and determining the specific details of what theIResultdoes when executed, e.g. by annotations on theIResult-implementing type itself, or some other mechanismIHostingStartup&IStartupFilter) and is then used to match the details with the registered endpoints.This is scoped to post-.NET 6 at this time, but could potentially be delivered before .NET 7 if it only involves an update in the tooling/SDK rather than an update in the ASP.NET Core shared framework.