Skip to main content

validate_with_policy

Function validate_with_policy 

Source
pub fn validate_with_policy(
    doc: &Document,
    policy: &DiagnosticPolicy,
    brand: &BrandContract,
) -> ValidationReport
Expand description

Run the full document validation pass, applying an externally supplied policy and brand contract at their respective choke points.

The caller is responsible for assembling policy (e.g. merging config-file and CLI-flag policy with the document’s in-file policy) and brand (e.g. merging global/local config brand contracts with the document’s in-file brand { … } block). Passing &doc.diagnostic_policy and &doc.brand_contract reproduces validate exactly.

Internally runs resolve_tokens on doc.tokens, merges those diagnostics, then walks the full document collecting all semantic diagnostics. Never hard-fails; all findings are returned in the ValidationReport.