Skip to main content

Module repair

Module repair 

Source
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

  1. Normalize — trim whitespace, normalize line endings
  2. Parseserde_yamlserde_json::Value
  3. Fill defaults — inject default values from schema
  4. Collect errors — walk schema, find violations
  5. Categorize — split into deterministic vs ambiguous errors
  6. 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_content guided by schema.