ocrd_validators.json_validator module

Validating JSON-Schema

exception ocrd_validators.json_validator.JsonSchemaDeprecationWarning(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]

Bases: ValidationError

ocrd_validators.json_validator.extend_with_default(validator_class)[source]

Add a default-setting mechanism to a jsonschema validation class.

class ocrd_validators.json_validator.JsonValidator(schema, validator_class=<class 'jsonschema.validators.Draft201909Validator'>)[source]

Bases: object

JSON Schema validator.

Construct a JsonValidator.

Parameters:
  • schema (dict)

  • validator_class (Draft20199Validator|DefaultValidatingDraft20199Validator)

static validate(obj, schema)[source]

Validate an object against a schema

Parameters:
  • obj (dict)

  • schema (dict)