-
Notifications
You must be signed in to change notification settings - Fork 10.4k
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
Description
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:
[HttpPost]
public IActionResult Post([FromBody]SomeClass request = null)
{
return Ok();
}
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 = true
to not be required in the body of the request.
Additional context
Similar issue here: aspnet/Mvc#6920
alagoa, paulpce, pentp, ilya-chumakov, MaklaCof and 23 more
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