-
Notifications
You must be signed in to change notification settings - Fork 9.1k
Description
I had a look through the open issues and couldn't find a specific issue for this, apologies if I missed it. It's alluded to in the following but not directly addressed
- Make schema object compatible with JSON Schema draft4 #333
- Make it clear that
additionalProperties
can only have a schema value #668 - additionalProperties with Boolean value causes NPEs swagger-api/swagger-codegen#1318
The clarification I'm looking for is - are object definitions open or closed for extension, and specifically what is the default for handling unexpected JSON properties in the absence of an additionalProperties
declaration?
If Open API was using vanilla JSON Schema, I would assume the absence of additionalProperties
means the instances are open for extension, since additionalProperties
has not been explicitly set to false
to close the schema. But because Open API redefines parts of JSON Schema, and in particular additionalProperties
and how it should handle booleans, I'm reluctant to just assume that behaviour is carried forward into Open API.
At the moment I can't find a definitive statement in existing specifications for this, in particular http://swagger.io/specification/#schemaObject (again apologies if I missed it). I do think it's something that needs to be explicit as it relates to how clients based on Open API handle unexpected data and how Open API tooling should behave by default, especially given additionalProperties
has been redefined.