You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Notice there are no required properties in this object. I think the usage of required on the property should add the property to the required list in the object schema. Right now I have to annotate the property with [Required] to get the desired effect.
With or without RequiredAttribute, deserialization to this object fails if "age" is omitted in the JSON if I use the default JSON serializer for ASP.NET (System.Text.Json). I think Open API document generation should match this behavior and mark these properties as required.
I think this can be solved by looking for the RequiredMemberAttribute in addition to RequiredAttribute when determining if a property is required or not. RequiredMemberAttribute is generated by the compiler for required properties.
The text was updated successfully, but these errors were encountered:
Generated Open API definition does not mark properties as required if I use the
required
keyword on the properties.Consider this request body type:
When generating the Open API definition using NSwag, this type schema is generated:
Notice there are no required properties in this object. I think the usage of
required
on the property should add the property to the required list in the object schema. Right now I have to annotate the property with[Required]
to get the desired effect.With or without
RequiredAttribute
, deserialization to this object fails if"age"
is omitted in the JSON if I use the default JSON serializer for ASP.NET (System.Text.Json
). I think Open API document generation should match this behavior and mark these properties as required.I think this can be solved by looking for the
RequiredMemberAttribute
in addition toRequiredAttribute
when determining if a property is required or not.RequiredMemberAttribute
is generated by the compiler forrequired
properties.The text was updated successfully, but these errors were encountered: