-
Notifications
You must be signed in to change notification settings - Fork 25
Description
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.