Replies: 1 comment
-
The behavior you're describing is the behavior mandated by the JSON Schema spec, which allows unknown keywords in all existing versions, though which will likely disallow them in upcoming ones. The basic general answer is "have tests which exercise your schema" if you're trying to catch bugs in it. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
This is a naive question but I have not found any other discussion about it.
I have learned from https://json-schema.org/understanding-json-schema/basics that an empty schema is a valid one. And so jsonschema.validate() does not raise an exception if you pass in an empty value for schema. That's fine, as it is easy enough to first test if the schema argument value is empty or.
But jsonschema.validate() also seems to accept a non-empty schema value that does not contain any useful schema keywords. So when I call jsonschema.validate() how can I be certain that the schema describes some specific properties of an instance?
Afaict the validator check_schema methods ignore unrecognized keywords so a schema full of garbage is no different than an empty one.
Beta Was this translation helpful? Give feedback.
All reactions