Add EndpointNameAttribute
to enable setting endpoint name declaratively
#34539
Labels
area-minimal
Includes minimal APIs, endpoint filters, parameter binding, request delegate generator etc
enhancement
This issue represents an ask for new feature or an enhancement to an existing one
feature-minimal-actions
Controller-like actions for endpoint routing
old-area-web-frameworks-do-not-use
*DEPRECATED* This label is deprecated in favor of the area-mvc and area-minimal labels
Priority:1
Work that is critical for the release, but we could probably ship without
Milestone
Uh oh!
There was an error while loading. Please reload this page.
Endpoint names are used to lookup endpoints when generating links using
LinkGenerator
, and as their unique per application are a good candidate for using as theoperationId
for an endpoint in OpenAPI (Swagger) documents.Endpoint names are set using the
Microsoft.AspNetCore.Routing.IEndpointNameMetadata
interface. In the framework today this can only be set imperatively by adding an instance ofMicrosoft.AspNetCore.Routing.EndpointNameMetadata
to the endpoint's metadata, e.g.builder.WithMetadata(new EndpointNameMetadata("GetTodoById"))
. (#33924 includes adding a new extension method to allow adding the name in a more first-class fashion, e.g.builder.WithName("GetTodoById")
).To support declaratively setting an endpoint name we should add an attribute:
The attribute could be used as following:
The text was updated successfully, but these errors were encountered: