etlplus.ops.validate

etlplus.ops.validate module.

Validate dicts/lists with field rules and documents with external schemas.

This module provides a very small validation primitive that is intentionally runtime-friendly (no heavy schema engines) and pairs with ETLPlus’ JSON-like types. It focuses on clear error messages and predictable behavior.

Highlights

  • Centralized type map and helpers for clarity and reuse.

  • Consistent error wording; field and item paths like [2].email.

  • Small, focused public API with validate_field(), validate(),

    and validate_schema().

Examples

>>> rules = {
...     'name': {'required': True, 'type': 'string', 'minLength': 1},
...     'age': {'type': 'integer', 'min': 0},
... }
>>> data = {'name': 'Ada', 'age': 28}
>>> validate(data, rules)['valid']
True

Functions

validate_field(value, rules)

Validate a single value against field rules.

validate_schema(source, schema, *[, ...])

Validate one source document against one external schema.

validate(source[, rules])

Validate data against rules.

Classes

FieldRulesDict

Validation rules for a single field.

FieldValidationDict

Validation result for a single field.

ValidationDict

Validation result for a complete data structure.