-
Notifications
You must be signed in to change notification settings - Fork 533
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
additionalProperties not set correctly if omitted or a boolean #1369
Comments
Hi @spacether the 2nd PR is also failing, please fix so we can review and merge. thanks! I understand the first PR is to exposed the issue. |
Thanks for pointing that out; just now I fixed the tests in my #1414 PR |
Jumping in a little bit late, but better late than... While what you mention for v3 is true, for v2 it's not so much. v2 has several inconsistencies and some missing information. When it comes to JSON Schema, it was due to the fact that nobody really knew JSON Schema well when the decision was made to use it. In v2, despite what the specification might say, the default for additionalProperties was assumed to be I don't think we should change the behavior for v2 - it should become more and more obsolete especially with the upcoming release of v3.1. |
@webron do you have any references that show that decision/interpretation for v2? |
@spacether I find myself to be a reasonable reference in this case, given I was one of the people who wrote the spec ;) |
Closing this due to the above answer |
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:
When additionalProperties is omited, how about we set it to {} for:
So that we conform to the specs
The text was updated successfully, but these errors were encountered: