Skip to main content
The validate-values command validates YAML option values against JSON schemas. This ensures that all option values conform to their type definitions and that no duplicate keys exist within targets.

Usage

sentry-options-cli validate-values --schemas <SCHEMAS> --root <ROOT>

Arguments

--schemas
string
required
Directory containing namespace schema definitions.Expected structure:
schemas/
├── seer/
│   └── schema.json
└── relay/
    └── schema.json
--root
string
required
Root directory of the sentry options values.Expected structure:
option-values/
├── seer/
│   ├── default/
│   │   └── values.yaml
│   └── us/
│       └── values.yaml
└── relay/
    ├── default/
    │   └── values.yaml
    └── de/
        └── values.yaml
--quiet
boolean
Suppress success messages. Only errors will be displayed.

Directory structure requirements

Values must follow the namespace/target/file.yaml structure:
  • namespace - Must match a directory in --schemas
  • target - Deployment target (e.g., default, us, de, s4s)
  • file.yaml - YAML files with .yaml extension (.yml is rejected)
Each namespace must have a default target directory.

Validation checks

The command performs these validations:
  1. Schema validation - All schemas are valid JSON Schema
  2. Namespace validation - All namespaces in values have corresponding schemas
  3. Type validation - All option values match their schema types
  4. Required fields - All required options are present
  5. Duplicate keys - No option key appears in multiple files within the same target
  6. File format - All files are valid YAML with correct structure
  7. Default target - Each namespace has a default target directory

YAML file format

Each YAML file must have exactly one top-level key named options:
options:
  feature.enabled: true
  feature.rate_limit: 200
  feature.enabled_slugs:
    - getsentry
    - sentry

Examples

Basic usage

sentry-options-cli validate-values \
  --schemas schemas/ \
  --root option-values/
Output:
Values validation successful

With quiet mode

sentry-options-cli validate-values \
  --schemas schemas/ \
  --root option-values/ \
  --quiet
No output on success.

In CI workflow

# .github/workflows/validate.yml
- name: Fetch schemas
  run: |
    sentry-options-cli fetch-schemas \
      --config repos.json \
      --out schemas/

- name: Validate values
  run: |
    sentry-options-cli validate-values \
      --schemas schemas/ \
      --root option-values/

Error examples

Type mismatch

# option-values/seer/default/values.yaml
options:
  feature.rate_limit: "not a number"  # Expected integer
Error:
Schema validation error: option-values/seer/default/values.yaml
  feature.rate_limit: "not a number" is not of type "integer"

Duplicate keys

# option-values/seer/default/base.yaml
options:
  feature.enabled: true

# option-values/seer/default/overrides.yaml
options:
  feature.enabled: false  # Duplicate!
Error:
Duplicate key 'feature.enabled' found in option-values/seer/default/base.yaml and option-values/seer/default/overrides.yaml

Unknown namespace

option-values/
└── unknown/
    └── default/
        └── values.yaml
Error:
Unknown namespace 'unknown' found in option-values/unknown/default/values.yaml
No schema found at schemas/unknown/schema.json

Missing default target

option-values/
└── seer/
    └── us/
        └── values.yaml  # Missing default/
Error:
Namespace 'seer' is missing required 'default' target

Invalid YAML format

# Missing 'options' key
settings:
  some_value: true
Error:
YAML parse error in option-values/seer/default/values.yaml: expected top-level key 'options'

Multiple top-level keys

options:
  feature.enabled: true
extra:
  other_value: 123
Error:
Validation error: option-values/seer/default/values.yaml must have exactly one top level key named 'options'

Wrong file extension

option-values/
└── seer/
    └── default/
        └── values.yml  # Should be .yaml
Error:
Invalid file extension: option-values/seer/default/values.yml
expected .yaml, found .yml

Non-YAML files

Files without .yaml or .yml extensions are silently ignored:
option-values/seer/default/
├── values.yaml     # Validated
├── README.md       # Ignored
└── .gitkeep        # Ignored

Target inheritance

The validate-values command validates each target independently. Target-specific values override defaults, but both must individually validate against the schema. For example:
# default/values.yaml
options:
  feature.enabled: false
  feature.rate_limit: 100

# us/values.yaml
options:
  feature.enabled: true  # Override default
  # feature.rate_limit inherits from default
Both files are validated separately against the schema.

See also

Build docs developers (and LLMs) love