Closed
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