Zod to OpenAPI
TypeScript library that generates OpenAPI (Swagger) documentation from Zod schemas and route definitions.
Zod to OpenAPI reads the Zod schemas and route definitions of a TypeScript API and writes an OpenAPI document from them, so the schemas that validate requests also describe them. Schemas are named with an openapi method that Zod objects gain once the library extends Zod, and a registry collects named schemas, parameters and paths. A generator turns the registry into the components section or a full document for OpenAPI 3.0, 3.1 or 3.2. The README shows a script in the build step that writes the document to a file such as openapi-docs.json.
Worth knowing
For Zod 3 schemas, the README points to an older release line that its maintainers say they do not intend to support going forward. Calling z.nullable() on a registered schema does not produce a reference to it; the README suggests the schema’s own .nullable() method instead. Schemas of types the library does not support raise an error unless the type is given by hand through the openapi method.
Identity
Rendering and deploy
- Install with
- npm4
Releases
Adoption
Sources
- 2026-11-17: links, Written in, License, GitHub stars
api.github.com/repos/asteasolutions/zod-to-openapi - 2026-11-17: Maintainer, Headquarters
asteasolutions.com/privacy/ - 2026-11-17: First release
registry.npmjs.org/@asteasolutions/zod-to-openapi - 2026-11-17: Categories, Built on, Install with
github.com/asteasolutions/zod-to-openapi/blob/master/README.md - 2026-11-17: License model
github.com/asteasolutions/zod-to-openapi/blob/master/LICENSE - 2026-11-17: Current major version, Last release
github.com/asteasolutions/zod-to-openapi/releases/tag/v9.1.0 - 2026-11-17: npm downloads a week
api.npmjs.org/downloads/range/2026-11-01:2026-11-07/@asteasolutions/zod-to-openapi - 2026-11-17: Contributors
api.github.com/repos/asteasolutions/zod-to-openapi/contributors?per_page=1 - 2026-11-17: Dependent packages, Dependent repositories
packages.ecosyste.ms/api/v1/registries/npmjs.org/packages/@asteasolutions/zod-to-openapi