Skip to content

momoa.engines.statham

source module momoa.engines.statham

Statham-based engine: wraps the existing JSON Schema Draft 6 implementation.

Classes

  • StathamModel Base model class for StathamEngine output.

  • StathamEngine Compiles JSON Schema (Draft 6) into StathamModel subclasses via statham.

source class StathamModel(**data)

Base model class for StathamEngine output.

Methods

  • serialize Validates data and serializes it into JSON-ready format.

  • make_model Constructs a StathamModel subclass based on the class derived from JSONSchema.

source method StathamModel.serialize()dict[str, Any]

Validates data and serializes it into JSON-ready format.

source staticmethod StathamModel.make_model(schema_class: meta.ObjectMeta, string_formatter=StringFormat)type[StathamModel]

Constructs a StathamModel subclass based on the class derived from JSONSchema.

source class StathamEngine(model_factory: ModelFactory = StathamModel.make_model)

Compiles JSON Schema (Draft 6) into StathamModel subclasses via statham.

Attributes

  • output_format : str Engine identifier.

Methods

  • context_labeller Returns statham's title_labeller for naming anonymous nested schemas.

  • compile Compile a JSON Schema spec into StathamModel subclasses.

source property StathamEngine.output_format: str

Engine identifier.

source method StathamEngine.context_labeller()Callable[[str], tuple[str, Any]]

Returns statham's title_labeller for naming anonymous nested schemas.

source method StathamEngine.compile(spec: dict[str, Any], *, root_name: str | None = None)EngineResult

Compile a JSON Schema spec into StathamModel subclasses.

Raises