helm-schema

CLI reference

On this page

helm-schema generates a schema from one argument, the chart, and its flags. The schema goes to standard output unless --output names a file; diagnostics go to standard error. The commands hand a generated schema to Helm:

  • shorten: writes a copy of a schema with short $defs keys.
  • lint and template: run Helm on a copy of the chart with a shortened schema.
helm-schema [OPTIONS] <CHART_DIR>
helm-schema shorten [--map <PATH>] [--compact] <INPUT> <OUTPUT>
helm-schema lint [--helm <PATH>] <CHART> [HELM_ARGS]...
helm-schema template [--helm <PATH>] <CHART> [HELM_ARGS]...

Run helm-schema --help for the authoritative, version-specific summary.

Argument#

ArgumentDescription
<CHART_DIR>Chart directory or packaged chart archive (.tgz/.tar.gz) to analyze. Required.

Output#

FlagDescription
-o, --output <FILE>Write the schema to a file; standard output is used when absent.
--output-layout <LAYOUT>auto (default): pretty JSON until Helm’s 5 MiB limit requires compact JSON with short names. pretty: always pretty with readable names. compact: always compact with short names. Every mode writes oversized output with a warning, never a size error.
--compactDeprecated: compact JSON whitespace only. Retains readable names unless --shorten-defs is also used. Conflicts with explicit --output-layout.
--strip-descriptionsRemove JSON Schema description annotations. Schema-aware: a property literally named description is kept.
--profile <full|lean>Select emitted validation detail. full is the default. lean retains mandatory and local ordinary facts, while dropping root ordinary conditionals, terminals, and kind partitions.
--root-anchored-conditionals <on|off>Override root-anchored ordinary conditional emission.
--local-conditionals <on|off>Override locally anchored ordinary conditional emission.
--terminal-clauses <on|off>Override unconditional and guarded terminal emission.
--kind-partitions <on|off>Override kind-partition refinements. At least one applicable anchor lane must remain enabled when this is on.
--keep-refsLeave file/URL $ref strings as-is. By default external refs are resolved into root-level $defs so the output is self-contained. Conflicts with --inline-refs.
--inline-refsFully inline resolved file/URL $refs instead of writing $defs.
--no-minimizeKeep repeated subtrees inline instead of interning them into root-level $defs. Interning is on by default.
--defs-names <source|destination>Name the $defs entries helm-schema creates by the schema path their content comes from (source, the default) or by their first reference (destination).
--shorten-defsDeprecated: short definition names only; pretty JSON unless --compact is also used. Conflicts with explicit --output-layout.
--defs-map <PATH>Write the map from each short key to its readable name; an empty object when the chosen layout keeps names unchanged.

shorten#

helm-schema shorten <INPUT> <OUTPUT> renames the $defs entries of a generated schema to short keys, the form to hand Helm when the readable schema is over Helm’s 5 MiB limit for a chart file.

FlagDescription
--map <PATH>Write the map from each short key to its readable name.
--compactWrite compact JSON.

It warns when the schema it writes is still over the limit, and exits successfully, as generation does. Generation itself already compacts and shortens a schema that would be over the limit, and reports the size on standard error.

lint and template#

helm-schema lint <CHART> [HELM_ARGS]... and helm-schema template <CHART> [HELM_ARGS]... run helm lint or helm template on a copy of the chart directory whose root values.schema.json is shortened and compact. A readable schema you reviewed then works with Helm even when it is over Helm’s limit:

helm-schema lint ./mychart -f my-values.yaml
helm-schema template ./mychart --name-template my-release

What they pass to Helm:

  • Arguments: everything after the chart, as written, including --help. One -- right after the chart is dropped.
  • The release name: template takes the chart first, so name the release with --name-template rather than Helm’s NAME CHART form.
  • Paths: Helm runs in the current directory, so relative -f and --set-file paths mean what they mean for Helm.

What they give back:

  • Output: Helm’s standard output and error, line by line. In Helm’s messages, on both streams of lint and on standard error of template, each #/$defs/<short key> is replaced by its readable name; the manifests template prints stay byte for byte.
  • Exit status: Helm’s. On Unix, a signal that ended Helm ends helm-schema too.

The copy:

  • Where: a new directory under TMPDIR, or the platform’s temporary directory. A chart without a root values.schema.json runs as it is, without a copy.
  • Removal: when Helm ends, also when SIGINT, SIGTERM or SIGQUIT stops it on Unix. On Windows only a console Ctrl-C is caught, so closing the window can leave the copy behind. A failed removal is reported on standard error and does not change the exit status.
  • Contents: links are copied as the files and directories they point to, and a link to a directory that contains it is refused. Dependency schemas and archives are copied unchanged, and Helm still applies .helmignore.
FlagDescription
--helm <PATH>The Helm executable. Defaults to $HELM, then helm on PATH.

Short keys are looked up in the root schema’s map only; a dependency schema whose own $defs use the same short spelling is translated as if it were the root’s.

See Output for what these produce.

Configuration#

FlagDescription
--config <PATH>Read policy from this file instead of discovering the root chart’s helm-schema.yaml. Relative paths use the invocation working directory.
--no-configIgnore chart configuration, discovered or named. Conflicts with --config.
--print-effective-configPrint resolved policy values and per-field sources without analyzing the chart.

See Configuration for the file format, retention contract, and precedence rules.

Kubernetes schemas#

FlagDescription
--k8s-version <VERSION>Kubernetes minor version dir(s) to consult, in priority order; first is primary. Repeatable. Default: v1.35.0.
--k8s-version-fallback <auto|N>Auto-extend a single --k8s-version with older minors. auto uses the default window; <N> sets the window size. Conflicts with --strict-k8s-version.
--strict-k8s-versionSuppress the auto-fallback chain.
--k8s-schema-mirror <URL>Additional upstream Kubernetes schema mirror. Repeatable. Available in strict and loose modes.
--k8s-schema-cache-dir <DIR>Managed cache root for Kubernetes schemas. Subject to the cache invalidation contract.
--no-cacheBypass cache reads and re-check upstream directly. Successful responses and authoritative 404s still refresh the cache.
--offlineNever fetch; read only the local caches.
--no-k8s-schemasSkip upstream Kubernetes schemas entirely (template analysis only).

See Kubernetes schemas.

CRD schemas#

FlagDescription
--crd-version-lookup <strict|loose>CRD version lookup mode. Default strict (only the exact (group, kind, version)); loose adds a local cross-scan and informational hints. Never substitutes a version.
--strict-crd-versionShort alias for --crd-version-lookup=strict.
--crd-catalog-mirror <URL>Additional upstream CRD catalog mirror. Repeatable. Available in both modes.
--crd-catalog-cache-dir <DIR>Managed cache root for CRD schemas. Subject to the cache invalidation contract.
--crd-override-dir <DIR>Hand-maintained schema overrides at the top of the lookup chain. Never wiped; not a managed cache. Keyed by (group, version, kind).
--crd-cache-record-sourceWrite a <schema>.json.meta sidecar next to each CRD cache entry recording the fetch URL and timestamp.

See CRD schemas.

apiVersion inference#

FlagDescription
--api-version-guessEnable bounded apiVersion inference for kinds whose apiVersion the analyzer couldn’t pin. Conflicts with --strict-api-versions.
--strict-api-versionsDisable apiVersion inference entirely.

See apiVersion inference.

Chart traversal#

FlagDescription
--exclude-testsSkip templates/tests/**.
--no-subchart-valuesOmit vendored subchart defaults under charts/ from the composed values.
-f, --values <FILE>Additional values files whose comments layer into schema descriptions. Documentation metadata only — no type hints or accepted paths. Repeatable.
--infer-requiredMark unconditionally-guarded paths as required on their parent. Paths with a default <expr> fallback are excluded.
--open-rootOmit the generated additionalProperties: false at the chart values root, so unknown top-level keys pass. Nested structural and Kubernetes closures stay. An authoring assertion, recorded in x-helm-schema-policy.authoring.
--declared-types <assert|annotate>assert (default): a declared default asserts its type where no other evidence governs the path. annotate: declared defaults document names and values only; template and Kubernetes constraints remain.

Overrides#

FlagDescription
--override-schema <FILE>Schema files merged on top of the inferred output, in the order given. Repeatable.

See Schema overrides.

Diagnostics#

FlagDescription
--diag-format <text|json>Format for diagnostics on stderr. Default text. json emits one structured object per line.

See Diagnostics.

Environment variables#

VariableEffect
HELM_SCHEMA_K8S_SCHEMA_CACHEKubernetes schema cache root (same as --k8s-schema-cache-dir).
HELM_SCHEMA_CRD_SCHEMA_CACHECRD catalog cache root (same as --crd-catalog-cache-dir).

Mutually exclusive flags#

  • --keep-refs and --inline-refs
  • --strict-k8s-version and --k8s-version-fallback
  • --api-version-guess and --strict-api-versions
  • --k8s-version-fallback is also rejected alongside multiple explicit --k8s-version values.

Development tracing#

Perfetto tracing is available in the unpublished helm-schema-dev binary. It runs the same commands and arguments as helm-schema, with an additional --trace-output <FILE> option. Build it from the workspace with cargo build --release -p helm-schema-dev.

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