knowledge-base-validation
Loads and validates a complete knowledge-base directory.
use validate_repository;
let diagnostics = validate_repository;
for diagnostic in &diagnostics
The validator checks:
- required directories, file names, YAML syntax, and the data model;
- identifier uniqueness and cross-references;
- property applicability, value types, target types, cardinality, and qualifiers;
- URLs, dates, timestamps, decimals, coordinates, and allocation counters;
- required references on structured data; and
- entity Markdown file names, footnotes, and reference links.
Diagnostics include the path, line when available, validation layer, related identifier, and message. An empty list means the knowledge base is valid.
Domain validators
Domain crates can add read-only rules without adding domain knowledge to this crate. Implement KnowledgeBaseValidator (or pass a closure) and call validate_repository_with:
use ;
use PathBuf;
;
let validator = TransportValidator;
let diagnostics = validate_repository_with;
Each validator receives the repository root and the same immutable structured snapshot. It must report paths relative to that root, because mutations validate a temporary staged copy before committing. Built-in validation runs first; when the snapshot loads, every domain validator then runs in registration order. If it cannot load, domain validators are skipped and the generic schema diagnostics are retained. The combined results are sorted deterministically by path, line, identifier, message, and layer. validate_repository remains the built-in-only convenience function.