Skip to main content

JSON Schema Validation

Atmos supports JSON Schema validation, which can validate the schema of configurations such as stacks, workflows, and vendoring manifests. JSON Schema is an industry standard and provides a vocabulary to annotate and validate JSON documents for correctness.

Example

# Validate 'vpc' component using JSON Schema in the 'plat-ue2-prod' stack
atmos validate component vpc -s plat-ue2-prod --schema-path vpc/validate-vpc-component.json --schema-type jsonschema

Configure Component Validation

In atmos.yaml, add the schemas section:

atmos.yaml

# Validation schemas (for validating atmos stacks and components)
schemas:
# https://json-schema.org
jsonschema:
# Can also be set using `ATMOS_SCHEMAS_JSONSCHEMA_BASE_PATH` ENV var, or `--schemas-jsonschema-dir` command-line arguments
# Supports both absolute and relative paths
base_path: "stacks/schemas/jsonschema"

In the component manifest, add the settings.validation section:

examples/quick-start-advanced/stacks/catalog/vpc/defaults.yaml


Add the following JSON Schema in the file stacks/schemas/jsonschema/vpc/validate-vpc-component.json:

examples/quick-start-advanced/stacks/schemas/jsonschema/vpc/validate-vpc-component.json


Try It

Explore a working example that demonstrates JSON Schema validation in action.

Example: Demo Schemas

Validate stack configuration against JSON Schema before running Terraform.

Learn more about Validation.

What You'll See

Try It

cd examples/demo-schemas

# Validate all matched files
atmos validate stacks

# See schema configuration
cat atmos.yaml

Key Files

FilePurpose
atmos.yamlSchema definitions with three source types
manifest.jsonLocal JSON Schema file
config.yamlValidated against local schema
bower.yamlValidated against remote schema
inline.yamlValidated against inline schema