Expand description
Configuration validation and error reporting.
This module provides validation for configuration files with:
- TOML syntax validation
- Type checking (expected vs actual types)
- Unknown key detection with typo suggestions (Levenshtein distance)
- Multi-file error aggregation
- User-friendly error messages
§Architecture
The validation process follows these steps:
- Parse TOML syntax →
ConfigValidationError::TomlSyntaxon failure - Detect unknown/deprecated keys →
ConfigValidationError::UnknownKey+ warnings - Validate types against schema →
ConfigValidationError::InvalidValueon mismatch
§Modules
levenshtein: String distance calculation for typo suggestionskeys: Valid configuration key definitionskey_detection: TOML structure traversal for unknown key detectionerror_formatting: User-friendly error message generation
Enums§
- Config
Validation Error - Configuration validation error.
Functions§
- format_
validation_ errors - Format validation errors for user display.
- suggest_
key - Find the closest valid key name for typo detection.
- validate_
config_ file - Validate a config file and collect errors and warnings.
Type Aliases§
- Validation
Result - Result of config validation.
On success: Ok(warnings) where warnings is a Vec
of deprecation warnings On failure: Err(errors) where errors is a Vec