Skip to content

Commit 41f2f8d

Browse files
author
William Speirs
committed
Made required_draft4 more robust when used with Draft3
1 parent 20ff43f commit 41f2f8d

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

jsonschema/_validators.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,11 @@ def properties_draft4(validator, properties, instance, schema):
296296
def required_draft4(validator, required, instance, schema):
297297
if not validator.is_type(instance, "object"):
298298
return
299+
300+
if not isinstance(required, list):
301+
yield ValidationError("Found Draft3 style 'required' restriction")
302+
return
303+
299304
for property in required:
300305
if property not in instance:
301306
yield ValidationError("%r is a required property" % property)

0 commit comments

Comments
 (0)