Skip to main content

Module validate

Module validate 

Source
Expand description

Document schema validation

§Architecture

Validation is built on DocumentParser composition:

  • SchemaValidator: Dispatches to type-specific validators based on SchemaNodeContent
  • Type validators: Implement DocumentParser<Output = (), Error = ValidatorError>
  • ValidationContext: Manages shared state (errors, warnings, path)

§Error Handling

Two categories of errors:

  • ValidationError: Type mismatches accumulated in ValidationContext (non-fatal)
  • ValidatorError: Internal validator errors causing fail-fast (e.g., undefined references)

§Hole Values

The hole value (!) represents an unfilled placeholder:

  • Type checking: Holes match any schema (always pass)
  • Completeness: Documents containing holes are valid but not complete

Structs§

SchemaValidator
Main validator that dispatches to type-specific validators.
ValidationContext
Validation context combining schema reference and mutable state.
ValidationOutput
Final validation output returned to callers.
ValidationState
Internal mutable state during validation.
ValidationTraceOutput
Validation output with node-level schema trace mapping.

Enums§

ValidationError
Type errors accumulated during validation.
ValidationWarning
Warnings generated during validation.
ValidatorError
Internal validator errors that cause immediate failure.

Functions§

resolve_node_type_traces
validate
Validate a document against a schema.
validate_node
Validate a specific node against a schema node.
validate_with_trace
Validate with node-level schema trace mapping.