Skip to content

Don't throw exception for parameters with custom binding source #59035

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

Merged
merged 2 commits into from
Nov 19, 2024

Conversation

captainsafia
Copy link
Member

Closes #59013.

We can probably afford to be more lax here. One thing to note is that this means that users will have to do the due diligence to set the parameter location themselves via transformers since we can't figure out this information implicitly.

Also, if users want to specify custom binder for a parameter that is actually from the body, they will need to define the binding source correctly on the model binder so that the argument appears under the requestBody field of the operation instead of the parameters field.

@captainsafia captainsafia requested a review from a team as a code owner November 18, 2024 21:29
@dotnet-issue-labeler dotnet-issue-labeler bot added the area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates label Nov 18, 2024
@BrennanConroy BrennanConroy changed the title Don't through exception for parameters with custom binding source Don't throw exception for parameters with custom binding source Nov 18, 2024
Copy link
Contributor

@mikekistler mikekistler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! 👍

@captainsafia captainsafia enabled auto-merge (squash) November 19, 2024 18:11
@captainsafia captainsafia merged commit f95ba2a into main Nov 19, 2024
27 checks passed
@captainsafia captainsafia deleted the safia/fix-binding-source branch November 19, 2024 18:20
@dotnet-policy-service dotnet-policy-service bot added this to the 10.0-preview1 milestone Nov 19, 2024
@captainsafia
Copy link
Member Author

/backport to release/9.0

Copy link
Contributor

Started backporting to release/9.0: https://github.com/dotnet/aspnetcore/actions/runs/12384353552

captainsafia added a commit that referenced this pull request Feb 11, 2025
* Don't through exception for parameters with custom binding source

* Default to ParameterLocation.Query for ambiguous source
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates
Projects
None yet
Development

Successfully merging this pull request may close these issues.

generate openapi json error when custom IBindingSourceMetadata
3 participants