Skip to content
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

Conversation

@captainsafia
Copy link
Contributor

@captainsafia captainsafia commented Jul 29, 2021

Fixes #2165.

Part of dotnet/aspnetcore#34514.

@captainsafia captainsafia force-pushed the safia/op-id-from-group-name branch from b4e6b78 to 8b22fbe Jul 29, 2021
@captainsafia captainsafia force-pushed the safia/op-id-from-group-name branch from 8b22fbe to 05b3f45 Jul 29, 2021
// 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)
Copy link
Contributor Author

@captainsafia captainsafia Jul 29, 2021

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.

@captainsafia captainsafia marked this pull request as ready for review Jul 29, 2021
@bradygaster
Copy link

@bradygaster bradygaster commented Jul 29, 2021

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;
Copy link
Contributor Author

@captainsafia captainsafia Jul 29, 2021

We do FirstOrDefault here and not SingleOrDefault because of dotnet/aspnetcore#34199.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

4 participants