{"id":15235285,"url":"https://github.com/losisin/helm-values-schema-json","last_synced_at":"2025-10-11T11:21:33.627Z","repository":{"id":203310807,"uuid":"709219334","full_name":"losisin/helm-values-schema-json","owner":"losisin","description":"Helm plugin for generating values.schema.json from multiple values files","archived":false,"fork":false,"pushed_at":"2025-09-29T04:24:06.000Z","size":896,"stargazers_count":158,"open_issues_count":20,"forks_count":15,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-09-30T02:46:57.424Z","etag":null,"topics":["helm","helm-chart","helm-charts","helm-plugin","helm-plugins","json-schema","json-schema-generator","schema-json"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/losisin.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":"CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"github":"losisin"}},"created_at":"2023-10-24T09:13:41.000Z","updated_at":"2025-09-29T04:08:07.000Z","dependencies_parsed_at":"2023-10-30T15:34:45.271Z","dependency_job_id":"0d2bd21e-058b-4362-85f8-d27f86752688","html_url":"https://github.com/losisin/helm-values-schema-json","commit_stats":null,"previous_names":["losisin/helm-values-schema-json"],"tags_count":42,"template":false,"template_full_name":null,"purl":"pkg:github/losisin/helm-values-schema-json","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/losisin%2Fhelm-values-schema-json","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/losisin%2Fhelm-values-schema-json/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/losisin%2Fhelm-values-schema-json/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/losisin%2Fhelm-values-schema-json/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/losisin","download_url":"https://codeload.github.com/losisin/helm-values-schema-json/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/losisin%2Fhelm-values-schema-json/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":277622361,"owners_count":25849039,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-30T02:00:09.208Z","response_time":75,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["helm","helm-chart","helm-charts","helm-plugin","helm-plugins","json-schema","json-schema-generator","schema-json"],"created_at":"2024-09-29T08:01:27.169Z","updated_at":"2025-10-11T11:21:33.597Z","avatar_url":"https://github.com/losisin.png","language":"Go","funding_links":["https://github.com/sponsors/losisin"],"categories":["Go"],"sub_categories":[],"readme":"# helm values schema json plugin\n\n[![ci](https://github.com/losisin/helm-values-schema-json/actions/workflows/ci.yaml/badge.svg?branch=main)](https://github.com/losisin/helm-values-schema-json/actions/workflows/ci.yaml)\n[![codecov](https://codecov.io/gh/losisin/helm-values-schema-json/graph/badge.svg?token=0QQVCFJH84)](https://codecov.io/gh/losisin/helm-values-schema-json)\n[![Go Report Card](https://goreportcard.com/badge/github.com/losisin/helm-values-schema-json)](https://goreportcard.com/report/github.com/losisin/helm-values-schema-json)\n[![Static Badge](https://img.shields.io/badge/licence%20-%20MIT-green)](https://github.com/losisin/helm-values-schema-json/blob/main/LICENSE)\n[![GitHub release (with filter)](https://img.shields.io/github/v/release/losisin/helm-values-schema-json)](https://github.com/losisin/helm-values-schema-json/releases)\n![GitHub Downloads (all assets, all releases)](https://img.shields.io/github/downloads/losisin/helm-values-schema-json/total)\n\nHelm plugin for generating `values.schema.json` from single or multiple values files. Schema can be enriched by reading annotations from comments. Works only with Helm3 charts.\n\n## Installation\n\n```bash\nhelm plugin install https://github.com/losisin/helm-values-schema-json.git\n```\n\n## Upgrading\n\n```bash\nhelm plugin update schema\n```\n\nSee changelogs:\n\n- [Breaking changes](./docs/upgrading.md)\n- [Full release notes in GitHub Releases](https://github.com/losisin/helm-values-schema-json/releases)\n\n## Features\n\n- Add multiple values files and merge them together - default is `values.yaml` in the current working directory\n- Save output with custom name and location - default is `values.schema.json` in current working directory\n- Use preferred schema draft version - default is draft 2020\n- Read annotations from comments.\n- Read description from [helm-docs](https://github.com/norwoodj/helm-docs)\n- Bundling subschemas referenced in `$ref`\n\nSee [docs](./docs/README.md) for more info or checkout example yaml files\nin [testdata](./testdata).\n\n## Integrations\n\nThere are several ways to automate schema generation with this plugin. Main reason is that the json schema file can be hard to follow and we as humans tend to forget and update routine tasks. So why not automate it?\n\n### GitHub actions\n\nThere is GitHub action that I've build using typescript and published on marketplace. You can find it [here](https://github.com/marketplace/actions/helm-values-schema-json-action). Basic usage is as follows:\n\n```yaml\nname: Generate values schema json\non:\n  - pull_request\njobs:\n  generate:\n    runs-on: ubuntu-latest\n    steps:\n    - uses: actions/checkout@v4\n      with:\n        ref: ${{ github.event.pull_request.head.ref }}\n      - name: Generate values schema json\n        uses: losisin/helm-values-schema-json-action@v1\n        with:\n          input: values.yaml\n```\n\n### pre-commit hook\n\nWith pre-commit, you can ensure your JSON schema is kept up-to-date each time you make a commit.\n\nFirst [install pre-commit](https://pre-commit.com/#install) and then create or update a `.pre-commit-config.yaml` in the root of your Git repo with at least the following content:\n\n```yaml\nrepos:\n  - repo: https://github.com/losisin/helm-values-schema-json\n    rev: v1.7.2\n    hooks:\n      - id: helm-schema\n        args: [\"--values\", \"values.yaml\"]\n```\n\nThen run:\n\n```bash\npre-commit install\npre-commit install-hooks\n```\n\nFurther changes to your chart files will cause an update to json schema when you make a commit.\n\n### Husky\n\nThis is a great tool for adding git hooks to your project. You can find it's documentation [here](https://typicode.github.io/husky/). Here is how you can use it:\n\n```json\n\"husky\": {\n  \"hooks\": {\n    \"pre-commit\": \"helm schema --values values.yaml\"\n  }\n},\n```\n\n### CI/CD fail-on-diff\n\nYou can use this plugin in your CI/CD pipeline to ensure that the schema is always up-to-date. Here is an example for GitLab [#82](https://github.com/losisin/helm-values-schema-json/issues/82):\n\n```yaml\nschema-check:\n  script:\n    - cd path/to/helm/chart\n    - helm schema -output generated-schema.json\n    - CURRENT_SCHEMA=$(cat values.schema.json)\n    - GENERATED_SCHEMA=$(cat generated-schema.json)\n    - |\n      if [ \"$CURRENT_SCHEMA\" != \"$GENERATED_SCHEMA\" ]; then\n        echo \"Schema must be re-generated! Run 'helm schema' in the helm-chart directory\" 1\u003e\u00262\n        exit 1\n      fi\n```\n\n## Usage\n\n```bash\n$ helm schema -help\nUsage:\n  helm schema [flags]\n\nFlags:\n      --bundle                              Bundle referenced ($ref) subschemas into a single file inside $defs\n      --bundle-root string                  Root directory to allow local referenced files to be loaded from (default current working directory)\n      --bundle-without-id                   Bundle without using $id to reference bundled schemas, which improves compatibility with e.g the VS Code JSON extension\n      --config string                       Config file for setting defaults. (default \".schema.yaml\")\n      --draft int                           Draft version (4, 6, 7, 2019, or 2020) (default 2020)\n  -h, --help                                help for helm schema\n      --indent int                          Indentation spaces (even number) (default 4)\n      --k8s-schema-url string               URL template used in $ref: $k8s/... alias (default \"https://raw.githubusercontent.com/yannh/kubernetes-json-schema/master/{{ .K8sSchemaVersion }}/\")\n      --k8s-schema-version string           Version used in the --k8s-schema-url template for $ref: $k8s/... alias\n      --no-additional-properties            Default additionalProperties to false for all objects in the schema\n      --no-default-global                   Disable automatic injection of 'global' property when schema root does not allow it\n  -o, --output string                       Output file path (default \"values.schema.json\")\n      --schema-root.additional-properties   Allow additional properties\n      --schema-root.description string      JSON schema description\n      --schema-root.id string               JSON schema ID\n      --schema-root.ref string              JSON schema URI reference. Relative to current working directory when using \"-bundle true\".\n      --schema-root.title string            JSON schema title\n      --use-helm-docs                       Read description from https://github.com/norwoodj/helm-docs comments\n  -f, --values strings                      One or more YAML files as inputs. Use comma-separated list or supply flag multiple times (default [values.yaml])\n  -v, --version                             version for helm schema\n```\n\n### Configuration file\n\nUses `.schema.yaml` in the current working directory.\nExample:\n\n```yaml\n# .schema.yaml\n# yaml-language-server: $schema=https://github.com/losisin/helm-values-schema-json/raw/refs/heads/main/config.schema.json\n\nvalues:\n  - values.yaml\n\ndraft: 2020\nindent: 4\noutput: values.schema.json\n\nbundle: false\nbundleRoot: \"\"\nbundleWithoutID: false\n\nk8sSchemaURL: https://raw.githubusercontent.com/yannh/kubernetes-json-schema/refs/heads/master/{{ .K8sSchemaVersion }}/\nk8sSchemaVersion: \"v1.33.1\"\n\nuseHelmDocs: false\n\nnoAdditionalProperties: false\nnoDefaultGlobal: false\n\nschemaRoot:\n  id: https://example.com/schema\n  title: Helm Values Schema\n  description: Schema for Helm values\n  additionalProperties: true\n```\n\nAll options available from CLI can be set in this file.\nHowever, do note that the file uses camelCase, while the flags uses kebab-case.\n\nThen, just run the plugin without any arguments:\n\n```bash\nhelm schema\n```\n\nYou can override which config file to use with the `--config` flag:\n\n```bash\nhelm schema --config ./my-helm-schema-config.yaml\n```\n\n### CLI\n\n#### Basic\n\nIn most cases you will want to run the plugin with default options:\n\n```bash\n$ helm schema\n```\n\nThis will read `values.yaml`, set draft version to `2020-12` and save output to `values.schema.json`.\n\n#### Extended\n\n##### Multiple values files\n\nMerge multiple values files, set json-schema draft version explicitly and save output to `my.schema.json`:\n\n`values_1.yaml`\n\n```yaml\nnodeSelector:\n  kubernetes.io/hostname: \"\"\ndummyList:\n  - \"a\"\n  - \"b\"\n  - \"c\"\nkey1: \"asd\"\nkey2: 42\nkey3: {}\nkey4: []\n```\n\n`custom/path/values_2.yaml`\n\n```yaml\nnodeSelector:\n  kubernetes.io/hostname: \"node1\"\ndeep:\n  deep1:\n    deep2:\n      deep3:\n        deep4: \"asdf\"\n```\n\nRun the following command to merge the yaml files and output json schema:\n\n```bash\nhelm schema --values values_1.yaml,custom/path/values_2.yaml --draft 7 --output my.schema.json\n```\n\nOutput will be something like this:\n\n```json\n{\n    \"$schema\": \"http://json-schema.org/draft-07/schema#\",\n    \"type\": \"object\",\n    \"properties\": {\n        \"deep\": {\n            \"type\": \"object\",\n            \"properties\": {\n                \"deep1\": {\n                    \"type\": \"object\",\n                    \"properties\": {\n                        \"deep2\": {\n                            \"type\": \"object\",\n                            \"properties\": {\n                                \"deep3\": {\n                                    \"type\": \"object\",\n                                    \"properties\": {\n                                        \"deep4\": {\n                                            \"type\": \"string\"\n                                        }\n                                    }\n                                }\n                            }\n                        }\n                    }\n                }\n            }\n        },\n        \"dummyList\": {\n            \"type\": \"array\",\n            \"items\": {\n                \"type\": \"string\"\n            }\n        },\n        \"key1\": {\n            \"type\": \"string\"\n        },\n        \"key2\": {\n            \"type\": \"integer\"\n        },\n        \"key3\": {\n            \"type\": \"object\"\n        },\n        \"key4\": {\n            \"type\": \"array\"\n        },\n        \"nodeSelector\": {\n            \"type\": \"object\",\n            \"properties\": {\n                \"kubernetes.io/hostname\": {\n                    \"type\": \"string\"\n                }\n            }\n        }\n    }\n}\n```\n\n\u003e [!NOTE]\n\u003e When using multiple values files as input, the plugin follows Helm's behavior. This means that if the same yaml keys are present in multiple files, the latter file will take precedence over the former. The same applies to annotations in comments. Therefore, the order of the input files is important.\n\n##### Root JSON object properties\n\nAdding ID, title and description to the schema:\n\n`basic.yaml`\n\n```yaml\nimage:\n  repository: nginx\n  tag: latest\n  pullPolicy: Always\n```\n\n```bash\nhelm schema --values values.yaml --schema-root.id \"https://example.com/schema\" --schema-root.ref \"schema/product.json\" -schema-root.title \"My schema\" --schema-root.description \"This is my schema\"\n```\n\nGenerated schema will be:\n\n```json\n{\n    \"$id\": \"https://example.com/schema\",\n    \"$ref\": \"schema/product.json\",\n    \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n    \"additionalProperties\": true,\n    \"description\": \"This is my schema\",\n    \"properties\": {\n        \"image\": {\n            \"properties\": {\n                \"pullPolicy\": {\n                    \"type\": \"string\"\n                },\n                \"repository\": {\n                    \"type\": \"string\"\n                },\n                \"tag\": {\n                    \"type\": \"string\"\n                }\n            },\n            \"type\": \"object\"\n        }\n    },\n    \"title\": \"My schema\",\n    \"type\": \"object\"\n}\n```\n\n## Issues, Features, Feedback\n\nYour input matters. Feel free to open [issues](https://github.com/losisin/helm-values-schema-json/issues) for bugs, feature requests, or any feedback you may have. Check if a similar issue exists before creating a new one, and please use clear titles and explanations to help understand your point better. Your thoughts help me improve this project!\n\n### How to Contribute\n\n🌟 Thank you for considering contributing to my project! Your efforts are incredibly valuable. To get started:\n1. Fork the repository.\n2. Create your feature branch: `git checkout -b feature/YourFeature`\n3. Commit your changes: `git commit -am 'Add: YourFeature'`\n4. Push to the branch: `git push origin feature/YourFeature`\n5. Submit a pull request! 🚀\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flosisin%2Fhelm-values-schema-json","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flosisin%2Fhelm-values-schema-json","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flosisin%2Fhelm-values-schema-json/lists"}