How to specify if a field is optional or required in OpenAPI/Swagger?
By default, fields in a model are optional unless you put them in the required list. Below is an example – id, category are optional fields, name is required. Note that required is not an attribute of fields, but an attribute of the object itself – it’s a list of required properties. type: object required: … Read more