Decoder

Decoder(vocabularies: Iterable[Vocabulary], declared: Any)

Reads the values of one document, resolving its prefixes.

Attributes

Name Description
prefixes
codecs

Methods

Name Description
__init__ declared is the document’s vocabularies object, unchecked.
resolve The vocabulary and local name of a qualified name (§7.1).
tagged The object a tagged object stands for, checked against the role and kind
value
optional
array
set A set’s elements; two equal elements are refused (§4.7).
temporal_system
template A name template (or null), checked against the grammar for this root.

__init__

__init__(vocabularies: Iterable[Vocabulary], declared: Any)

declared is the document’s vocabularies object, unchecked.

Raises

Name Type Description
OmkJsonError if it is malformed, lacks omk, repeats a URI, or requires a vocabulary that was not given or a version that is not accepted; every missing vocabulary is named.

resolve

resolve(name: Any)

The vocabulary and local name of a qualified name (§7.1).

Raises

Name Type Description
OmkJsonError if name is not a string, or its prefix is not declared.

tagged

tagged(data: Any, role: Role, kind: str | None = None)

The object a tagged object stands for, checked against the role and kind (kind None accepts any type of the role).

Raises

Name Type Description
OmkJsonError if data is not a tagged object of a type of that role and kind, if its keys are not exactly the type’s fields, or if its fields are outside the type’s domain.

value

value(data: Any, kind: str)

optional

optional(data: Any, kind: str)

array

array(data: Any, kind: str)

set

set(data: Any, kind: str)

A set’s elements; two equal elements are refused (§4.7).

temporal_system

temporal_system(data: Any)

template

template(data: Any, root: Any)

A name template (or null), checked against the grammar for this root.