jschon.vocabulary.format
- class jschon.vocabulary.format.FormatKeyword(parentschema, value)
- Parameters:
parentschema (JSONSchema) –
value (str) –
- __init__(parentschema, value)
- Parameters:
parentschema (JSONSchema) –
value (str) –
- key: str = 'format'
The keyword name as it appears in a schema object.
- parentschema: JSONSchema
- jschon.vocabulary.format.format_validator(format_attr, *, instance_types=('string',))
A decorator for a format validation function.
The decorator only registers a function as a format validator. Assertion behaviour must be enabled in a catalog using
enable_formats()
.- Parameters:
format_attr (str) – The format attribute that the decorated function validates.
instance_types (Tuple[str, ...]) – The set of instance types validated by this format.
- jschon.vocabulary.format.FormatValidator
Call signature for a function decorated with
format_validator()
.The function validates a JSON-compatible Python object (typically, a string) and raises a
ValueError
if the object is invalid per the applicable format specification.alias of
Callable
[[Union
[None
,bool
,int
,float
,str
,Sequence
[Any
],Mapping
[str
,Any
]]],None
]