File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -47,9 +47,18 @@ started:
4747 DefaultValidatingDraft4Validator = extend_with_default(Draft4Validator)
4848
4949
50+ # Example usage:
51+ obj = {}
52+ schema = {' properties' : {' foo' : {' default' : ' bar' }}}
53+ # Note jsonschem.validate(obj, schema, cls=DefaultValidatingDraft4Validator)
54+ # will not work because the metaschema contains `default` directives.
55+ DefaultValidatingDraft4Validator(schema).validate(obj)
56+ assert obj == {' foo' : ' bar' }
57+
58+
5059 See the above-linked document for more info on how this works, but basically,
5160it just extends the :validator: `properties ` validator on a
52- :class: `Draft4Validator ` to then go ahed and update all the defaults.
61+ :class: `Draft4Validator ` to then go ahead and update all the defaults.
5362
5463If you're interested in a more interesting solution to a larger class of these
5564types of transformations, keep an eye on `Seep
You can’t perform that action at this time.
0 commit comments