-
Notifications
You must be signed in to change notification settings - Fork 10.4k
First pass at basic query string parameters. #46545
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
First pass at basic query string parameters. #46545
Conversation
@captainsafia here is the minimal PR that I think will help us avoid stepping on each others toes. |
src/Http/Http.Extensions/gen/StaticRouteHandlerModel/Emitters/EndpointParameterEmitter.cs
Outdated
Show resolved
Hide resolved
src/Http/Http.Extensions/gen/StaticRouteHandlerModel/EndpointParameter.cs
Outdated
Show resolved
Hide resolved
src/Http/Http.Extensions/gen/StaticRouteHandlerModel/StaticRouteHandlerModel.Emitter.cs
Outdated
Show resolved
Hide resolved
...t/RequestDelegateGenerator/Baselines/MapAction_NoParam_StringReturn_WithFilter.generated.txt
Outdated
Show resolved
Hide resolved
.../RequestDelegateGenerator/Baselines/Multiple_MapAction_WithParams_StringReturn.generated.txt
Show resolved
Hide resolved
src/Http/Http.Extensions/test/RequestDelegateGenerator/RequestDelegateGeneratorTests.cs
Show resolved
Hide resolved
…EndpointParameterEmitter.cs Co-authored-by: Safia Abdalla <[email protected]>
…arameter.cs Co-authored-by: Safia Abdalla <[email protected]>
…teHandlerModel.Emitter.cs Co-authored-by: Safia Abdalla <[email protected]>
src/Http/Http.Extensions/test/Microsoft.AspNetCore.Http.Extensions.Tests.csproj
Show resolved
Hide resolved
src/Http/Http.Extensions/test/RequestDelegateGenerator/RequestDelegateGeneratorTests.cs
Outdated
Show resolved
Hide resolved
.../RequestDelegateGenerator/Baselines/MapAction_MultipleStringParam_StringReturn.generated.txt
Outdated
Show resolved
Hide resolved
.../RequestDelegateGenerator/Baselines/MapAction_MultipleStringParam_StringReturn.generated.txt
Outdated
Show resolved
Hide resolved
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.
Please undo the submodule changes
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.
LGTM for the generator changes
It looks like there have been some unintended changes made to the git submodules. I'd revert those before merging.
src/Http/Http.Extensions/gen/StaticRouteHandlerModel/StaticRouteHandlerModel.Emitter.cs
Show resolved
Hide resolved
...est/RequestDelegateGenerator/Baselines/Multiple_MapAction_NoParam_StringReturn.generated.txt
Show resolved
Hide resolved
...pAction_SingleNullableStringParam_WithoutQueryStringValueProvided_StringReturn.generated.txt
Show resolved
Hide resolved
src/Http/Http.Extensions/gen/StaticRouteHandlerModel/Emitters/EndpointParameterEmitter.cs
Show resolved
Hide resolved
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.
Approving since I'm fine with the generator changes and @wtgodbe has already requested changes for the submodule changes I was nervous about. 😅
This reverts commit 0a847ac.
Done. Sorry about that. GitHub was giving me issues yesterday not recognizing a push that I had made, and I did a sloppy whitespace change and ended up pulling in the submodules update inadvertently. |
|
First pass at basic string binding for request delegate source generator
This PR gets the basics of binding strings to the source generated request delegate. It builds on the special type parameter handling. The PR includes logic to detect the IFromX metadata interfaces and set the parameter type accordingly (this is the explicit handling logic discussed.
It includes partial null handling in that it will return a 400 if StringValues is null or empty - but it doesn't do full on nullability handling around things like nullable arrays, arrays of nullables, and nullable arrays of nullables.
You can see where I've got a pattern matching switch to detect what kind of parameter preparation logic to emit. The idea here is that if we have a particular special case which is messy to handle with just one block of code we can use this switch to provide alternative implementations, but mostly it'll just switch on the Source property.
(note: some tests aren't passing yet because I haven't updated the baselines - that'll be the last thing I do)