# atmos validate schema

Use this command to validate files against the rules defined in your schema in atmos.yaml.

**Configure Schema Validation**

Learn how to configure custom schema validators for YAML files in your atmos.yaml.

Configuration Reference[Read more](/cli/configuration/schemas)

## Usage

Execute the `validate schema` command like this:

```shell
atmos validate schema
```

This command reads the `schemas` section of `atmos.yaml` and validates every matched
YAML file against its configured JSON Schema.

Out of the box — with no configuration at all — a built-in `config` entry validates
`atmos.yaml` itself, along with `atmos.d` fragments and project-local
[profile](/cli/configuration/profiles) files, against the schema generated from the
Atmos configuration code (the same document [`atmos config schema`](/cli/commands/config/config-schema)
prints). Define your own `schemas.config` entry to override or disable it.

:::tip
Run `atmos validate schema --help` to see all the available options
:::

## Deprecation Warnings

Fields the JSON Schema marks `deprecated: true` produce warnings instead of validation
errors. A deprecated field is still valid input — it never causes `atmos validate schema`
(or its `atmos validate config` / `atmos config validate` aliases) to exit non-zero, only
schema violations do:

```console
atmos.yaml:12:3: warning: `stacks.name_pattern` is deprecated; use `stacks.name_template`
✓ Validated atmos.yaml
```

Where the schema provides migration guidance (an `x-atmos-replacement` hint), the warning
names the field to use instead. This applies to every schema validated through this
command, not just the built-in `config` entry — but only to `deprecated` annotations the
scanner can resolve locally, within the same schema document (including local `$ref`s). A
field marked `deprecated` only inside a separately fetched, externally referenced schema
document validates without a warning.

## Examples

```shell
atmos validate schema           # everything in `schemas`, plus atmos.yaml via the built-in `config` entry
atmos validate schema config    # only atmos.yaml (and its fragments)
atmos config validate           # alias for `atmos validate schema config`
atmos config validate --affected --base origin/main
atmos validate schema <my_custom_key>

# Validate only changed YAML files; configuration or JSON Schema changes
# conservatively revalidate every matching file.
atmos validate schema --affected --base origin/main
atmos validate schema --exclude 'tests/fixtures/**'
```

Use `--affected` to compare against the Git merge-base. On GitHub Actions, the
pull request base SHA is detected automatically; use `--base` locally to select
another baseline.

Use repeatable `--exclude <glob>` to omit repository-relative matches from either full or affected schema validation.

## How to set my schema validators?

You need to use the `schemas` key in atmos config.

```yaml
schemas:
    my_custom_key:
        schema: !import https://www.jsonschema.com/example.json # json to be used for validation
        matches:
            - folder/*.yaml # pattern of the file to be validated
```

## Flags

- **`--schemas-atmos-manifest` (optional)**
  Specifies the path to a JSON schema file used to validate the structure and content of the Atmos manifest file.
