Skip to content

Commit 725ddc8

Browse files
committed
feat!: changing openapi generator
Changed openapi code generator to @hey-api/openapi-ts. Not supporting all properties yet. Supporting new properties: - base - serviceResponse - enums - useDateType indent and useUnionTypes properties were removed left in for backwards compatibility. BREAKING CHANGE: changed from cjs to mjs
1 parent 4c01176 commit 725ddc8

File tree

13 files changed

+857
-681
lines changed

13 files changed

+857
-681
lines changed

README.md

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,24 @@ Options:
4545
-i, --input <value> OpenAPI specification, can be a path, url or string content (required)
4646
-o, --output <value> Output directory (default: "openapi")
4747
-c, --client <value> HTTP client to generate [fetch, xhr, node, axios, angular] (default: "fetch")
48-
--useUnionTypes Use union types (default: false)
48+
--useUnionTypes Unused, will be removed in the next major version
4949
--exportSchemas <value> Write schemas to disk (default: false)
50-
--indent <value> Indentation options [4, 2, tabs] (default: "4")
50+
--indent <value> Unused, will be removed in the next major version
5151
--postfixServices <value> Service name postfix (default: "Service")
5252
--postfixModels <value> Modal name postfix
5353
--request <value> Path to custom request file
54+
--write <value> Write the files to disk (true or false)
55+
--useDateType Use Date type instead of string for date types for models, this will not convert the data to a Date object
56+
--enums Generate JavaScript objects from enum definitions?
57+
--base <value> Manually set base in OpenAPI config instead of inferring from server value
58+
--serviceResponse <value> Define shape of returned value from service calls ['body', 'generics', 'response']
59+
--operationId Use operation ID to generate operation names?
60+
--lint Process output folder with linter?
61+
--name Custom client class name
62+
--format Process output folder with formatter?
63+
--exportCore <value> Export core types
64+
--exportModels <value> Export models
65+
--exportServices <value> Export services
5466
-h, --help display help for command
5567
```
5668

examples/react-app/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"dev:mock": "prism mock ./petstore.yaml --dynamic",
1010
"build": "tsc && vite build",
1111
"preview": "vite preview",
12-
"generate:api": "node ../../dist/src/cli.js -i ./petstore.yaml -c axios --exportSchemas=true --postfixServices=Client --request ./request.ts",
12+
"generate:api": "node ../../dist/cli.js -i ./petstore.yaml -c axios --postfixServices=Client --request ./request.ts",
1313
"test:generated": "tsc ./openapi/queries/index.ts --noEmit --target esnext --moduleResolution node"
1414
},
1515
"dependencies": {

package.json

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@
33
"version": "0.5.3",
44
"description": "OpenAPI React Query Codegen",
55
"bin": {
6-
"openapi-rq": "dist/src/cli.js"
6+
"openapi-rq": "dist/cli.js"
77
},
8+
"type": "module",
89
"scripts": {
910
"build": "tsc -p tsconfig.json",
1011
"preview": "npm run build && npm -C examples/react-app run generate:api",
@@ -27,21 +28,22 @@
2728
"openapi",
2829
"swagger",
2930
"typescript",
30-
"openapi-typescript-codegen"
31+
"openapi-typescript-codegen",
32+
"@hey-api/openapi-ts"
3133
],
3234
"author": "Daiki Urata (@7nohe)",
3335
"license": "MIT",
3436
"devDependencies": {
37+
"@hey-api/openapi-ts": "0.27.38",
3538
"@types/node": "^20.10.6",
3639
"commander": "^12.0.0",
3740
"glob": "^10.3.10",
38-
"openapi-typescript-codegen": "0.25.0",
3941
"typescript": "^5.3.3"
4042
},
4143
"peerDependencies": {
44+
"@hey-api/openapi-ts": "0.27.38",
4245
"commander": ">= 11 < 13",
4346
"glob": ">= 10",
44-
"openapi-typescript-codegen": "^0.24.0",
4547
"typescript": ">= 4.8.3"
4648
}
4749
}

0 commit comments

Comments
 (0)