Closed
Description
I've encountered three issues when using the example supporting defaults (on python 3.5.3).
- the method
check_schema
crashes in a most peculiar way. CallingDefaultValidatingDraft4Validator.check_schema(schema)
causes aRecursionError: maximum recursion depth exceeded while calling a Python object
- this code may work in an unexpected way when the
default
value is a mutable object. For example, let's say you validate an object and the default value gets injected. If you then manipulate this object, and modify the injected default value, the next time this schema injects the default value it shall be modified. Changinginstance.setdefault(property, subschema["default"])
toinstance.setdefault(property, copy.deepcopy(subschema["default"]))
solves this completely, maybe it's worth to include it in the example? - This code doesn't work with python 3 because of the
.iteritems()
call, but that's just a cosmetic detail.