@creator.co/open-api-zod-comment-parser
v1.0.12
Published
A tool to generate OpenAPI specifications from Zod schemas in TypeScript files.
Downloads
9
Readme
OpenAPI Schema Generator
A tool to generate OpenAPI specifications from Zod schemas in TypeScript files.
Installation
You don't need to install the package globally. You can use npx
to run the command directly.
Usage
To generate OpenAPI specifications, run:
npx openapi-schema-generator
This command will:
- Recursively find all
types.ts
files in thesrc
directory. - Extract Zod schemas from these files.
- Generate OpenAPI components and save them to
./docs/types.yaml
. - Parse OpenAPI comments from your codebase and save the full OpenAPI spec to
./docs/api.yaml
.
Requirements
Ensure your project meets the following requirements:
- TypeScript files containing Zod schemas named
types.ts
. - An
.openapirc.js
configuration file in the project root.
Configuration
The .openapirc.js
file should export your OpenAPI configuration for openapi-comment-parser
package.