Skip to content

Commit 12a92ea

Browse files
committed
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 <[email protected]>
1 parent e61dcbc commit 12a92ea

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

jsonschema/_validators.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,9 @@ def dependentRequired(validator, dependentRequired, instance, schema):
265265

266266

267267
def dependentSchemas(validator, dependentSchemas, instance, schema):
268+
if not validator.is_type(instance, "object"):
269+
return
270+
268271
for property, dependency in dependentSchemas.items():
269272
if property not in instance:
270273
continue

0 commit comments

Comments
 (0)