helm-schema

Schema overrides

On this page

Analysis cannot recover everything: a value read through a key computed at render time, a key an outer pipeline injects, or a type the templates never pin down. For those, merge one or more override schemas over the generated one:

helm-schema ./mychart \
  --override-schema ../schemas/injected-keys.override.json \
  --override-schema ./schema-override.json \
  --output values.schema.json

--override-schema repeats. The files are applied in the order given, each over the result of the one before. A common split is a shared override for keys an outer pipeline injects into every chart, followed by one for the chart itself.

How the merge works#

An override merges into the schema recursively, so it tightens types and fills gaps without replacing what was generated. Two rules differ:

  • required lists are joined. An override adds required properties without dropping the ones analysis found.
  • A subtree with a $ref replaces the generated one. JSON Schema Draft-07 ignores the siblings of a $ref, so merging would leave generated constraints next to the referenced schema and could describe a value nothing satisfies.

An override carries its own definitions. It cannot refer to the names in the generated schema’s $defs, which are private to helm-schema.

Example#

An outer pipeline injects a global.tenant string that the chart’s values.yaml never sets, and every install must name a region:

schema-override.json
{
  "properties": {
    "global": {
      "type": "object",
      "properties": {
        "tenant": { "type": "string" }
      }
    },
    "region": { "type": "string", "enum": ["us", "eu"] }
  },
  "required": ["region"]
}

Merged over the generated schema, it adds global.tenant, constrains region and adds region to the root’s required, and leaves everything else as generated.

Note

An override is your own input, applied after analysis on purpose. A chart’s shipped values.schema.json is different: helm-schema never reads it, since another author wrote it, possibly for another purpose or an older version of the chart.

Esc

Type # for headings only ↑↓ move ↵ open Ctrl ↵ new tab Ctrl U/D scroll preview

Keyboard shortcuts

/ ⌘ K Ctrl K
Search
← →
Previous or next page
?
Show these shortcuts