New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support setting operation IDs from EndpointName metadata #2173
Support setting operation IDs from EndpointName metadata #2173
Conversation
b4e6b78
to
8b22fbe
Compare
8b22fbe
to
05b3f45
Compare
// endpoint name if no route name is available. This allows us to | ||
// generate operation IDs for endpoints that are defined using | ||
// minimal APIs. | ||
#if (!NETSTANDARD2_0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is ifdef'd out since the M.A.Routing 2.1.0 package does not contain the EndpointNameMetadata
types that we need here. We could update the repo to rely on M.A.* 2.2.0 packages for everything if we wanted to avoid if-defing here but that seemed more appropriate for a separate PR.
quick ping to @domaindrivendev. @captainsafia can't apply labels or milestones but this is one of the minimal items we discussed. Thanks! |
#if (!NETSTANDARD2_0) | ||
return | ||
actionDescriptor.AttributeRouteInfo?.Name | ||
?? (actionDescriptor.EndpointMetadata.FirstOrDefault(m => m is EndpointNameMetadata) as EndpointNameMetadata)?.EndpointName; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We do FirstOrDefault
here and not SingleOrDefault
because of dotnet/aspnetcore#34199.
Fixes #2165.
Part of dotnet/aspnetcore#34514.