Encoder

Encoder(vocabularies: Iterable[Vocabulary])

Writes the values of one document, and records the vocabularies it uses.

Attributes

Name Description
used

Methods

Name Description
__init__
codec The vocabulary and codec for obj’s exact type.
tagged obj as a tagged object: its fields and its @type.
value
optional
array
set A set’s elements, sorted by their canonical text (§9.5).
temporal_system
template A name template, checked against the grammar for this root.

__init__

__init__(vocabularies: Iterable[Vocabulary])

codec

codec(obj: Any)

The vocabulary and codec for obj’s exact type.

Raises

Name Type Description
UnexportableError if no vocabulary defines the type (a subclass of a defined type is not that type).

tagged

tagged(obj: Any, role: Role)

obj as a tagged object: its fields and its @type.

value

value(value: Any)

optional

optional(value: Any)

array

array(values: Iterable[Any])

set

set(values: Iterable[Any])

A set’s elements, sorted by their canonical text (§9.5).

temporal_system

temporal_system(system: TemporalSystem)

template

template(template: str | None, root: Any)

A name template, checked against the grammar for this root.