npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

helm-values-schema

v1.0.0

Published

Generate JSON Schema (draft-07) from Helm chart values.yaml files with helm-docs comment support

Readme

helm-values-schema

Generate JSON Schema (draft-07) from Helm chart values.yaml files.

Reads default values and helm-docs # -- comments to produce a values.schema.json you can drop next to your chart's values.yaml. Helm uses this file to validate user-supplied values at install/upgrade time.

Install

npm install helm-values-schema

CLI Usage

# From a local file → stdout
helm-values-schema generate --file values.yaml

# From a URL → file
helm-values-schema generate \
  --url https://raw.githubusercontent.com/kubernetes/ingress-nginx/main/charts/ingress-nginx/values.yaml \
  --output values.schema.json

# With options
helm-values-schema generate --file values.yaml \
  --title "my-chart" \
  --description "Schema for my-chart values" \
  --no-defaults \
  --required \
  --output values.schema.json

CLI Options

| Option | Description | |---|---| | -f, --file <path> | Local path to values.yaml | | -u, --url <url> | URL to fetch values.yaml from | | -o, --output <path> | Output file path (default: stdout) | | --title <title> | Schema title | | --description <desc> | Schema description | | --no-defaults | Omit default values from schema | | --required | Mark non-null fields as required | | --header <key:value> | HTTP headers (repeatable) | | --timeout <ms> | Request timeout (default: 30000) |

Programmatic API

generateSchema(content, options?)

Generate a schema from a YAML string:

import { generateSchema } from 'helm-values-schema';

const yaml = `
# -- Number of replicas
replicas: 3
image:
  # -- Docker image repository
  repository: nginx
  tag: "1.0"
enabled: true
config: {}
extra: null
`;

const schema = generateSchema(yaml, { title: 'my-chart' });
console.log(JSON.stringify(schema, null, 2));

Output:

{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "title": "my-chart",
  "type": "object",
  "properties": {
    "replicas": {
      "description": "Number of replicas",
      "type": "integer",
      "default": 3
    },
    "image": {
      "type": "object",
      "properties": {
        "repository": {
          "description": "Docker image repository",
          "type": "string",
          "default": "nginx"
        },
        "tag": {
          "type": "string",
          "default": "1.0"
        }
      }
    },
    "enabled": {
      "type": "boolean",
      "default": true
    },
    "config": {
      "type": "object",
      "additionalProperties": true
    },
    "extra": {}
  }
}

generateSchemaFromSource(source, options?)

Load from a URL or file path and generate:

import { generateSchemaFromSource } from 'helm-values-schema';

const schema = await generateSchemaFromSource(
  'https://raw.githubusercontent.com/.../values.yaml',
  { title: 'ingress-nginx' }
);

Options

interface GenerateOptions {
  /** Include $schema declaration in root (default: true) */
  includeSchemaDeclaration?: boolean;
  /** Include default values in the schema (default: true) */
  includeDefaults?: boolean;
  /** Mark non-null fields as required (default: false) */
  markRequired?: boolean;
  /** Schema title */
  title?: string;
  /** Schema description */
  description?: string;
  /** HTTP headers for authenticated requests */
  headers?: Record<string, string>;
  /** Request timeout in ms (default: 30000) */
  timeout?: number;
}

Lower-level API

For more control, use the parser and builder separately:

import { parseValuesYaml, buildSchema } from 'helm-values-schema';

const tree = parseValuesYaml(yamlContent);
// Inspect or modify the parsed tree...
const schema = buildSchema(tree, { includeDefaults: false });

Type Inference Rules

| YAML Value | JSON Schema | |---|---| | "hello", "" | { "type": "string" } | | 3, 101 | { "type": "integer" } | | 1.5 | { "type": "number" } | | true, false | { "type": "boolean" } | | null, ~ | {} (permissive — accepts any value) | | {} | { "type": "object", "additionalProperties": true } | | [] | { "type": "array", "items": {} } | | [80, 443] | { "type": "array", "items": { "type": "integer" } } | | nested object | { "type": "object", "properties": { ... } } |

helm-docs Comments

Comments following the # -- convention (used by helm-docs) are extracted as description fields:

# -- Override the deployment namespace
namespaceOverride: ""

Produces:

{
  "namespaceOverride": {
    "description": "Override the deployment namespace",
    "type": "string",
    "default": ""
  }
}

Multi-line # -- comments are joined into a single description.

Examples

Pre-generated schemas for popular charts are in the examples/ directory:

License

MIT