validation-engine
Defines the ValidationEngine trait and orchestrates the full validation pipeline: schema validation → engine rule
evaluation → Step Functions and Metadata Context validation → diagnostic enrichment → filtering → report assembly. The
pipeline is engine-agnostic: any engine (rego-engine,
cel-engine, composite-engine) implements the trait and
plugs into this pipeline.
See API.md for usage examples and public API reference.
How It Works
bytes ──▶ SemanticModel ──▶ validate()
│
├── SchemaValidator (Fatal + schema-derived Error/Warn/Info)
├── engine.evaluate_rules() (built-in + custom rules)
├── step_functions::validate_all_state_machines()
├── context_check::check_context()
└── model diagnostics
│
▼
merge + enrich + filter + report
│
▼
ValidationReport
ValidationEngine Trait
Engines implement evaluate_rules to run their rule evaluation logic against
the SemanticModel. The orchestration pipeline handles everything else.
Pipeline
- Schema validation - Fatal structural diagnostics plus schema-derived Error/Warn/Info findings.
- Engine rule evaluation - Built-in and custom rule diagnostics.
- Step Functions validation - Validates
AWS::StepFunctions::StateMachinedefinitions (ruleE3601): StartAt references, state types, required fields, JSONata mode restrictions, recursive into Parallel/Map. - Metadata Context validation - Validates
com.aws.cloudformation.Contextblocks and reports missing context. - Model diagnostics - Parse-time diagnostics (duplicate keys, cycles, structure errors).
- Enrichment - Backfills locations and entities at every detail level. At
Detailed, also adds phase, rule description, resolved property values, and schema constraints as context. - Finalization - Applies strict mode (Warn→Error), include/exclude filters, and severity gating; then sorts by severity, rule number/ID, and source location before deduplicating.
- Report assembly - Severity counts, metadata, per-phase performance metrics.
Parse error handling: When validate_bytes_with_path encounters a parse failure, it creates a synthetic F1101
diagnostic and returns a ValidationReport with status=Error rather than returning Err.