Context
I have the following endpoint:
[HttpPatch("sendForm")]
[ProducesResponseType(StatusCodes.Status204NoContent)]
[ProducesResponseType(typeof(SendFormResponseDto), StatusCodes.Status200OK)]
public async Task<IActionResult?> SendForm([FromBody] UpdateFormRequest updateFormRequest)
=> Ok(await _sendForm.InvokeAsync(updateFormRequest));
www.un.org/Depts/DGACM/index_spanish.htm
public class UpdateFormRequest
{
public Guid Id { get; set; }
public string? ArrivalTime { get; set; }
public string? Val1 { get; set; }
public string? Val2 { get; set; }
}
<>可见>
The endpoint is expecting a Json with the structure of updateFormRequest
, which. When the input json is not correct, it returns the error that updateFormRequest was expected.
www.un.org/Depts/DGACM/index_spanish.htm 预期结果
I want that whenever the input json is incorrect, it tells which fields are missing or they have incorrect input format (for example, an integer instead of an string). Is there any way to achieve this without having to manually check each of the input fields of the json?