Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

wcl validate

Parse and validate a WCL document through all pipeline phases.

Usage

wcl validate <file> [options]

Options

FlagDescription
--strictTreat warnings as errors
--schema <file>Load an additional external schema file
--var KEY=VALUESet an external variable (may be repeated)

Description

wcl validate runs the document through the full 11-phase pipeline:

  1. Parse
  2. Macro collection
  3. Import resolution
  4. Macro expansion
  5. Control flow expansion
  6. Partial merge
  7. Scope construction and evaluation
  8. Decorator validation
  9. Schema validation
  10. ID uniqueness
  11. Document validation

All diagnostics (errors and warnings) are printed to stderr. If any errors are produced, the command exits with a non-zero status code.

Exit Codes

CodeMeaning
0Document is valid
1One or more errors (or warnings with --strict)
2Argument error

Examples

Validate a file:

wcl validate config.wcl

Validate strictly (warnings are errors):

wcl validate --strict config.wcl

Validate against an external schema:

wcl validate --schema schemas/service.wcl config.wcl

Validate with external variables:

wcl validate --var PORT=8080 config.wcl

Diagnostic Output

error[E070]: missing required field `port`
  --> config.wcl:12:3
   |
12 |   service svc-api {
   |   ^^^^^^^^^^^^^^^ missing field `port`
   |
   = required by schema `ServiceSchema`