cancel
Showing results for 
Search instead for 
Did you mean: 

Empty array in "required" field in Schema Object

SOLVED
Highlighted
Visitor

Empty array in "required" field in Schema Object

According to OpenApi3 (actually, Json Schema) specification empty array is allowed for "required" field in Schema Object. (see https://github.com/json-schema-org/json-schema-spec/issues/69)
But swagger-editor tool throws errors like "....required should NOT have less than 1 items" and in the website 

https://swagger.io/docs/specification/data-models/data-types/ written the same.
Is this a bug in the web-site documentation and in the swagger-editor tool?



1 ACCEPTED SOLUTION

Accepted Solutions
Moderator

Re: Empty array in "required" field in Schema Object

Hi @road21,

 

OpenAPI 3.0 uses JSON Schema Wright Draft 00 (aka Draft 5), which requires at least one item in the "required" list:

https://tools.ietf.org/html/draft-wright-json-schema-validation-00#section-5.15

 

Empty "required" list is supported in later versions of JSON Schema, but OpenAPI has not been updated to that version yet.


Helen Kosova
SmartBear Technical Writer
________________________

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others.↓↓↓↓↓

View solution in original post

1 REPLY 1
Moderator

Re: Empty array in "required" field in Schema Object

Hi @road21,

 

OpenAPI 3.0 uses JSON Schema Wright Draft 00 (aka Draft 5), which requires at least one item in the "required" list:

https://tools.ietf.org/html/draft-wright-json-schema-validation-00#section-5.15

 

Empty "required" list is supported in later versions of JSON Schema, but OpenAPI has not been updated to that version yet.


Helen Kosova
SmartBear Technical Writer
________________________

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others.↓↓↓↓↓

View solution in original post