{"id":15152772,"url":"https://github.com/gcornut/cli-valibot-to-json-schema","last_synced_at":"2026-03-13T14:31:12.207Z","repository":{"id":257308204,"uuid":"857883452","full_name":"gcornut/cli-valibot-to-json-schema","owner":"gcornut","description":"CLI wrapper for @valibot/to-json-schema","archived":false,"fork":false,"pushed_at":"2026-01-26T19:52:26.000Z","size":437,"stargazers_count":0,"open_issues_count":4,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-01-27T07:16:32.265Z","etag":null,"topics":["cli","json-schema","valibot"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/@gcornut/cli-valibot-to-json-schema","language":"TypeScript","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/gcornut.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"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}},"created_at":"2024-09-15T21:09:57.000Z","updated_at":"2025-11-17T23:47:40.000Z","dependencies_parsed_at":"2025-05-31T12:01:28.841Z","dependency_job_id":"9fa58cd9-938e-47a2-bced-68fc8e0b4f4c","html_url":"https://github.com/gcornut/cli-valibot-to-json-schema","commit_stats":{"total_commits":7,"total_committers":3,"mean_commits":"2.3333333333333335","dds":0.4285714285714286,"last_synced_commit":"a51fb34f04022dd198ddd613b5403a1297e6a87f"},"previous_names":["gcornut/cli-valibot-to-json-schema"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/gcornut/cli-valibot-to-json-schema","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gcornut%2Fcli-valibot-to-json-schema","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gcornut%2Fcli-valibot-to-json-schema/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gcornut%2Fcli-valibot-to-json-schema/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gcornut%2Fcli-valibot-to-json-schema/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gcornut","download_url":"https://codeload.github.com/gcornut/cli-valibot-to-json-schema/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gcornut%2Fcli-valibot-to-json-schema/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30468272,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-13T11:00:43.441Z","status":"ssl_error","status_checked_at":"2026-03-13T11:00:23.173Z","response_time":60,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["cli","json-schema","valibot"],"created_at":"2024-09-26T16:22:52.538Z","updated_at":"2026-03-13T14:31:12.184Z","avatar_url":"https://github.com/gcornut.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# @gcornut/cli-valibot-to-json-schema\n\nCLI wrapper for [@valibot/to-json-schema](https://github.com/fabian-hiller/valibot/tree/main/packages/to-json-schema) to convert JS/TS files containing Valibot schemas into a JSON schema (draft 07).\n\n```shell\n# Convert valibot schemas to JSON schema\nnpx @gcornut/cli-valibot-to-json-schema ./schemas.js\n```\n\nThis outputs a conversion of the Valibot schemas into JSON schema. If the default export is a Valibot schemas, it is\nused as\nthe root definition. Other exported Valibot schemas are converted in the JSON schema \u003ccode\u003e$defs\u003c/code\u003e section.\n\n\u003cdetails\u003e\u003csummary\u003e\u003cb\u003eSee detailed input and output:\u003c/b\u003e\u003c/summary\u003e\n\n_Input file `./schemas.js`_:\n\n```js\nimport * as v from \"valibot\";\n\nexport const AString = v.string();\nconst AnObject = v.object({ aString: AString });\nexport default AnObject;\n```\n\n_Output conversion_:\n\n```json\n{\n    \"$schema\": \"http://json-schema.org/draft-07/schema#\",\n    \"$defs\": {\n        \"AString\": {\n            \"type\": \"string\"\n        }\n    },\n    \"properties\": {\n        \"aString\": {\n            \"$ref\": \"#/$defs/AString\"\n        }\n    },\n    \"required\": [\"aString\"],\n    \"type\": \"object\"\n}\n```\n\n`AnObject` is the default export in the source module, so it is converted as the root definition. `AString` is exported\nseparately, so it is exported to the `definitions` section.\n\n\u003c/details\u003e\n\n[See @valibot/to-json-schema README](https://github.com/fabian-hiller/valibot/blob/main/packages/to-json-schema/README.md) for details on the limited compatibility when converting Valibot schema.\n\n## ESM and TypeScript input module\n\nThis CLI loads the input JS module using **standard NodeJS CommonJS require**. This means you will\nhave issues with **ESM or TypeScript modules**.\n\nTo remedy that, you will either have to preinstall `ebuild-runner` and `esbuild` (so that the program can use them) or\nuse a Node-compatible runtime that support these modules (ex: bun, replacing `npx` with `bunx`).\n\nExample:\n\n```shell\n# Convert from TS/ESM module using bunx\nbunx @gcornut/cli-valibot-to-json-schema ./schemas.ts\n\n# Convert from TS/ESM module with esbuild-runner preinstalled\nnpm install esbuild esbuild-runner\nnpx @gcornut/cli-valibot-to-json-schema ./schemas.ts\n\n# Convert from TS/ESM module using `yarn dlx` multi-package feature\nyarn dlx -p esbuild -p esbuild-runner -p @gcornut/cli-valibot-to-json-schema valibot-json-schema ./schemas.ts\n```\n\n## Parameters\n\nUse `-o \u003cfile\u003e` option to output the JSON schema to a file instead of `stdout`.\n\nUse `-t \u003ctype\u003e` option to select the root definitions from the module exports (defaults to the \"default\" export).\nExample: `-t foo.bar` will get the property `bar` on the `foo` export of the input module.\n\nUse `-d \u003ctype\u003e` option to select the definitions from the module exports (instead of using all non-default export).\nExample: `-d foo.bar` will get the property `bar` on the `foo` export of the input module.\n\nUse `--force` to ignore unsupported schemas and validations and still provide an output.\n\nUse `--definitionsKey` to replace the default `$defs` definitions key with a custom one (ex: `definitions` like in previous version of JSONSchema).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgcornut%2Fcli-valibot-to-json-schema","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgcornut%2Fcli-valibot-to-json-schema","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgcornut%2Fcli-valibot-to-json-schema/lists"}