Skip to content

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

Merged
captainsafia merged 2 commits into
mainfrom
safia/fix-binding-source
Nov 19, 2024
Merged

Don't throw exception for parameters with custom binding source#59035
captainsafia merged 2 commits into
mainfrom
safia/fix-binding-source

Conversation

@captainsafia

Copy link
Copy Markdown
Contributor

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
@ghost ghost 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

@mikekistler mikekistler left a comment

Copy link
Copy Markdown

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
@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
Copy Markdown
Contributor Author

/backport to release/9.0

@github-actions

Copy link
Copy Markdown
Contributor

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

captainsafia pushed 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