ocrd_validators.json_validator module

Validating JSON-Schema

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.Draft6Validator'>)[source]

Bases: object

JSON Schema validator.

Construct a JsonValidator.

Parameters:
  • schema (dict)

  • validator_class (Draft6Validator|DefaultValidatingDraft6Validator)

static validate(obj, schema)[source]

Validate an object against a schema

Parameters:
  • obj (dict)

  • schema (dict)