jschon.vocabulary
- class jschon.vocabulary.ArrayOfSubschemas
A
Keywordclass 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
Keywordclasses.Metaschemais 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
Metaschemainstance 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
Vocabularyinstances, used in the absence of a"$vocabulary"keyword in the metaschema JSON filekwargs (Any) – additional keyword arguments to pass through to the
JSONSchemaconstructordefault_vocabularies (Vocabulary) –
- Raises:
JSONSchemaError – if no core vocabulary can be determined
CatalogError – if the created metaschema is not valid
- get_kwclass(key)
Return the
Keywordclass this metaschema uses for the given key. If the key is not recognized, a subclass of an internalKeywordsubclass 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
Keywordobjects, indexed by keyword name.
- type: str
The JSON type of the schema. One of
"boolean","object".
- class jschon.vocabulary.ObjectOfSubschemas
A
Keywordclass 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
Keywordclass 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