jschon.vocabulary
- class jschon.vocabulary.ArrayOfSubschemas
A
Keyword
class mixin that sets up an array of subschemas for a keyword.- classmethod jsonify(parentschema, key, value)
- Parameters:
parentschema (JSONSchema) –
key (str) –
value (None | bool | int | float | str | Sequence[Any] | Mapping[str, Any]) –
- Return type:
JSON | None
- class jschon.vocabulary.Keyword(parentschema, value)
- Parameters:
parentschema (JSONSchema) –
value (JSONCompatible) –
- __init__(parentschema, value)
- Parameters:
parentschema (JSONSchema) –
value (None | bool | int | float | str | Sequence[Any] | Mapping[str, Any]) –
- depends_on: Tuple[str, ...] = ()
Keywords that must be evaluated before this keyword can be evaluated.
- instance_types: Tuple[str, ...] = ('null', 'boolean', 'number', 'string', 'array', 'object')
The types of instance that the keyword can evaluate.
- key: str = Ellipsis
The keyword name as it appears in a schema object.
- static: bool = False
static = True (equivalent to instance_types = ()) indicates that the keyword does not ever evaluate any instance.
- class jschon.vocabulary.Metaschema(catalog, value, default_core_vocabulary=None, *default_vocabularies, **kwargs)
A metaschema declares the set of vocabularies that are available to any schema which references it, and provides any such schema with its
Keyword
classes.Metaschema
is itself a subclass ofJSONSchema
, and may be used to validate any referencing schema.- __init__(catalog, value, default_core_vocabulary=None, *default_vocabularies, **kwargs)
Initialize a
Metaschema
instance from the given schema-compatible value.- Parameters:
catalog (Catalog) – catalog instance
value (Mapping[str, JSONCompatible]) – a schema-compatible Python object
default_core_vocabulary (Vocabulary) – the metaschema’s core
Vocabulary
, used in the absence of a"$vocabulary"
keyword in the metaschema JSON file, or if a known core vocabulary is not present under"$vocabulary"
default_vocabulary – default
Vocabulary
instances, used in the absence of a"$vocabulary"
keyword in the metaschema JSON filekwargs (Any) – additional keyword arguments to pass through to the
JSONSchema
constructordefault_vocabularies (Vocabulary) –
- Raises:
JSONSchemaError – if no core vocabulary can be determined
CatalogError – if the created metaschema is not valid
- get_kwclass(key)
Return the
Keyword
class this metaschema uses for the given key. If the key is not recognized, a subclass of an internalKeyword
subclass that treats the keyword as a simple annotation is automatically created, associated with the key, and returned.- Parameters:
key (str) –
- Return type:
Type[Keyword]
- data: bool | Dict[str, JSON]
The schema data.
JSON type
data type
boolean
bool
object
dict[str, JSON]
- key: str | None
The index of the schema within its parent.
- keywords: Dict[str, Keyword]
A dictionary of the schema’s
Keyword
objects, indexed by keyword name.
- type: str
The JSON type of the schema. One of
"boolean"
,"object"
.
- class jschon.vocabulary.ObjectOfSubschemas
A
Keyword
class mixin that sets up property-based subschemas for a keyword.- classmethod jsonify(parentschema, key, value)
- Parameters:
parentschema (JSONSchema) –
key (str) –
value (None | bool | int | float | str | Sequence[Any] | Mapping[str, Any]) –
- Return type:
JSON | None
- class jschon.vocabulary.Subschema
A
Keyword
class mixin that sets up a subschema for a keyword.- classmethod jsonify(parentschema, key, value)
- Parameters:
parentschema (JSONSchema) –
key (str) –
value (None | bool | int | float | str | Sequence[Any] | Mapping[str, Any]) –
- Return type:
JSON | None
- class jschon.vocabulary.SubschemaMixin
- classmethod jsonify(parentschema, key, value)
- Parameters:
parentschema (JSONSchema) –
key (str) –
value (None | bool | int | float | str | Sequence[Any] | Mapping[str, Any]) –
- Return type:
JSON | None