Skip to content
This repository was archived by the owner on Apr 14, 2026. It is now read-only.

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

README.md

Config Validation

Offline config validation against a schema — no server required. Ideal for CI pipelines that gate deployments on config correctness.

What this demonstrates

  • Validating config YAML against a schema YAML (no server needed)
  • Type checking (integer, string, url)
  • Constraint validation (min/max, enum, minLength)
  • Strict mode — rejects fields not defined in the schema
  • Machine-readable violation output for CI integration

Run it

go run .

No server required — this example works completely offline.

Expected output

=== Valid config ===
  PASS: no violations

=== Invalid config ===
  FAIL:
    - app.name: length 0 is less than minLength 1
    - app.port: value 99999 exceeds maximum 65535
    - app.log_level: value "verbose" is not in enum [debug info warn error]
    - app.homepage: invalid absolute URL: "not-a-url"
    - app.unknown_field: unknown field (not in schema)

CI usage

go run . && echo "Config is valid" || echo "Config has errors"

Or use the validate package directly in your own tools:

result, _ := validate.ValidateFiles("schema.yaml", "config.yaml", validate.Strict())
if !result.IsValid() {
    os.Exit(1)
}

Learn more