Gathering detailed insights and metrics for @povio/openapi-codegen-cli
Gathering detailed insights and metrics for @povio/openapi-codegen-cli
Gathering detailed insights and metrics for @povio/openapi-codegen-cli
Gathering detailed insights and metrics for @povio/openapi-codegen-cli
npm install @povio/openapi-codegen-cli
Typescript
Module System
Min. Node Version
Node Version
NPM Version
TypeScript (94.8%)
Handlebars (4.66%)
JavaScript (0.4%)
Shell (0.15%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
1 Stars
174 Commits
2 Watchers
2 Branches
38 Contributors
Updated on Jul 11, 2025
Latest Version
0.12.0
Package Id
@povio/openapi-codegen-cli@0.12.0
Unpacked Size
1.08 MB
Size
318.11 kB
File Count
113
NPM Version
10.8.2
Node Version
20.19.3
Published on
Jul 11, 2025
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
24
NOTE: This CLI tool is primarily designed for use within our organization. The generated code output aligns with our internal template. If you are using this tool without our internal template, make sure to use it in standalone mode.
Use this tool to generate code (Zod schemas, TypeScript types, API definitions, and React queries) from an OpenAPI v3 specification. API definitions are generated to use a REST client wrapper that utilizes Axios. 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.
1yarn add @povio/openapi-codegen-cli
1yarn openapi-codegen generate --input http://localhost:3001/docs-json
1yarn openapi-codegen generate --input http://localhost:3001/docs-json --standalone
1 --input Path/URL to OpenAPI JSON/YAML document 2 --output Output directory path (default: 'output') 3 --prettier Format the generated code using Prettier (default: true) 4 --verbose Display detailed log messages during execution (default: false) 5 6 --splitByTags Organize output into separate folders based on OpenAPI operation tags (default: true) 7 --defaultTag (Requires `--splitByTags`) Default tag for shared code across multiple tags (default: 'Common') 8 9 --excludeTags Comma-separated list of tags to exclude from generation 10 --excludePathRegex Exclude operations whose paths match the given regular expression 11 --excludeRedundantZodSchemas Exclude any redundant Zod schemas (default: true) 12 13 --tsNamespaces Wrap generated files in TypeScript namespaces (default: true) 14 --importPath Module import style for generated files (default: 'ts'; options: 'ts' | 'relative' | 'absolute') 15 --removeOperationPrefixEndingWith Remove operation name prefixes that end with the specified string (Default: 'Controller_') 16 --extractEnums Extract enums into separate Zod schemas (default: true) 17 --replaceOptionalWithNullish Replace `.optional()` chains with `.nullish()` in generated Zod schemas (default: false) 18 19 --axiosRequestConfig Include Axios request config parameters in query hooks (default: false) 20 --infiniteQueries Generate infinite queries for paginated API endpoints (default: false) 21 --mutationEffects Add mutation effects options to mutation hooks (default: true) 22 --parseRequestParams Add Zod parsing to API endpoints (default: false) 23 24 --standalone Generate any missing supporting classes/types, e.g., REST client class, React Query type extensions, etc. (default: false) 25 --baseUrl (Requires `--standalone`) Base URL for the REST client; falls back to the OpenAPI spec if not provided 26 27 # Command args designed specifically for use within our organization 28 --monorepo Configure output structure and imports adjusted for monorepo architecture
1 --input Path/URL to OpenAPI/Swagger document as JSON/YAML 2 --verbose Show log messages during execution 3 4 --splitByTags Organize output into separate folders based on OpenAPI operation tags (default: true) 5 --defaultTag (Requires `--splitByTags`) Default tag for shared code across multiple tags (default: 'Common') 6 7 --excludeTags Comma-separated list of tags to exclude from generation 8 --excludePathRegex Exclude operations whose paths match the given regular expression 9 --excludeRedundantZodSchemas Exclude any redundant Zod schemas (default: true)
1# prerequisites 2corepack install 3yarn 4 5# run tests 6yarn test 7 8# run sources with tsx 9yarn start --help 10yarn start generate --input ./test/petstore.yaml --verbose 11 12# build new version 13yarn build 14 15# test build 16yarn start --help 17yarn start:dist generate --input ./test/petstore.yaml --verbose
If you're using Enums in your backend DTOs with @Expose()
and @IsEnum
, they may still not appear correctly in the OpenAPI schema unless you also provide both enum
and enumName
to @ApiProperty
.
1enum Status { 2 ACTIVE = "active", 3 INACTIVE = "inactive", 4} 5 6export class ExampleDto { 7 @ApiProperty({ enum: Status, enumName: "Status" }) 8 @Expose() 9 @IsEnum(Status) 10 status: Status; 11}
1enum Status { 2 ACTIVE = "active", 3 INACTIVE = "inactive", 4} 5 6export class ExampleDto { 7 @ApiProperty({ enum: Status, enumName: "Status", isArray: true }) 8 @Expose() 9 @IsEnum(Status, { each: true }) 10 @IsArray() 11 status: Status[]; 12}
When using nested DTOs, ensure you explicitly specify the type using @ApiProperty({ type: NestedDto })
:
1export class NestedDto { 2 @ApiProperty() 3 @Expose() 4 name: string; 5} 6 7export class ParentDto { 8 @ApiProperty({ type: NestedDto }) 9 @Expose() 10 @ValidateNested() 11 @Type(() => NestedDto) 12 @IsObject() 13 nested: NestedDto; 14}
1export class NestedDto { 2 @ApiProperty() 3 @Expose() 4 name: string; 5} 6 7export class ParentDto { 8 @ApiProperty({ type: NestedDto, isArray: true }) 9 @Expose() 10 @ValidateNested({ each: true }) 11 @Type(() => NestedDto) 12 @IsArray() 13 nestedList: NestedDto[]; 14}
No vulnerabilities found.
No security vulnerabilities found.