Schema submodule

Schema submodule#

JSON schema module.

class majis.schema.JsonSchema(fname: str | Path)[source]

JSON schema object.

property name: str

Schema file name.

property title: str

Schema title description.

validate(content: dict, raises_error: bool = True) None[source]

Validate content against the JSON schema.

If raises_error is set to False, a ValidationWarning can be reported instead of a ValidationError.

property version: int

Schema version.

At the moment this value is extracted from the title property.

exception majis.schema.ValidationError(message: str, validator: str = <unset>, path: Iterable[str | int] = (), cause: Exception | None = None, context=(), validator_value: Any = <unset>, instance: Any = <unset>, schema: Mapping[str, Any] | bool = <unset>, schema_path: Iterable[str | int] = (), parent: _Error | None = None, type_checker: _types.TypeChecker = <unset>)[source]

An instance was invalid under a provided schema.

exception majis.schema.ValidationWarning[source]

Validation warning.