Skip to content

Commit

Permalink
validators: Fix dependentSchemas when instance is not an object
Browse files Browse the repository at this point in the history
Just like 'dependentRequired' and 'dependencies', 'dependentSchemas'
needs to handle instance not being an object.

Signed-off-by: Rob Herring <[email protected]>
  • Loading branch information
robherring committed Oct 1, 2021
1 parent e61dcbc commit 12a92ea
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions jsonschema/_validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 12a92ea

Please sign in to comment.