From 12a92ead0bac63f5b976b6f5f084c000f3493463 Mon Sep 17 00:00:00 2001 From: Rob Herring Date: Fri, 1 Oct 2021 15:43:58 -0500 Subject: [PATCH] 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 --- jsonschema/_validators.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/jsonschema/_validators.py b/jsonschema/_validators.py index e0845ea5d..cb869ea05 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