-
Notifications
You must be signed in to change notification settings - Fork 10.7k
Optional [FromBody] Model Binding #6878
Copy link
Copy link
Closed
Labels
area-mvcIncludes: MVC, Actions and Controllers, Localization, CORS, most templatesIncludes: MVC, Actions and Controllers, Localization, CORS, most templatesenhancementThis issue represents an ask for new feature or an enhancement to an existing oneThis issue represents an ask for new feature or an enhancement to an existing onehelp wantedUp for grabs. We would accept a PR to help resolve this issueUp for grabs. We would accept a PR to help resolve this issue
Milestone
Metadata
Metadata
Assignees
Labels
area-mvcIncludes: MVC, Actions and Controllers, Localization, CORS, most templatesIncludes: MVC, Actions and Controllers, Localization, CORS, most templatesenhancementThis issue represents an ask for new feature or an enhancement to an existing oneThis issue represents an ask for new feature or an enhancement to an existing onehelp wantedUp for grabs. We would accept a PR to help resolve this issueUp for grabs. We would accept a PR to help resolve this issue
Type
Fields
Give feedbackNo fields configured for issues without a type.
Is your feature request related to a problem? Please describe.
I am trying to use optional
[FromBody]model binding on a per-endpoint basis.Example:
An empty request body results in the following being returned:
{ "": [ "A non-empty request body is required." ] }Describe the solution you'd like
For properties that have default value ie
[FromBody] bool expandRelations = trueto not be required in the body of the request.Additional context
Similar issue here: aspnet/Mvc#6920