0.0.10 • Published 9 months ago

@povio/openapi-codegen-cli v0.0.10

Weekly downloads
-
License
BSD-3-Clause
Repository
github
Last release
9 months ago

OpenAPI code generation CLI

NOTE: This CLI tool is specifically designed for custom usage within our organization. The generated code output is in alignment with our internal templates.

Use this tool to generate code (Zod schemas, API definitions and React queries) from OpenAPI v3 specification. API definitions are customized to fit the REST client wrapper used in our Next.js template. React queries are generated in alignment with our code standards, without the need for explicit types.

The tool partially leverages code from openapi-zod-client repository.

Setup

yarn add @povio/openapi-codegen-cli

Example

yarn openapi-codegen generate --input http://localhost:3001/docs-json

Options

Generate command

  --input <path>            Path/url to OpenAPI/Swagger document as json/yaml
  --output <path>           Output path (default: 'output')
  --includeNamespaces       Include namespaces inside generated files (default: true)
  --splitByTags             Split output into directories based on tags in OpenAPI operations (default: true)
  --defaultTag              Default tag name for code shared accross multiple tags (default: 'Common')
  --excludeTags             Comma separated list of tags excluded from the output
  --prettier                Run prettier command on output after code generation (default: true)
  --verbose                 Show log messages during execution

Development

Test locally

# prerequisites
corepack install
yarn

# run tests
yarn test

# run sources with tsx
yarn start --help
yarn start generate --input ./test/petstore.yaml --verbose

# build new version
yarn build

# test build
yarn start --help
yarn start:dist generate --input ./test/petstore.yaml --verbose
0.0.10

9 months ago

0.0.9

9 months ago