{"id":14384325,"url":"https://github.com/jackdbd/zod-to-doc","last_synced_at":"2025-07-08T11:06:09.237Z","repository":{"id":220538048,"uuid":"751896363","full_name":"jackdbd/zod-to-doc","owner":"jackdbd","description":"Inject your Zod schemas into your docs","archived":false,"fork":false,"pushed_at":"2024-09-19T19:49:27.000Z","size":853,"stargazers_count":3,"open_issues_count":3,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-05-29T10:14:31.702Z","etag":null,"topics":["docs","readme","schemas","zod"],"latest_commit_sha":null,"homepage":"https://jackdbd.github.io/zod-to-doc/","language":"JavaScript","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/jackdbd.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","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}},"created_at":"2024-02-02T15:09:04.000Z","updated_at":"2025-03-04T08:03:39.000Z","dependencies_parsed_at":"2024-04-25T15:52:21.984Z","dependency_job_id":"8f10c156-9201-43a4-a7fc-348e19daf51d","html_url":"https://github.com/jackdbd/zod-to-doc","commit_stats":null,"previous_names":["jackdbd/zod-to-doc"],"tags_count":15,"template":false,"template_full_name":null,"purl":"pkg:github/jackdbd/zod-to-doc","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jackdbd%2Fzod-to-doc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jackdbd%2Fzod-to-doc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jackdbd%2Fzod-to-doc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jackdbd%2Fzod-to-doc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jackdbd","download_url":"https://codeload.github.com/jackdbd/zod-to-doc/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jackdbd%2Fzod-to-doc/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263035814,"owners_count":23403424,"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","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":["docs","readme","schemas","zod"],"created_at":"2024-08-28T18:01:18.568Z","updated_at":"2025-07-08T11:06:09.213Z","avatar_url":"https://github.com/jackdbd.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"# Zod to Doc\n\n[![npm package badge](https://badge.fury.io/js/@jackdbd%2Fzod-to-doc.svg)](https://badge.fury.io/js/@jackdbd%2Fzod-to-doc)\n[![install size](https://packagephobia.com/badge?p=@jackdbd/zod-to-doc)](https://packagephobia.com/result?p=@jackdbd/zod-to-doc)\n[![CI](https://github.com/jackdbd/zod-to-doc/actions/workflows/ci.yaml/badge.svg)](https://github.com/jackdbd/zod-to-doc/actions/workflows/ci.yaml)\n[![CodeCov badge](https://codecov.io/gh/jackdbd/zod-to-doc/graph/badge.svg?token=9jddzo5Dt3)](https://codecov.io/gh/jackdbd/zod-to-doc)\n[![CodeFactor badge](https://www.codefactor.io/repository/github/jackdbd/zod-to-doc/badge)](https://www.codefactor.io/repository/github/jackdbd/zod-to-doc)\n[![Socket Badge](https://socket.dev/api/badge/npm/package/@jackdbd/zod-to-doc)](https://socket.dev/npm/package/@jackdbd/zod-to-doc)\n[![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-%23FE5196?logo=conventionalcommits\u0026logoColor=white)](https://conventionalcommits.org)\n\nInject your [Zod](https://github.com/colinhacks/zod) schemas into your docs.\n\n- [About](#about)\n- [Installation](#installation)\n- [Docs](#docs)\n- [Examples](#examples)\n  - [Usage as a CLI](#usage-as-a-cli)\n    - [Car table](#car-table)\n  - [Usage as a library](#usage-as-a-library)\n    - [Car tire table](#car-tire-table)\n- [Troubleshooting](#troubleshooting)\n- [Dependencies](#dependencies)\n- [License](#license)\n\n## About\n\nI was looking for a way to keep my documentation updated with my Zod schemas. To my surprise, I couldn't find any tool that would output a string representation of a Zod schema. So I decided to write my own. You can use this tool either as a library or as a CLI.\n\n## Installation\n\n```sh\nnpm install --save-dev @jackdbd/zod-to-doc\n```\n\n## Docs\n\n[Docs generated by TypeDoc](https://jackdbd.github.io/zod-to-doc/index.html)\n\n\u003e 📖 **API Docs**\n\u003e\n\u003e This project uses [API Extractor](https://api-extractor.com/) and [api-documenter markdown](https://api-extractor.com/pages/commands/api-documenter_markdown/) to generate a bunch of markdown files and a `.d.ts` rollup file containing all type definitions consolidated into a single file. I don't find this `.d.ts` rollup file particularly useful. On the other hand, the markdown files that api-documenter generates are quite handy when reviewing the public API of this project.\n\u003e\n\u003e *See [Generating API docs](https://api-extractor.com/pages/setup/generating_docs/) if you want to know more*.\n\n## Examples\n\nHere are some tables generated using a couple of Zod schemas exported by [fixtures/schemas.mjs](https://github.com/jackdbd/zod-to-doc/blob/main/fixtures/schemas.mjs).\n\n### Usage as a CLI\n\nZod to Doc can be used as a CLI. For example, if you run this command and have the correct placeholder in your document (see this `README.md` in raw mode):\n\n```sh\nztd --module ./fixtures/schemas.mjs \\\n  --schema car \\\n  --placeholder car-table \\\n  --title '#### Car table'\n```\n\nYou get this output:\n\n\u003c!-- BEGIN car-table --\u003e\n\u003c!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN ztd TO UPDATE --\u003e\n\n#### Car table\n\n| Key | Default | Description |\n|---|---|---|\n| `manufacturer` | `undefined` | Car manufacturer |\n| `model` | `undefined` | Car model |\n| `tires` | `undefined` | Array of 4 elements |\n| `year` | `undefined` | Year in which the car was manufactured |\n\u003c!-- END car-table --\u003e\n\n\u003c!-- Same example, but using [transclude](https://github.com/thi-ng/umbrella/tree/main/packages/transclude). --\u003e\n\n### Usage as a library\n\nZod to Doc can also be used as a library. For example, the [readme.ts](https://github.com/jackdbd/zod-to-doc/blob/main/readme.ts) file in this repository uses `markdownTableFromZodSchema` to replace a mustache-style placeholder with this markdown table:\n\n#### Car tire table\n\n| Key | Default | Description |\n|---|---|---|\n| `manufacturer` | `undefined` | Car tire manufacturer |\n| `pressure` | `30` | Car tire pressure in PSI |\n\n## Troubleshooting\n\nThis package uses the [debug](https://github.com/debug-js/debug) library for logging.\nYou can control what's logged using the `DEBUG` environment variable.\n\nFor example, if you set your environment variables in a `.envrc` file, you can do:\n\n```sh\n# print all logging statements\nexport DEBUG=ztd:*\n```\n\n## Dependencies\n\n| Package | Version |\n|---|---|\n| [ansi-colors](https://www.npmjs.com/package/ansi-colors) | `^4.1.3` |\n| [debug](https://www.npmjs.com/package/debug) | `^4.3.4` |\n| [yargs](https://www.npmjs.com/package/yargs) | `^17.7.2` |\n| [zod](https://www.npmjs.com/package/zod) | `^3.23.4` |\n\n## License\n\n\u0026copy; 2024 [Giacomo Debidda](https://www.giacomodebidda.com/) // [MIT License](https://spdx.org/licenses/MIT.html)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjackdbd%2Fzod-to-doc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjackdbd%2Fzod-to-doc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjackdbd%2Fzod-to-doc/lists"}