Skip to content

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

Closed
tfrauenstein opened this issue Dec 29, 2016 · 5 comments

Comments

@tfrauenstein
Copy link
Member

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.

@rcillo
Copy link

rcillo commented Dec 30, 2016

@tfrauenstein I believe this is a problem only for plain json-schema, not for OpenAPI.

OpenAPI accepts only objects as valid values for additionalProperties. This is clarified in this related issue OAI/OpenAPI-Specification#668 since this constraint is not explicitly written in the OpenAPI spec.

That said, additionalProperties false/true are not valid when using OpenAPI.

@dehora
Copy link
Member

dehora commented Jan 17, 2017

I believe this is a problem only for plain json-schema, not for OpenAPI.

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.

That said, additionalProperties false/true are not valid

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.

@tfrauenstein
Copy link
Member Author

👍 @dehora It would be great, if you can contribute with related concrete PR proposal, thx.

@fmueller
Copy link
Contributor

fmueller commented Mar 3, 2017

@dehora @tfrauenstein Is this issue already resolved with Bill's pull request?

@tfrauenstein
Copy link
Member Author

Yes, resolved with Treat Open API Definitions As Open For Extension By Default. #195

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants