-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Description
Is your feature request related to a problem? Please describe.
Currently the System.ComponentModel.DataAnnotations.Required
is generated for required properties. This is not recognized by the STJ deserializer and so no JsonException is thrown when a required property does not exist in json data.
Describe the solution you'd like
I'd like the JsonRequiredAttribute
added to required properties so that an exception is thrown. That, or insert the required
keyword in the property itself, either work the same for STJ during deserialization.
Describe alternatives you've considered
Hoped the standard data annotation would suffice but alas no.
Additional context
I'm using Refitter to generate the clients from an openapi v3 spec. This uses NSwag, but I have a feeling this requires a change to NJsonSchema at a template level.