configschema

package
v1.223.1-rc.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 21, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package configschema generates the JSON Schema for `atmos.yaml` (the Atmos CLI configuration) by reflecting over schema.AtmosConfiguration — the exact struct Atmos decodes `atmos.yaml` into — so the published schema can never drift from the code. Go doc comments on the configuration structs become schema descriptions.

The committed artifact at pkg/datafetcher/schema/atmos/config/1.0.json is regenerated with `go generate ./pkg/config/schema` and guarded by a drift test that fails whenever the configuration structs change without a regeneration. The atmos binary never imports this package; generation happens at development and test time only.

Index

Constants

View Source
const (
	// SchemaID is the canonical `$id` of the generated schema — the floating
	// (always-latest) URL published on atmos.tools. Per-release pinned copies are
	// published under `.../atmos-config/<version>/atmos-config.json`.
	SchemaID = "https://atmos.tools/schemas/atmos/atmos-config/1.0/atmos-config.json"

	// EmbeddedSource is the `atmos://` source the embedded copy of the schema is
	// served from (see pkg/datafetcher).
	EmbeddedSource = "atmos://schema/atmos/config/1.0"

	// EmbeddedPath is the repository-relative path of the committed schema
	// artifact embedded into the binary by pkg/datafetcher.
	EmbeddedPath = "pkg/datafetcher/schema/atmos/config/1.0.json"
)

Variables

View Source
var ErrRepoRootNotFound = errors.New("failed to locate the repository root from the configschema source file")

ErrRepoRootNotFound indicates the repository root could not be located from this source file, which means generation is running outside a source checkout.

Functions

func Generate

func Generate() ([]byte, error)

Generate reflects schema.AtmosConfiguration into the atmos.yaml JSON Schema document. It requires the repository's Go source on disk (doc comments become schema descriptions), so it runs at generate/test time only — never inside the shipped binary.

func RepoRoot

func RepoRoot() (string, error)

RepoRoot locates the repository root relative to this source file. The generator and its tests always run from a source checkout (this package is never compiled into the atmos binary), so runtime.Caller is reliable here.

Types

This section is empty.

Directories

Path Synopsis
Command generator regenerates the embedded atmos.yaml JSON Schema artifact from the Go configuration structs.
Command generator regenerates the embedded atmos.yaml JSON Schema artifact from the Go configuration structs.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL