IsRequired Validation in DTO?

Is there a way to trigger validation on a DTO passed in to an API so that it uses the OpenAPI IsRequired property to ensure required fields have been populated? I saw the post from last month in this forum, but I’m not sure from there if this is related and if it is, how to configure this to work. I would assume it’s pretty normative functionality to want to validate that any field marked with IsRequired=true has been populated.

thanks!

There’s no implicit validation of metadata attributes, you could use create a routine using reflection in a Global Request Filter to scan and Request DTO and return your preferred Error Response.

You can submit a feature request to enable validation of metadata attributes, it will take some effort to implement properly as we’d want to use the validation behavior in Fluent Validation and make it extensible to allow registration mapping of attributes to validation rules.

thanks - done: