Expand description
Document schema validation
§Architecture
Validation is built on DocumentParser composition:
SchemaValidator: Dispatches to type-specific validators based onSchemaNodeContent- Type validators: Implement
DocumentParser<Output = (), Error = ValidatorError> ValidationContext: Manages shared state (errors, warnings, path)
§Error Handling
Two categories of errors:
ValidationError: Type mismatches accumulated inValidationContext(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§
- Schema
Validator - Main validator that dispatches to type-specific validators.
- Validation
Context - Validation context combining schema reference and mutable state.
- Validation
Output - Final validation output returned to callers.
- Validation
State - Internal mutable state during validation.
Enums§
- Union
TagMode - Mode for union tag resolution.
- Validation
Error - Type errors accumulated during validation.
- Validation
Warning - Warnings generated during validation.
- Validator
Error - Internal validator errors that cause immediate failure.
Functions§
- validate
- Validate a document against a schema.
- validate_
node - Validate a specific node against a schema node.
- validate_
node_ with_ mode - Validate a specific node against a schema node with the specified union tag mode.
- validate_
with_ mode - Validate a document against a schema with the specified union tag mode.