Set EndpointName and DisplayName given method name in endpoints#35439
Merged
BrennanConroy merged 8 commits intorelease/6.0-rc1from Aug 19, 2021
Merged
Set EndpointName and DisplayName given method name in endpoints#35439BrennanConroy merged 8 commits intorelease/6.0-rc1from
BrennanConroy merged 8 commits intorelease/6.0-rc1from
Conversation
6eff9d2 to
870b2df
Compare
campersau
reviewed
Aug 18, 2021
src/Http/Routing/src/Builder/MinimalActionEndpointRouteBuilderExtensions.cs
Outdated
Show resolved
Hide resolved
870b2df to
8fb48c3
Compare
src/Http/Routing/src/Builder/MinimalActionEndpointRouteBuilderExtensions.cs
Show resolved
Hide resolved
BrennanConroy
approved these changes
Aug 18, 2021
src/Http/Routing/src/Builder/MinimalActionEndpointRouteBuilderExtensions.cs
Show resolved
Hide resolved
tmat
reviewed
Aug 18, 2021
src/Shared/RoslynUtils/TypeHelper.cs
Outdated
| /// <summary> | ||
| /// Checks to see if a given type is compiler generated. | ||
| /// <remarks> | ||
| /// The compiler doesn't always annotate every time it generates with the |
Member
Member
There was a problem hiding this comment.
Check the member itself first, then containing type, then its containing type, etc.
tmat
reviewed
Aug 18, 2021
cston
reviewed
Aug 18, 2021
cston
reviewed
Aug 18, 2021
| builder.Metadata.Add(action.Method); | ||
|
|
||
| // Methods defined in a top-level program are generated as statics so the delegate | ||
| // target will be null. Inline lambdas are compiler generated properties so they can |
davidfowl
reviewed
Aug 18, 2021
src/Http/Routing/test/UnitTests/Builder/MinimalActionEndpointRouteBuilderExtensionsTest.cs
Show resolved
Hide resolved
davidfowl
reviewed
Aug 18, 2021
davidfowl
reviewed
Aug 18, 2021
davidfowl
approved these changes
Aug 18, 2021
Member
davidfowl
left a comment
There was a problem hiding this comment.
Just nits but this looks good
Contributor
Author
|
@davidfowl Since you're filling in as M2 while Kevin is out, want to apply the cc: @wtgodbe Need your help merging once it's all clear. |
Member
|
Don't forget to forward port to main, it wont be automatic. |
halter73
reviewed
Aug 19, 2021
src/Http/Routing/test/UnitTests/Builder/MinimalActionEndpointRouteBuilderExtensionsTest.cs
Show resolved
Hide resolved
halter73
requested changes
Aug 19, 2021
Member
halter73
left a comment
There was a problem hiding this comment.
I think we need to check if the method is a local function before excluding it for being compiler generated.
halter73
reviewed
Aug 19, 2021
src/Http/Routing/src/Builder/MinimalActionEndpointRouteBuilderExtensions.cs
Outdated
Show resolved
Hide resolved
halter73
approved these changes
Aug 19, 2021
captainsafia
pushed a commit
that referenced
this pull request
Aug 19, 2021
captainsafia
pushed a commit
that referenced
this pull request
Aug 20, 2021
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Adds support for automatically setting the name of an endpoint given the name of the method used as a delegate. For example:
will produce
HelloWorldas an endpoint name.The method name is also incorporated into the display name to make it easier for users to debug issues with routes.
Old display name: /hello HTTP: GET
New display name: HTTP: GET /hello => HelloWorld
Customer Impact
The changes in this PR make it easier for users to interact with the OpenAPI improvements that were shipped in RC1. They also make it easier for users to debug issues related to duplicate route names by improving the display name used to represent routes.
Regression?
Risk
Changes here are isolated to minimal APIs and are part of new changes that were introduced in rc1.
Verification
Packaging changes reviewed?
Fixes #35435 and #34540.