diff options
author | Rob Herring <robh@kernel.org> | 2021-10-01 15:43:58 -0500 |
---|---|---|
committer | Rob Herring <robh@kernel.org> | 2021-10-01 15:43:58 -0500 |
commit | 12a92ead0bac63f5b976b6f5f084c000f3493463 (patch) | |
tree | 67ecc919af6936c9d82c11b7c94b6d9de396ffc9 /jsonschema | |
parent | e61dcbcb2a156b8d517c4ee7ea08c8e9e2acfb35 (diff) | |
download | jsonschema-12a92ead0bac63f5b976b6f5f084c000f3493463.tar.gz |
validators: Fix dependentSchemas when instance is not an object
Just like 'dependentRequired' and 'dependencies', 'dependentSchemas'
needs to handle instance not being an object.
Signed-off-by: Rob Herring <robh@kernel.org>
Diffstat (limited to 'jsonschema')
-rw-r--r-- | jsonschema/_validators.py | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/jsonschema/_validators.py b/jsonschema/_validators.py index e0845ea..cb869ea 100644 --- a/jsonschema/_validators.py +++ b/jsonschema/_validators.py @@ -265,6 +265,9 @@ def dependentRequired(validator, dependentRequired, instance, schema): def dependentSchemas(validator, dependentSchemas, instance, schema): + if not validator.is_type(instance, "object"): + return + for property, dependency in dependentSchemas.items(): if property not in instance: continue |