Skip to main content

Model Properties Will Be Optional By Default In Swagger 1.2 Import

· One min read

If the required property is skipped while defining a Model Object in Swagger 1.2 we now assume all properties as optional by default


When defining a Model Object, the required property is an array of string and is defined by Swagger 1.2 specification as:

A definition of which properties MUST exist when a model instance is produced.

It is not specified what the default behaviour should be in case this property is completely skipped. Initially, we assumed all properties to be required unless specified otherwise using the required property. However, we have changed this behaviour and now assume all properties as optional. If you need to specify certain properties as required you must mention their names in the required array property.