-
Notifications
You must be signed in to change notification settings - Fork 415
How our "compatible extensibility" and "robustness principle" apply to OpenAPI / JSON Schema additionalProperties usage? #164
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
Comments
@tfrauenstein I believe this is a problem only for plain json-schema, not for OpenAPI. OpenAPI accepts only objects as valid values for That said, |
Not quite. Because Open API removes the true/false options such that there's no way to express anything goes, it's unclear what the default extension model is (in JSON Schema, it's open for extension, in Swagger and Open API it's undefined). Common sense, least surprise and the spirit of the guidelines suggests data is open for extension from HTTP APIs working under these guidelines, but that's not a strong basis for resolving differing interpretations.
Strictly speaking they're ignored by some swagger tools, ie additionalProperties true doesn't necessarily cause an invalid error. That means teams who aren't reading deeply into multiple specifications may think they're defining something when they're not. For defining events there's even more going on (as you know) since teams have to work with JSON Schema for event types and Open API for a HTTP API, but are often working with the same underlying entity. Also the rules are not the same, additionalProperties and undefined fields are handled more strictly for event type schema compatibility reasons. It's really unfortunate, but I suspect we need to cover this. Even if a future Open API edition fixes its specification, we still have to deal with tools in the ecosystem that are lagging behind. |
👍 @dehora It would be great, if you can contribute with related concrete PR proposal, thx. |
@dehora @tfrauenstein Is this issue already resolved with Bill's pull request? |
Yes, resolved with Treat Open API Definitions As Open For Extension By Default. #195 |
Open API is not clear about usage / pragmatics of JSON scheme additionalProperties feature. We should make some clarifying statements on how our compatible extensibility and robustness principle (for clients and servers) maps to this keywords.
For instance, If additionalProperties is false for return data, its structure cannot be extended in future.
Seems to contradict the robustness principle for clients, that anyway should be prepared for additional properties in return data. So I would say we deprecate additionalProperties false here or, at least, give a hint on the consequences.
The text was updated successfully, but these errors were encountered: