jschon.vocabulary.format
- class jschon.vocabulary.format.FormatKeyword(parentschema, value)
- Parameters
parentschema (jschon.jsonschema.JSONSchema) –
value (str) –
- __init__(parentschema, value)
- Parameters
parentschema (jschon.jsonschema.JSONSchema) –
value (str) –
- evaluate(instance, result)
- Parameters
instance (jschon.json.JSON) –
result (jschon.jsonschema.Result) –
- Return type
None
- json: jschon.json.JSON
- key: str = 'format'
- parentschema: jschon.jsonschema.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
]