Expand description
6-stage YAML auto-repair pipeline.
Given a YAML string and a JSON Schema, applies deterministic fixes and identifies fields that need human or LLM assistance.
§Stages
- Normalize — trim whitespace, normalize line endings
- Parse —
serde_yaml→serde_json::Value - Fill defaults — inject
defaultvalues from schema - Collect errors — walk schema, find violations
- Categorize — split into deterministic vs ambiguous errors
- Fix — type coercion, extra-key removal; ambiguous →
llm_fields
§Example
use devops_validate::repair::repair_yaml;
use serde_json::json;
let schema = json!({
"properties": { "replicas": { "type": "integer", "default": 1 } }
});
let result = repair_yaml("replicas: \"3\"", &schema);
assert!(result.valid);Functions§
- repair_
yaml - Apply the 6-stage YAML repair pipeline to
yaml_contentguided byschema.