-
Hi, I was wondering why doesn't the jsonschema.validate() raise an exception if I have empty json.
If I test this against
Finally if I have the following json which is like the schema but with wrong types it will raise an Exception as expected.
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
In the JSON Schema specification (all current versions of it), properties are not required by default until you say so, either via the Without doing so, what your schema means is simply that those subschemas apply only if the corresponding property is present. |
Beta Was this translation helpful? Give feedback.
In the JSON Schema specification (all current versions of it), properties are not required by default until you say so, either via the
required
validator or by sayingadditionalProperties: false
.Without doing so, what your schema means is simply that those subschemas apply only if the corresponding property is present.