devops-validate
YAML validation and auto-repair engine for DevOps configuration files.
Works offline — no network required. Validates structure via [serde] deserialization,
applies best-practice rules via a built-in rule engine, and repairs common mistakes
automatically through a 6-stage pipeline.
Supported formats
| Format | Detection | Validation | Best-practice rules |
|---|---|---|---|
| Kubernetes (all resource kinds) | ✅ | ✅ | ✅ |
| Docker Compose | ✅ | ✅ | — |
| GitLab CI | ✅ | ✅ | ✅ |
| GitHub Actions | ✅ | ✅ | — |
| Prometheus | ✅ | ✅ | — |
| Alertmanager | ✅ | ✅ | — |
| Helm values.yaml | ✅ | ✅ | — |
| Ansible playbooks | ✅ | ✅ | — |
| OpenAPI 3.x | ✅ | — | — |
Quick start
[]
= "0.1"
Auto-detect and validate
use validate_auto;
let yaml = r#"
apiVersion: apps/v1
kind: Deployment
metadata:
name: my-app
spec:
replicas: 1
selector:
matchLabels:
app: my-app
template:
metadata:
labels:
app: my-app
spec:
containers:
- name: app
image: my-app:latest
"#;
let result = validate_auto;
if !result.valid
for warn in &result.warnings
// Warns: replicas=1, image :latest tag, missing resource limits, missing probes
Detect YAML type
use ;
use YamlType;
let yaml = "apiVersion: apps/v1\nkind: Deployment\nmetadata:\n name: x\nspec:\n selector:\n matchLabels:\n app: x\n template:\n metadata:\n labels:\n app: x\n spec:\n containers: []";
let data = parse_yaml.unwrap;
let yaml_type = detect_yaml_type;
assert_eq!;
Auto-repair
The 6-stage repair pipeline applies deterministic fixes (type coercion, extra-key removal, default injection) and identifies fields that need human or LLM assistance:
use repair_yaml;
use json;
let schema = json!;
let broken = "replicas: \"3\"\nname: my-app";
let result = repair_yaml;
println!;
// "replicas" coerced from string "3" to integer 3
JSON Schema validation
use SchemaRegistry;
let mut registry = new;
let schema = registry.get_schema_sync.unwrap;
Rule engine
use ;
use json;
let engine = load_builtin_rules;
let data = json!;
let diagnostics = engine.evaluate;
assert!;
for diag in &diagnostics
Feature flags
| Feature | Description |
|---|---|
wasm |
Enable WASM-compatible getrandom backend. Required when targeting wasm32-unknown-unknown. |
# WASM targets
[]
= { = "0.1", = ["wasm"] }
Relationship to other crates
- devops-models — The typed models this crate validates against.
- devops-toolkit — Meta-crate that re-exports both.
License
Licensed under either of MIT or Apache-2.0, at your option.