text_lint.schema.Schema

class text_lint.schema.Schema(schema_path: str, interpolate: bool)[source]

Bases: object

A text file schema file.

__init__(schema_path: str, interpolate: bool) None[source]

Initialize Schema instances.

Parameters:
  • schema_path (str) – The path to file containing the schema YAML.

  • interpolate (bool) – Controls rendering of environment variables.

create_exception(description: str, operation_definition: AliasYamlOperation | None = None) SchemaError[source]

Create a properly formatted schema error exception.

Parameters:
  • description (str) – A description of the schema error encountered.

  • operation_definition (AliasYamlOperation | None) – Any YAML config associated with the error.

Returns:

The exception instance.

Return type:

SchemaError

load_assertions() List[AssertionBase][source]

Create assertion operations from the schema’s YAML content.

Returns:

A list of assertion operation instances.

Return type:

List[AssertionBase]

load_validators() List[ValidatorBase][source]

Create validator operations from the schema’s YAML content.

Returns:

A list of validator operation instances.

Return type:

List[ValidatorBase]