github cloudposse/atmos v1.144.0

latest releases: v1.145.0, v1
23 hours ago
Embed JSON Schema for validation of Atmos manifests inside Atmos binary @aknysh (#925)

what

  • Embed the JSON Schema for validation of Atmos manifests inside Atmos binary
  • Update docs

why

  • Embedding the JSON Schema inside the Atmos binary allows keeping the Atmos code and the schema in sync, and does not force users to specify JSON Schema in atmos.yaml and monitor it when it needs to be updated

description

Atmos uses the Atmos Manifest JSON Schema to validate Atmos manifests, and has a default (embedded) JSON Schema.

If you don't configure the path to a JSON Schema in atmos.yaml and don't provide it on the command line using the --schemas-atmos-manifest flag, the default (embedded) JSON Schema will be used when executing the command atmos validate stacks.

To override the default behavior, configure JSON Schema in atmos.yaml:

# Validation schemas (for validating atmos stacks and components)
schemas:
  # JSON Schema to validate Atmos manifests
  atmos:
    # Can also be set using 'ATMOS_SCHEMAS_ATMOS_MANIFEST' ENV var, or '--schemas-atmos-manifest' command-line arguments
    # Supports both absolute and relative paths (relative to the `base_path` setting in `atmos.yaml`)
    manifest: "stacks/schemas/atmos/atmos-manifest/1.0/atmos-manifest.json"
    # Also supports URLs
    # manifest: "https://atmos.tools/schemas/atmos/atmos-manifest/1.0/atmos-manifest.json"
  • Instead of configuring the schemas.atmos.manifest section in atmos.yaml, you can provide the path to
    the Atmos Manifest JSON Schema file by using the ENV variable ATMOS_SCHEMAS_ATMOS_MANIFEST or the --schemas-atmos-manifest command line flag:
ATMOS_SCHEMAS_ATMOS_MANIFEST=stacks/schemas/atmos/atmos-manifest/1.0/atmos-manifest.json atmos validate stacks
atmos validate stacks --schemas-atmos-manifest stacks/schemas/atmos/atmos-manifest/1.0/atmos-manifest.json
atmos validate stacks --schemas-atmos-manifest https://atmos.tools/schemas/atmos/atmos-manifest/1.0/atmos-manifest.json

Summary by CodeRabbit

  • Configuration Updates

    • Enhanced schema configuration flexibility in atmos.yaml
    • Added support for remote and embedded JSON schema locations
  • Documentation Improvements

    • Updated CLI command documentation for stack validation
    • Added new sections explaining validation processes and schema management
    • Clarified usage of URLs for schema manifests in documentation
  • Testing

    • Added new test for JSON schema validation

Don't miss a new atmos release

NewReleases is sending notifications on new releases.