schematools.validation module

Semantic JSON schema validation.

This package provides a simple Validator class that allows us to perform semantic validation on a given JSON schema.

Semantic validation is different from structural validation, as performed by the jsonschema, in that it takes into account the implied logic behind a JSON schema. For instance, we might indicate that what identifies a table is a set of properties (columns). In Amsterdam Schema this is done using the identifier property that can take an array of property names. Structural validation cannot verify that the properties specified in that array actually do exist in the schema. Semantic validation can and should.

Semantic validations are created decorating a function with _validator.

class schematools.validation.ValidationError(validator_name: str, message: str)

Bases: object

Capture validation errors.

__init__(validator_name: str, message: str) None
message: str
validator_name: str
schematools.validation.run(dataset: DatasetSchema, location: str | None = None) Iterator[ValidationError]

Run all registered validators.

Yields

ValidationErrors, if any.