pub fn validate_spec(spec_dir: &Path) -> Result<ValidationResult, Error>Expand description
Validate a spec against its layer schemas.
Runs two layers of checks over every file reachable from the index(es):
- Structural (hand-rolled) — well-formedness, cross-file ID
uniqueness (XSD
xs:IDonly enforces within a single document; clayers specs are multi-file so this fills that gap), and cross-layer reference resolution (rel:relationfrom/to,art:artifact/@repo). - Schema-driven (XSD 1.1) — required attributes, pattern facets
(e.g. hash format), enumeration restrictions (e.g.
coveragevalues), content-model conformance, and strictxs:any namespace="##other"wildcard resolution. Delegated tocrate::xsd_validation::validate_against_schemas, which uses theuppsalacrate under the hood. Runs only when a schema directory is reachable fromspec_dir.
Both layers contribute to the same flat error list; the caller can
print them directly or test is_valid() to gate a build.
§Errors
Returns an error if spec files cannot be discovered or read, or if the schema-driven validator cannot be constructed.