Skip to content
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 Behavior #2

Closed
GaryGSC opened this issue Jul 9, 2018 · 1 comment
Closed

additionalProperties Behavior #2

GaryGSC opened this issue Jul 9, 2018 · 1 comment

Comments

@GaryGSC
Copy link

GaryGSC commented Jul 9, 2018

When validating, I'd like the ability to know if a value contains additional properties not explicitly defined by a given schema.

This came up as I was validating mock/example data against my (2.0) definitions. For development purposes, I'd like warnings so that I can know to either update my examples or extend my definitions so that API consumers know what to expect.

From what I can see, OpenApiEnforcer.prototype.errors always sets v.options.additionalProperties to true, regardless of anything I pass in. So, the only way to get errors for additional properties is to explicitly add additionalProperties: false to every schema in my OpenAPI document. Doing that is invalid in OpenAPI 2.0, and while it's valid in 3.0, I'd rather not do that because it conveys that I know I won't be extending the definition in the future.

Side note:
I see that in OpenAPI 3.0, additionalProperties: true is considered the default, but as far as I can tell, false was effectively the default in 2.0.

@GaryGSC
Copy link
Author

GaryGSC commented Oct 25, 2018

Resolved sometime in the last week or two.

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

No branches or pull requests

1 participant