summaryrefslogtreecommitdiff
path: root/jsonschema
diff options
context:
space:
mode:
authorRob Herring <robh@kernel.org>2021-10-01 15:43:58 -0500
committerRob Herring <robh@kernel.org>2021-10-01 15:43:58 -0500
commit12a92ead0bac63f5b976b6f5f084c000f3493463 (patch)
tree67ecc919af6936c9d82c11b7c94b6d9de396ffc9 /jsonschema
parente61dcbcb2a156b8d517c4ee7ea08c8e9e2acfb35 (diff)
downloadjsonschema-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.py3
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