File tree 1 file changed +3
-3
lines changed
1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -325,18 +325,18 @@ Custom type formats
325
325
-------------------
326
326
327
327
It is possible to define custom type formats for validation without adding a custom validator, by
328
- leveraging the ``jsonschema.draft4_format_checker .checks `` decorator.
328
+ leveraging the ``jsonschema.Draft4Validator.FORMAT_CHECKER .checks `` decorator.
329
329
330
330
We can for instance create a custom `money ` format.
331
331
332
332
.. code-block :: python
333
333
334
334
import re
335
- from jsonschema import draft4_format_checker
335
+ from jsonschema import Draft4Validator
336
336
337
337
MONEY_RE = re.compile(' ^\$\s*\d+(\.\d\d)?' )
338
338
339
- @draft4_format_checker .checks (' money' )
339
+ @Draft4Validator.FORMAT_CHECKER .checks (' money' )
340
340
def is_money (val ):
341
341
if not isinstance (val, str ):
342
342
return True
You can’t perform that action at this time.
0 commit comments