-
Notifications
You must be signed in to change notification settings - Fork 535
Description
Per the openapi v2 and greater spec definitions, additionalProperties should be set to empty schema {} if it is omitted. It is currently being set to null.
v2.0 points us to the https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md JSON schema Draft 4 definition, and OpenAPI does not tell us a default value.
Per here it sounds like an omitted additionalProperties should be an empty schema.
v3.0.0 points us to the https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md JSON Schema Specification Wright Draft 00 definition.
Wright Draft 00 mentions
If "additionalProperties" is absent, it may be considered present with an empty schema as a value.
v3.0.3 explicitly says that it defaults to true here: https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.3.md
Specifically from https://tools.ietf.org/html/draft-wright-json-schema-validation-00#page-10:
If "additionalProperties" is absent, it may be considered present with an empty schema as a value.
When additionalProperties is omited, how about we set it to {} for:
- object type schemas
- composed schemas
So that we conform to the specs