DEV Community

Oliver Rivett-Carnac
Oliver Rivett-Carnac

Posted on

Validating non-nullable property in Body as Required - AspNetCore 3.1

I am trying to validate that if a property / field is completely left off on a request that the ModelState is invalid and a BadRequest is sent back to the client, however I am struggling with handling of non-nullable types in request bodies.

Works for nullable types

[Required] public

Top comments (0)