You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We recently hit a similar issue as the person who filed that ticket, where a typo in our schema silently removed some validations we thought were running.
As an implementation, it would be very handy if json_schemer allowed a flag to validate_schema that "turned on" additionalProperties: false for the metaschema in order to catch such things.
The text was updated successfully, but these errors were encountered:
This is an interesting idea. It sounds similar to json-schema's strictoption:
## with the `:strict` option, all properties are considered to have `"required": true` and all objects `"additionalProperties": false`## => trueJSON::Validator.validate(schema,{"a"=>1,"b"=>{"x"=>2}},:strict=>true)# => falseJSON::Validator.validate(schema,{"a"=>1,"b"=>{"x"=>2},"c"=>3},:strict=>true)# => falseJSON::Validator.validate(schema,{"a"=>1},:strict=>true)
I think it makes sense to offer it as an option for both metaschema and regular validation. I probably won't work on this in the near future myself, but if you're interested in contributing, I'd be happy to help/review.
For just meta schema validation like you're talking about, you might be able to create a custom meta schema that includes additionalProperties: false everywhere.
Per json-schema-org/json-schema-spec#577, JSON Schema metaschemas generally allow unsupported keywords to be present.
We recently hit a similar issue as the person who filed that ticket, where a typo in our schema silently removed some validations we thought were running.
As an implementation, it would be very handy if json_schemer allowed a flag to
validate_schema
that "turned on"additionalProperties: false
for the metaschema in order to catch such things.The text was updated successfully, but these errors were encountered: