Skip to content

Add config/global/1.0 schema for root atmos.yaml file - #2731

Closed
rennokki (rennokki) wants to merge 2 commits into
cloudposse:mainfrom
rennokki:feature/atmos-schemas-2
Closed

rennokki (rennokki) wants to merge 2 commits into
cloudposse:mainfrom
rennokki:feature/atmos-schemas-2

Conversation

@rennokki

@rennokki rennokki (rennokki) commented Jul 11, 2026 •

Copy link
Copy Markdown

what

Added schema for the root atmos.yaml file.

why

While the current schemas do help for non-atmos.yaml file suggestions in the IDE (for example, stacks/**/*.yaml), the root configuration never had a direct JSON schema. Most of the changes done had to be manually checked and "guessed" sometimes, having no way to see what other features exist or how they are called while writing the root configuration for atmos.

references

closes #2351

Summary by CodeRabbit

  • New Features
    • Added validation for root atmos.yaml / atmos.yml using the Atmos config JSON schema.
    • Introduced schema “ratchet” coverage to keep user-facing config fields supported.
  • Bug Fixes
    • Improved default schema URL and default matches behavior for root config validation.
  • Documentation
    • Expanded CLI schema docs and examples, including atmos validate schema config and editor $schema guidance.
  • Tests
    • Added tests for config schema defaults, validation, and schema metadata parity between embedded and website schema copies.

@rennokki
rennokki (rennokki) requested a review from a team as a code owner July 11, 2026 21:03
Copilot AI review requested due to automatic review settings July 11, 2026 21:03
@atmos-pro

atmos-pro Bot commented Jul 11, 2026 •

Copy link
Copy Markdown
Contributor

Tip

Atmos Pro  

No affected stacks workflow was detected for this pull request.
If this is expected, no action is needed.
Learn More. Ask AI.

@mergify

mergify Bot commented Jul 11, 2026

Copy link
Copy Markdown
Contributor

Warning

This PR exceeds the recommended limit of 10,000 lines.

Large PRs are difficult to review and may be rejected due to their size.

Please verify that this PR does not address multiple issues.
Consider refactoring it into smaller, more focused PRs to facilitate a smoother review process.

@coderabbitai

coderabbitai Bot commented Jul 11, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Adds public and embedded JSON Schemas for root atmos.yaml, connects config schema defaults to validation, adds schema coverage and validation tests, and documents CLI and editor usage.

Changes

Atmos Config Schema

Layer / File(s) Summary
Atmos config schema definitions
pkg/datafetcher/schema/config/..., website/static/schemas/atmos/atmos-config/...
Adds comprehensive embedded and public schemas for Atmos CLI configuration, including strict top-level properties and reusable workflow, command, integration, authentication, tooling, and platform definitions.
Runtime schema registration and validation
pkg/config/default.go, internal/exec/..., pkg/datafetcher/fetch_schema_test.go, pkg/datafetcher/schema_condition_validation_test.go, pkg/validator/schema_validator_test.go
Registers the config schema for atmos.yaml and atmos.yml, applies default schema selection, validates retrieval and YAML validation, and separates config coverage from manifest condition tests.
Schema coverage enforcement
pkg/datafetcher/atmos_config_schema_coverage_test.go
Extracts configuration keys from AtmosConfiguration and verifies coverage and metadata in both embedded and website schemas.
Schema documentation and editor guidance
agent-skills/skills/atmos-schemas/..., website/docs/cli/configuration/schemas.mdx, website/docs/validation/json-schema.mdx
Documents schema locations, configuration, atmos validate schema config, root config validation, and YAML-language-server integration.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Developer
  participant AtmosCLI
  participant SchemaRegistry
  participant SchemaFetcher
  participant YAMLValidator

  Developer->>AtmosCLI: run atmos validate schema config
  AtmosCLI->>SchemaRegistry: resolve config schema and filename matches
  SchemaRegistry->>SchemaFetcher: fetch atmos://schema/config/global/1.0
  SchemaFetcher-->>YAMLValidator: provide embedded schema
  YAMLValidator-->>AtmosCLI: return validation results
  YAMLValidator-->>Developer: report valid or invalid atmos.yaml
Loading

Possibly related PRs

Suggested labels: minor

Suggested reviewers: osterman

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: adding a schema for the root atmos.yaml config file.
Linked Issues check ✅ Passed The PR delivers a dedicated schema and editor support for atmos.yaml, matching issue #2351's requested behavior.
Out of Scope Changes check ✅ Passed The added docs, tests, and schema coverage all support the new root config schema and do not appear unrelated.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: cdfb949905

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "Codex (@codex) review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "Codex (@codex) address that feedback".

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a first-class JSON Schema for the root atmos.yaml / atmos.yml config and wires it into Atmos validation + documentation, so editors and CLI validation can target the root config directly.

Changes:

  • Added a published website schema for root Atmos CLI config (website/static/.../atmos-config.json) and referenced it in docs for IDE integration.
  • Added default schema registry entry + executor logic to validate root config via atmos validate schema config.
  • Added tests to fetch/validate the new schema and a “coverage ratchet” test to ensure AtmosConfiguration top-level YAML keys remain represented in the config schema.

Reviewed changes

Copilot reviewed 11 out of 13 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
website/static/schemas/atmos/atmos-config/1.0/atmos-config.json New published JSON Schema for root atmos.yaml/atmos.yml editor validation.
website/docs/validation/json-schema.mdx Docs: adds root config schema validation and IDE $schema directive snippet.
website/docs/cli/configuration/schemas.mdx Docs: expands schemas configuration to cover root config schema + usage.
pkg/validator/schema_validator_test.go Tests: validates embedded config schema against valid/invalid fixtures.
pkg/datafetcher/schema_condition_validation_test.go Tests: simplifies schema sets used in condition validation tests.
pkg/datafetcher/fetch_schema_test.go Tests: ensures the new atmos://schema/config/global/1.0 fetch key works.
pkg/datafetcher/atmos_config_schema_coverage_test.go New test ratchet to ensure AtmosConfiguration YAML keys are covered by config schemas.
pkg/config/default.go Adds default schemas.config registry entry for root config validation.
internal/exec/validate_schema.go Adds default schema selection for config and expands match-defaulting logic.
internal/exec/validate_schema_test.go Tests: verifies config default schema selection behavior.
agent-skills/skills/atmos-schemas/SKILL.md Internal skill docs updated to include the new atmos-config schema layer.
agent-skills/skills/atmos-schemas/references/schema-structure.md Reference docs updated to document atmos-config schema structure and locations.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread internal/exec/validate_schema.go Resolved
Comment thread pkg/config/default.go Resolved
Comment thread internal/exec/validate_schema_test.go Resolved
Comment thread pkg/validator/schema_validator_test.go Resolved

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (3)
agent-skills/skills/atmos-schemas/SKILL.md (2)

439-456: 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

"Four manifest schema files" incorrectly includes the global config schema.

Line 439 states "The four manifest schema files" but the bullet list at line 454 includes the "Global config schema," which is not a manifest schema. This is misleading.

📝 Suggested fix
-The four manifest schema files are mostly identical but have some differences:
+The schema files have some differences:
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@agent-skills/skills/atmos-schemas/SKILL.md` around lines 439 - 456, Update
the introductory description to distinguish the three manifest schema files from
the Global config schema; identify the manifest comparison as covering only the
Website, Stack-config, and Atmos manifest schemas, while describing the Global
config schema separately as the root atmos.yaml configuration schema.

136-140: 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Configuration precedence section only covers manifest schema.

With the new schemas.config.schema option, the precedence for the config schema should also be documented here for completeness.

📝 Suggested addition
 4. Default embedded schema (compiled into the binary)
+
+For `schemas.config.schema`:
+1. `--schemas-config-schema` CLI flag (if supported)
+2. `ATMOS_SCHEMAS_CONFIG_SCHEMA` environment variable (if supported)
+3. `schemas.config.schema` in `atmos.yaml`
+4. Default embedded schema `atmos://schema/config/global/1.0`
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@agent-skills/skills/atmos-schemas/SKILL.md` around lines 136 - 140, Expand
the “Configuration precedence” section in SKILL.md to document the equivalent
precedence for the config schema configured by `schemas.config.schema`, covering
its CLI flag, environment variable, atmos.yaml value, and embedded default. Keep
the existing manifest-schema precedence unchanged and clearly distinguish the
two schema options.
website/docs/cli/configuration/schemas.mdx (1)

194-198: 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Add atmos validate schema to Related Commands.

The page now documents atmos validate schema config (line 138), but the Related Commands card list doesn't include atmos validate schema. Adding it would help users discover the command.

📝 Suggested addition
 <DocCardList items={[
   {type: 'link', href: '/cli/commands/validate/usage', label: 'atmos validate', description: 'Validate Atmos stacks and components'},
   {type: 'link', href: '/cli/commands/validate/stacks', label: 'atmos validate stacks', description: 'Validate stack manifests against JSON Schema'},
+  {type: 'link', href: '/cli/commands/validate/schema', label: 'atmos validate schema', description: 'Validate files against custom schema validators'},
   {type: 'link', href: '/cli/commands/validate/component', label: 'atmos validate component', description: 'Validate components with OPA policies'},
 ]} />
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@website/docs/cli/configuration/schemas.mdx` around lines 194 - 198, Add an
`atmos validate schema` entry to the `DocCardList` items in the Related Commands
section, with a link to the schema command documentation and a description
matching the documented schema validation behavior. Preserve the existing
validate command entries.
🧹 Nitpick comments (2)
pkg/datafetcher/schema/config/global/1.0.json (1)

1-4543: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Duplicated schema content across two files (mirrors website/static copy).

This file and website/static/schemas/atmos/atmos-config/1.0/atmos-config.json are byte-identical. The coverage test presumably guards drift, but consider generating one from the other (or from a single source) to avoid two ~4500-line JSON files needing manual sync on every future change.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pkg/datafetcher/schema/config/global/1.0.json` around lines 1 - 4543,
Eliminate the duplicated Atmos configuration schema maintenance between the root
schema and the website static copy. Establish one canonical schema source and
generate or otherwise derive the other copy from it, updating the relevant
schema-generation or synchronization workflow while preserving both consumers’
existing paths and byte-equivalent content.
pkg/datafetcher/atmos_config_schema_coverage_test.go (1)

144-161: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Consider using reflect.StructTag.Get for robust yaml tag parsing.

The manual structFieldYAMLKey function splits the raw tag string by spaces and searches for the yaml: prefix. This works for all current AtmosConfiguration fields, but reflect.StructTag(strings.Trim(field.Tag.Value, "")).Get("yaml")` handles the standard tag format more robustly (e.g., tag values containing spaces) and is the idiomatic Go approach.

♻️ Optional refactor using reflect.StructTag
 import (
 	"encoding/json"
 	"go/ast"
 	"go/parser"
 	"go/token"
+	"reflect"
 	"os"
 	"path/filepath"
 	"strings"
 	"testing"
 
 	"github.com/stretchr/testify/require"
 )

 func structFieldYAMLKey(field *ast.Field) string {
 	if field.Tag == nil {
 		return ""
 	}
-	tag := strings.Trim(field.Tag.Value, "`")
-	for _, part := range strings.Split(tag, " ") {
-		if !strings.HasPrefix(part, "yaml:") {
-			continue
-		}
-		value := strings.TrimPrefix(part, "yaml:")
-		value = strings.Trim(value, `"`)
-		if idx := strings.Index(value, ","); idx >= 0 {
-			value = value[:idx]
-		}
-		return value
-	}
-	return ""
+	tag := reflect.StructTag(strings.Trim(field.Tag.Value, "`"))
+	yamlTag := tag.Get("yaml")
+	if idx := strings.Index(yamlTag, ","); idx >= 0 {
+		return yamlTag[:idx]
+	}
+	return yamlTag
 }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pkg/datafetcher/atmos_config_schema_coverage_test.go` around lines 144 - 161,
Update structFieldYAMLKey to parse the field tag through
reflect.StructTag.Get("yaml") instead of manually splitting and trimming the raw
tag string. Preserve the existing behavior of returning only the YAML key before
any comma options, and return an empty string when no YAML tag exists.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@internal/exec/validate_schema.go`:
- Around line 126-131: The fallback matches in the schema validation logic are
missing supported dotfile config names. Update the sourceKey handling in the
validation function to include .atmos.yaml and .atmos.yml alongside the existing
names, and synchronize the corresponding default registry in
pkg/config/default.go so both lists contain all four supported config files.

In `@pkg/datafetcher/schema/config/global/1.0.json`:
- Around line 1341-1414: Loosen the schemas for command, command_argument, and
command_flag by removing fields from their required lists that are optional in
documented minimal custom-command definitions. Preserve property types, enums,
and additionalProperties constraints, while ensuring valid minimal atmos.yaml
custom-command forms pass validation.

In `@pkg/validator/schema_validator_test.go`:
- Line 225: Rename the variable assigned from the invalid-config fixture in the
test from validConfig to invalidConfig, and update its subsequent use when
writing to invalidPath so the test consistently reflects the fixture’s invalid
content.

---

Outside diff comments:
In `@agent-skills/skills/atmos-schemas/SKILL.md`:
- Around line 439-456: Update the introductory description to distinguish the
three manifest schema files from the Global config schema; identify the manifest
comparison as covering only the Website, Stack-config, and Atmos manifest
schemas, while describing the Global config schema separately as the root
atmos.yaml configuration schema.
- Around line 136-140: Expand the “Configuration precedence” section in SKILL.md
to document the equivalent precedence for the config schema configured by
`schemas.config.schema`, covering its CLI flag, environment variable, atmos.yaml
value, and embedded default. Keep the existing manifest-schema precedence
unchanged and clearly distinguish the two schema options.

In `@website/docs/cli/configuration/schemas.mdx`:
- Around line 194-198: Add an `atmos validate schema` entry to the `DocCardList`
items in the Related Commands section, with a link to the schema command
documentation and a description matching the documented schema validation
behavior. Preserve the existing validate command entries.

---

Nitpick comments:
In `@pkg/datafetcher/atmos_config_schema_coverage_test.go`:
- Around line 144-161: Update structFieldYAMLKey to parse the field tag through
reflect.StructTag.Get("yaml") instead of manually splitting and trimming the raw
tag string. Preserve the existing behavior of returning only the YAML key before
any comma options, and return an empty string when no YAML tag exists.

In `@pkg/datafetcher/schema/config/global/1.0.json`:
- Around line 1-4543: Eliminate the duplicated Atmos configuration schema
maintenance between the root schema and the website static copy. Establish one
canonical schema source and generate or otherwise derive the other copy from it,
updating the relevant schema-generation or synchronization workflow while
preserving both consumers’ existing paths and byte-equivalent content.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 2811aaea-362e-44c5-82ca-ab191c20b435

📥 Commits

Reviewing files that changed from the base of the PR and between 28c1489 and 7d4930b.

📒 Files selected for processing (13)
  • agent-skills/skills/atmos-schemas/SKILL.md
  • agent-skills/skills/atmos-schemas/references/schema-structure.md
  • internal/exec/validate_schema.go
  • internal/exec/validate_schema_test.go
  • pkg/config/default.go
  • pkg/datafetcher/atmos_config_schema_coverage_test.go
  • pkg/datafetcher/fetch_schema_test.go
  • pkg/datafetcher/schema/config/global/1.0.json
  • pkg/datafetcher/schema_condition_validation_test.go
  • pkg/validator/schema_validator_test.go
  • website/docs/cli/configuration/schemas.mdx
  • website/docs/validation/json-schema.mdx
  • website/static/schemas/atmos/atmos-config/1.0/atmos-config.json

Comment thread internal/exec/validate_schema.go Resolved
Comment on lines -1341 to 1414
{
"type": "string",
"pattern": "^!include"
"description": {
"type": "string"
},
{
"required": {
"type": "boolean"
},
"default": {
"type": "string"
},
"type": {
"type": "string",
"enum": [
"local",
"s3",
"remote",
"vault",
"static",
"azurerm",
"gcs",
"cloud"
"component",
"stack",
""
]
}
},
"required": [
"name",
"description",
"required",
"default"
]
},
"backend": {
"title": "backend",
"description": "Backend section",
"$ref": "#/definitions/backend_manifest"
},
"remote_state_backend_type": {
"title": "remote_state_backend_type",
"description": "Remote state backend type",
"oneOf": [
{
"type": "string",
"pattern": "^!include"
"command_flag": {
"type": "object",
"additionalProperties": false,
"properties": {
"name": {
"type": "string"
},
{
"shorthand": {
"type": "string"
},
"type": {
"type": "string"
},
"description": {
"type": "string"
},
"usage": {
"type": "string"
},
"required": {
"type": "boolean"
},
"default": {},
"semantic_type": {
"type": "string",
"enum": [
"local",
"s3",
"remote",
"vault",
"static",
"azurerm",
"gcs",
"cloud"
"component",
"stack",
""
]
}
},
"required": [
"name",
"shorthand",
"type",
"description",
"usage",
"required",
"default"
]
},

@coderabbitai coderabbitai Bot Jul 11, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Inspect the relevant schema ranges.
file="pkg/datafetcher/schema/config/global/1.0.json"
wc -l "$file"
sed -n '1330,1435p' "$file"
printf '\n----\n'
sed -n '1490,1595p' "$file"
printf '\n----\n'

# Search for documented examples of custom commands / arguments / flags.
rg -n -C 3 '"name": "terraform"|arguments:|flags:|command_argument|command_flag|custom command|commands:' . -g '!**/node_modules/**' -g '!**/dist/**' -g '!**/build/**'

Repository: cloudposse/atmos

Length of output: 50375


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Narrow search to docs and schema references.
rg -n -C 4 'name:\s*(terraform|component|stack)|arguments:|flags:|custom command|command_argument|command_flag|component_config|verbose' \
  . \
  -g '!**/node_modules/**' -g '!**/dist/**' -g '!**/build/**' -g '!**/*.min.*'

Repository: cloudposse/atmos

Length of output: 50373


🏁 Script executed:

#!/bin/bash
set -euo pipefail

file="pkg/datafetcher/schema/config/global/1.0.json"

echo "== schema lines =="
sed -n '1340,1425p' "$file"
echo
sed -n '1555,1585p' "$file"
echo

echo "== candidate docs/examples =="
rg -n -C 3 'name:\s*(terraform|component|stack)|arguments:|flags:|required:\s*false|command_argument|command_flag|custom command' \
  . \
  -g '!**/node_modules/**' -g '!**/dist/**' -g '!**/build/**' -g '!**/*.min.*' | head -n 200

Repository: cloudposse/atmos

Length of output: 18672


Loosen the custom-command schema — command, command_argument, and command_flag are over-constrained here. The documented minimal custom-command forms omit many of these fields, so the current required lists make common atmos.yaml files fail schema validation.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pkg/datafetcher/schema/config/global/1.0.json` around lines 1341 - 1414,
Loosen the schemas for command, command_argument, and command_flag by removing
fields from their required lists that are optional in documented minimal
custom-command definitions. Preserve property types, enums, and
additionalProperties constraints, while ensuring valid minimal atmos.yaml
custom-command forms pass validation.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should address this using a oneOf rule that is specific, with a fallback to any original behaviour?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rennokki, good instinct to want stronger validation than just wide-open, but oneOf won't work cleanly here.

The problem: command, command_argument, command_flag are always plain objects — there's no structural variant to switch on (unlike task_step, which already uses oneOf for string-vs-object). If we made a "strict" branch (all fields required) and a "loose" branch (nothing required) with the same properties/additionalProperties: false, any document satisfying the strict branch also satisfies the loose one. oneOf requires exactly one match, so that would actually break valid full documents too.

anyOf avoids that ambiguity, but a genuinely permissive fallback (additionalProperties: true) defeats the purpose of catching typos, which is why additionalProperties: false is there in the first place.

Simplest fix: just drop the over-broad required arrays on all three and keep additionalProperties: false for typo protection. If you still want some enforcement, anyOf with meaningful discriminators works better than a generic fallback, e.g. for command:

"command": {
  "type": "object",
  "additionalProperties": false,
  "properties": { "...": "unchanged" },
  "anyOf": [
    { "required": ["steps"] },
    { "required": ["commands"] },
    { "required": ["component"] },
    { "required": ["component_config"] }
  ]
}

That enforces "a command must actually do something" without blocking minimal, valid configs. Want me to apply this to command, command_argument, and command_flag?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Skipping a strict oneOf for command / command_argument / command_flag for now. As noted in the thread, these are always plain objects with no structural variant to discriminate on, so a strict+loose oneOf would always satisfy the loose branch. The current optional-field design is intentional for real-world configs (e.g. quick-start-advanced). Map-form env vars remain on command.env; structured array entries use command_env with key + value or valueCommand.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rennokki, understood — makes sense. Plain-object schemas without a structural discriminator would make oneOf unreliable, so keeping required loose with additionalProperties: false for typo protection is the pragmatic choice here. Thanks for confirming the command.env vs command_env split too.


✏️ Learnings added
Learnt from: rennokki
Repo: cloudposse/atmos PR: 2731
File: pkg/datafetcher/schema/config/global/1.0.json:1341-1414
Timestamp: 2026-07-15T07:46:02.097Z
Learning: In `pkg/datafetcher/schema/config/global/1.0.json`, the `command`, `command_argument`, and `command_flag` schema definitions are intentionally kept as plain objects with loose/optional `required` fields (not a strict `oneOf`), because these definitions have no structural variant to discriminate on — a strict+loose `oneOf` split would always satisfy the loose branch, making it ineffective. `additionalProperties: false` is retained for typo protection. Map-form environment variables use `command.env` (object), while structured array entries use the `command_env` definition (object with `key` + `value`/`valueCommand`).

Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.

Comment thread pkg/validator/schema_validator_test.go Resolved
@rennokki

Copy link
Copy Markdown
Author

Do you guys merge or rebase when keeping the branches up-to-date?

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 6

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@agent-skills/skills/atmos-schemas/SKILL.md`:
- Around line 454-456: Update the documentation entry for the global config
schema to describe the correct total as “four schema files,” or explicitly
distinguish the three manifest schemas from this non-manifest root configuration
schema; preserve the existing paths and coverage-test reference.
- Around line 128-133: Update the Configuration precedence documentation in
SKILL.md to explicitly describe precedence for schemas.config.schema, including
CLI flags, environment variables, and defaults; alternatively, narrow the
section heading and wording to apply only to schemas.atmos.manifest so the
config schema is not implied to be covered.
- Around line 240-244: Update the schema guidance table or surrounding
instructions to distinguish manifest changes from root atmos.yaml configuration
changes. For manifest-related updates, prioritize the public atmos-manifest and
embedded stack-config schemas; for global configuration changes, prioritize the
public atmos-config and embedded config/global schemas. Keep the existing schema
references and ensure each branch identifies the appropriate primary files.

In `@pkg/config/default.go`:
- Around line 108-114: Update the config SchemaRegistry entry in the default
configuration so its Matches list includes the schema-advertised .atmos.yaml and
.atmos.yml filenames, keeping runtime matching aligned with the schema.

In `@pkg/datafetcher/schema/config/global/1.0.json`:
- Around line 140-150: Update the base_path schema definition to avoid
overlapping oneOf branches: replace oneOf with anyOf while retaining both the
include_string reference and unrestricted string branch, or remove the redundant
include_string branch and keep the string type. Ensure !include values validate
successfully.
- Around line 1311-1339: Update the command_env schema’s oneOf definition to
reserve it for structured entries: remove the map-form branch, and require key
plus exactly one of value or valueCommand. Preserve support for map-form
environment variables through the existing command.env schema.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 8bf11fd5-5d0b-481d-8994-d9004af2e568

📥 Commits

Reviewing files that changed from the base of the PR and between c8640ab and f700865.

📒 Files selected for processing (13)
  • agent-skills/skills/atmos-schemas/SKILL.md
  • agent-skills/skills/atmos-schemas/references/schema-structure.md
  • internal/exec/validate_schema.go
  • internal/exec/validate_schema_test.go
  • pkg/config/default.go
  • pkg/datafetcher/atmos_config_schema_coverage_test.go
  • pkg/datafetcher/fetch_schema_test.go
  • pkg/datafetcher/schema/config/global/1.0.json
  • pkg/datafetcher/schema_condition_validation_test.go
  • pkg/validator/schema_validator_test.go
  • website/docs/cli/configuration/schemas.mdx
  • website/docs/validation/json-schema.mdx
  • website/static/schemas/atmos/atmos-config/1.0/atmos-config.json
🚧 Files skipped from review as they are similar to previous changes (9)
  • pkg/validator/schema_validator_test.go
  • pkg/datafetcher/fetch_schema_test.go
  • agent-skills/skills/atmos-schemas/references/schema-structure.md
  • website/docs/cli/configuration/schemas.mdx
  • website/docs/validation/json-schema.mdx
  • internal/exec/validate_schema_test.go
  • pkg/datafetcher/atmos_config_schema_coverage_test.go
  • website/static/schemas/atmos/atmos-config/1.0/atmos-config.json
  • internal/exec/validate_schema.go

Comment thread pkg/config/default.go Resolved
@mergify

mergify Bot commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

💥 This pull request now has conflicts. Could you fix it rennokki (@rennokki)? 🙏

@mergify mergify Bot added the conflict This PR has conflicts label Jul 15, 2026
@rennokki

Copy link
Copy Markdown
Author

@osterman

Copy link
Copy Markdown
Member

Thanks for taking this on, rennokki (@rennokki)! A root atmos.yaml schema has been a long-standing gap (#2351), and you're completely right about the pain: config authoring has been guess-and-check with no IDE support.

We ended up solving it in #2761 with a different construction: the schema is generated from the Atmos configuration structs (go generate), with CI enforcing byte-exact regeneration. The reason we went that route rather than merging a hand-written schema is purely about maintenance: atmos.yaml grows options every release, and a hand-maintained 4,500-line schema would start drifting the week after it merged — the same problem that left the old embedded config/global schema stale. Generation makes drift structurally impossible, and doc comments in the code become the hover text in editors for free.

Your PR still directly improved the result: it flagged that the embedded atmos://schema/config/global/1.0 was silently serving a copy of the stack-manifest schema, which we've now fixed by aliasing that URI to the generated schema. #2761 also picks up the same defaults you wired (built-in schemas.config validation of atmos.yaml/atmos.yml, plus atmos.d/** and profile fragments) and the editor modeline docs.

So I'm going to close this in favor of #2761 — but genuinely, thank you for pushing on it. Once it ships you'll get atmos validate schema config, atmos config schema, and IDE completion via https://atmos.tools/schemas/atmos/atmos-config/1.0/atmos-config.json (with pinned per-release copies).

Would love your eyes on it if you have a chance to try it against your configs — you clearly know this surface well.

@rennokki

Copy link
Copy Markdown
Author

Closed in favor of #2761

@atmos-pro

atmos-pro Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Note

Atmos Pro  

Waiting for your GitHub Actions workflow to upload affected stacks.
Learn More.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

JSON/YAML schema for atmos.yaml file itself

3 participants