@openapi-qraft/cli 2.0.0-next.8 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +205 -0
- package/README.md +3 -2
- package/package.json +10 -10
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,210 @@
|
|
|
1
1
|
# @openapi-qraft/cli
|
|
2
2
|
|
|
3
|
+
## 2.0.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- 8c77eb2: Generate comprehensive operation names with consideration of the `--service-name-base` option. Operation names now
|
|
8
|
+
include all path parts and parameters, and the structure can be customized based on the `--service-name-base` value.
|
|
9
|
+
|
|
10
|
+
**Breaking Changes:**
|
|
11
|
+
|
|
12
|
+
- Operation names now include all path parts and parameters by default.
|
|
13
|
+
- `/api/v{api-version}` is no longer automatically removed from the path when generating operation names.
|
|
14
|
+
- The `--service-name-base` option now influences the generated operation names with a new structure.
|
|
15
|
+
|
|
16
|
+
**Examples:**
|
|
17
|
+
|
|
18
|
+
- With `--service-name-base=endpoint[0]`:
|
|
19
|
+
`POST /v1/users/{id}` → `api.v1.postUsersId`
|
|
20
|
+
- With `--service-name-base=endpoint[1]`:
|
|
21
|
+
`GET /v1/users/{id}` → `api.users.getId`
|
|
22
|
+
- With `--service-name-base=endpoint[1]`:
|
|
23
|
+
`POST /v1/users/suspend` → `api.users.postSuspend`
|
|
24
|
+
- With `--service-name-base=endpoint[1]`:
|
|
25
|
+
`POST /v1/users/{id}/{key}` → `api.postIdKey`
|
|
26
|
+
- With `--service-name-base=tags`:
|
|
27
|
+
`POST /v1/users/{id}/{key}` → `api.<tag>.postV1UsersIdKey`
|
|
28
|
+
|
|
29
|
+
This change provides more flexibility in operation name generation and allows for better customization based on project
|
|
30
|
+
requirements.
|
|
31
|
+
|
|
32
|
+
- 54fd011: Changed the exports from the schema file to include only the essential types: `$defs`, `paths`, `components`, `operations`, `webhooks`. This adjustment improves the development experience by preventing the export of all schema types, which could result in an excessive number of exported types, complicating development and reducing clarity.
|
|
33
|
+
|
|
34
|
+
### Minor Changes
|
|
35
|
+
|
|
36
|
+
- 2a53608: Updated TypeScript to version 5.5.4
|
|
37
|
+
- 76634bf: ### Changeset: `createPredefinedParametersRequestFn`
|
|
38
|
+
|
|
39
|
+
Introduced `createPredefinedParametersRequestFn`, generated by the `@openapi-qraft/cli` using
|
|
40
|
+
the `--operation-predefined-parameters` option.
|
|
41
|
+
This function allows for the automatic application of predefined
|
|
42
|
+
parameters to selected API operations by wrapping the base `requestFn`. It simplifies managing parameters, reducing
|
|
43
|
+
boilerplate code, and supports both static and dynamic values, enhancing flexibility in API request handling.
|
|
44
|
+
|
|
45
|
+
### Patch Changes
|
|
46
|
+
|
|
47
|
+
- 7ab718b: Enhanced the `--explicit-import-extensions` option to support `.ts` in addition to `.js`, making it easier for projects using TypeScript to explicitly specify import extensions.
|
|
48
|
+
- Updated dependencies [4ef9ce0]
|
|
49
|
+
- Updated dependencies [56687f3]
|
|
50
|
+
- Updated dependencies [8bbe14b]
|
|
51
|
+
- Updated dependencies [16b380f]
|
|
52
|
+
- Updated dependencies [7ab718b]
|
|
53
|
+
- Updated dependencies [8c77eb2]
|
|
54
|
+
- Updated dependencies [9dc1918]
|
|
55
|
+
- Updated dependencies [2a53608]
|
|
56
|
+
- Updated dependencies [cd3fe16]
|
|
57
|
+
- Updated dependencies [0b3cda1]
|
|
58
|
+
- Updated dependencies [76634bf]
|
|
59
|
+
- Updated dependencies [78638a5]
|
|
60
|
+
- Updated dependencies [5b64278]
|
|
61
|
+
- Updated dependencies [c111be6]
|
|
62
|
+
- Updated dependencies [7e51026]
|
|
63
|
+
- Updated dependencies [cd8a856]
|
|
64
|
+
- Updated dependencies [266611a]
|
|
65
|
+
- Updated dependencies [3ed94dc]
|
|
66
|
+
- Updated dependencies [62ff8e0]
|
|
67
|
+
- Updated dependencies [54fd011]
|
|
68
|
+
- Updated dependencies [fc6b4e7]
|
|
69
|
+
- Updated dependencies [34ff132]
|
|
70
|
+
- @openapi-qraft/tanstack-query-react-plugin@2.0.0
|
|
71
|
+
- @openapi-qraft/plugin@2.0.0
|
|
72
|
+
- @openapi-qraft/openapi-typescript-plugin@1.2.0
|
|
73
|
+
|
|
74
|
+
## 2.0.0-next.19
|
|
75
|
+
|
|
76
|
+
### Patch Changes
|
|
77
|
+
|
|
78
|
+
- Updated dependencies [62ff8e0]
|
|
79
|
+
- @openapi-qraft/tanstack-query-react-plugin@2.0.0-next.19
|
|
80
|
+
- @openapi-qraft/plugin@2.0.0-next.19
|
|
81
|
+
- @openapi-qraft/openapi-typescript-plugin@1.2.0-next.19
|
|
82
|
+
|
|
83
|
+
## 2.0.0-next.18
|
|
84
|
+
|
|
85
|
+
### Patch Changes
|
|
86
|
+
|
|
87
|
+
- @openapi-qraft/plugin@2.0.0-next.18
|
|
88
|
+
- @openapi-qraft/tanstack-query-react-plugin@2.0.0-next.18
|
|
89
|
+
- @openapi-qraft/openapi-typescript-plugin@1.2.0-next.18
|
|
90
|
+
|
|
91
|
+
## 2.0.0-next.17
|
|
92
|
+
|
|
93
|
+
### Patch Changes
|
|
94
|
+
|
|
95
|
+
- Updated dependencies [8bbe14b]
|
|
96
|
+
- Updated dependencies [16b380f]
|
|
97
|
+
- Updated dependencies [cd3fe16]
|
|
98
|
+
- @openapi-qraft/tanstack-query-react-plugin@2.0.0-next.17
|
|
99
|
+
- @openapi-qraft/plugin@2.0.0-next.17
|
|
100
|
+
- @openapi-qraft/openapi-typescript-plugin@1.2.0-next.17
|
|
101
|
+
|
|
102
|
+
## 2.0.0-next.16
|
|
103
|
+
|
|
104
|
+
### Patch Changes
|
|
105
|
+
|
|
106
|
+
- @openapi-qraft/plugin@2.0.0-next.16
|
|
107
|
+
- @openapi-qraft/tanstack-query-react-plugin@2.0.0-next.16
|
|
108
|
+
- @openapi-qraft/openapi-typescript-plugin@1.2.0-next.16
|
|
109
|
+
|
|
110
|
+
## 2.0.0-next.15
|
|
111
|
+
|
|
112
|
+
### Patch Changes
|
|
113
|
+
|
|
114
|
+
- Updated dependencies [4b1c13f]
|
|
115
|
+
- @openapi-qraft/openapi-typescript-plugin@1.2.0-next.15
|
|
116
|
+
- @openapi-qraft/plugin@2.0.0-next.15
|
|
117
|
+
- @openapi-qraft/tanstack-query-react-plugin@2.0.0-next.15
|
|
118
|
+
|
|
119
|
+
## 2.0.0-next.14
|
|
120
|
+
|
|
121
|
+
### Major Changes
|
|
122
|
+
|
|
123
|
+
- 54fd011: Changed the exports from the schema file to include only the essential types: `$defs`, `paths`, `components`, `operations`, `webhooks`. This adjustment improves the development experience by preventing the export of all schema types, which could result in an excessive number of exported types, complicating development and reducing clarity.
|
|
124
|
+
|
|
125
|
+
### Patch Changes
|
|
126
|
+
|
|
127
|
+
- 7ab718b: Enhanced the `--explicit-import-extensions` option to support `.ts` in addition to `.js`, making it easier for projects using TypeScript to explicitly specify import extensions.
|
|
128
|
+
- Updated dependencies [7ab718b]
|
|
129
|
+
- Updated dependencies [54fd011]
|
|
130
|
+
- Updated dependencies [34ff132]
|
|
131
|
+
- @openapi-qraft/tanstack-query-react-plugin@2.0.0-next.14
|
|
132
|
+
- @openapi-qraft/openapi-typescript-plugin@1.2.0-next.14
|
|
133
|
+
- @openapi-qraft/plugin@2.0.0-next.14
|
|
134
|
+
|
|
135
|
+
## 2.0.0-next.13
|
|
136
|
+
|
|
137
|
+
### Patch Changes
|
|
138
|
+
|
|
139
|
+
- Updated dependencies [c111be6]
|
|
140
|
+
- @openapi-qraft/plugin@2.0.0-next.13
|
|
141
|
+
- @openapi-qraft/openapi-typescript-plugin@1.2.0-next.13
|
|
142
|
+
- @openapi-qraft/tanstack-query-react-plugin@2.0.0-next.13
|
|
143
|
+
|
|
144
|
+
## 2.0.0-next.12
|
|
145
|
+
|
|
146
|
+
### Patch Changes
|
|
147
|
+
|
|
148
|
+
- @openapi-qraft/plugin@2.0.0-next.12
|
|
149
|
+
- @openapi-qraft/tanstack-query-react-plugin@2.0.0-next.12
|
|
150
|
+
- @openapi-qraft/openapi-typescript-plugin@1.2.0-next.12
|
|
151
|
+
|
|
152
|
+
## 2.0.0-next.11
|
|
153
|
+
|
|
154
|
+
### Patch Changes
|
|
155
|
+
|
|
156
|
+
- Updated dependencies [3ed94dc]
|
|
157
|
+
- @openapi-qraft/tanstack-query-react-plugin@2.0.0-next.11
|
|
158
|
+
- @openapi-qraft/plugin@2.0.0-next.11
|
|
159
|
+
- @openapi-qraft/openapi-typescript-plugin@1.2.0-next.11
|
|
160
|
+
|
|
161
|
+
## 2.0.0-next.10
|
|
162
|
+
|
|
163
|
+
### Major Changes
|
|
164
|
+
|
|
165
|
+
- 8c77eb2: Generate comprehensive operation names with consideration of the `--service-name-base` option. Operation names now
|
|
166
|
+
include all path parts and parameters, and the structure can be customized based on the `--service-name-base` value.
|
|
167
|
+
|
|
168
|
+
**Breaking Changes:**
|
|
169
|
+
|
|
170
|
+
- Operation names now include all path parts and parameters by default.
|
|
171
|
+
- `/api/v{api-version}` is no longer automatically removed from the path when generating operation names.
|
|
172
|
+
- The `--service-name-base` option now influences the generated operation names with a new structure.
|
|
173
|
+
|
|
174
|
+
**Examples:**
|
|
175
|
+
|
|
176
|
+
- With `--service-name-base=endpoint[0]`:
|
|
177
|
+
`POST /v1/users/{id}` → `api.v1.postUsersId`
|
|
178
|
+
- With `--service-name-base=endpoint[1]`:
|
|
179
|
+
`GET /v1/users/{id}` → `api.users.getId`
|
|
180
|
+
- With `--service-name-base=endpoint[1]`:
|
|
181
|
+
`POST /v1/users/suspend` → `api.users.postSuspend`
|
|
182
|
+
- With `--service-name-base=endpoint[1]`:
|
|
183
|
+
`POST /v1/users/{id}/{key}` → `api.postIdKey`
|
|
184
|
+
- With `--service-name-base=tags`:
|
|
185
|
+
`POST /v1/users/{id}/{key}` → `api.<tag>.postV1UsersIdKey`
|
|
186
|
+
|
|
187
|
+
This change provides more flexibility in operation name generation and allows for better customization based on project
|
|
188
|
+
requirements.
|
|
189
|
+
|
|
190
|
+
### Patch Changes
|
|
191
|
+
|
|
192
|
+
- Updated dependencies [8c77eb2]
|
|
193
|
+
- @openapi-qraft/plugin@2.0.0-next.10
|
|
194
|
+
- @openapi-qraft/openapi-typescript-plugin@1.2.0-next.10
|
|
195
|
+
- @openapi-qraft/tanstack-query-react-plugin@2.0.0-next.10
|
|
196
|
+
|
|
197
|
+
## 2.0.0-next.9
|
|
198
|
+
|
|
199
|
+
### Patch Changes
|
|
200
|
+
|
|
201
|
+
- Updated dependencies [4ef9ce0]
|
|
202
|
+
- Updated dependencies [9dc1918]
|
|
203
|
+
- Updated dependencies [78638a5]
|
|
204
|
+
- @openapi-qraft/tanstack-query-react-plugin@2.0.0-next.9
|
|
205
|
+
- @openapi-qraft/openapi-typescript-plugin@1.2.0-next.9
|
|
206
|
+
- @openapi-qraft/plugin@2.0.0-next.9
|
|
207
|
+
|
|
3
208
|
## 2.0.0-next.8
|
|
4
209
|
|
|
5
210
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -38,7 +38,7 @@ Options:
|
|
|
38
38
|
--service-name-base <endpoint[<index>] | tags> Use OpenAPI Operation `endpoint[<index>]` path part (e.g.: "/0/1/2") or `tags` as the base name of the service. (default: "endpoint[0]")
|
|
39
39
|
--file-header <string> Header to be added to the generated file (eg: /* eslint-disable */)
|
|
40
40
|
--openapi-types-import-path <path> Path to schema types file (.d.ts), eg: "../schema.d.ts"
|
|
41
|
-
--explicit-import-extensions
|
|
41
|
+
--explicit-import-extensions [extension] All import statements will contain an explicit file extension. Ideal for projects using ECMAScript modules. (choices: ".js", ".ts", preset: ".js")
|
|
42
42
|
--export-openapi-types [bool] Export the OpenAPI schema types from the generated `./index.ts` file (default: true)
|
|
43
43
|
--operation-generics-import-path <path> Path to operation generics file (default: "@openapi-qraft/react")
|
|
44
44
|
--openapi-types-file-name <path> OpenAPI Schema types file name, eg: "schema.d.ts" (default: "schema.ts")
|
|
@@ -145,7 +145,8 @@ npx openapi-qraft --plugin tanstack-query-react --plugin openapi-typescript http
|
|
|
145
145
|
- `--service-name-base tags` will generate services based on the OpenAPI Operation tags instead of the endpoint.
|
|
146
146
|
- If multiple tags are present for the operation, similar services will be created for each tag. Operation with `tags: [Foo, Bar]` will generate `services/FooService.ts` and `services/BarService.ts`.
|
|
147
147
|
- If there are no tags for the operation, the services will be created under the `default` tag. Operation with empty `tags: []` will generate `services/DefaultService.ts`.
|
|
148
|
-
- **`--explicit-import-extensions
|
|
148
|
+
- **`--explicit-import-extensions [extension]`**: All import statements will contain an explicit file extension. Ideal for projects using ECMAScript modules
|
|
149
|
+
when TypeScript's _--moduleResolution_ is `node16` or `nodenext`. Choices: `.js`, `.ts`, preset: `.js`. _(optional)_
|
|
149
150
|
- **`--file-header <string>`:** Add a custom header to each generated file, useful for disabling linting rules or adding file
|
|
150
151
|
comments _(optional)_.
|
|
151
152
|
- Example: `--file-header '/* eslint-disable */'`
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openapi-qraft/cli",
|
|
3
|
-
"version": "2.0.0
|
|
4
|
-
"description": "CLI for generating typed
|
|
3
|
+
"version": "2.0.0",
|
|
4
|
+
"description": "CLI for generating typed TanStack Query React Hooks and services from OpenAPI Document, improving type safety in React apps",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "tsc --project tsconfig.build.json",
|
|
7
7
|
"dev": "yarn build --watch --noEmitOnError false",
|
|
@@ -15,19 +15,19 @@
|
|
|
15
15
|
"openapi-qraft": "./bin.mjs"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@openapi-qraft/openapi-typescript-plugin": "1.2.0
|
|
19
|
-
"@openapi-qraft/plugin": "2.0.0
|
|
20
|
-
"@openapi-qraft/tanstack-query-react-plugin": "2.0.0
|
|
18
|
+
"@openapi-qraft/openapi-typescript-plugin": "1.2.0",
|
|
19
|
+
"@openapi-qraft/plugin": "2.0.0",
|
|
20
|
+
"@openapi-qraft/tanstack-query-react-plugin": "2.0.0",
|
|
21
21
|
"commander": "^11.1.0"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
24
|
"@openapi-qraft/eslint-config": "1.0.0",
|
|
25
|
-
"@types/node": "^
|
|
26
|
-
"eslint": "^9.
|
|
27
|
-
"globals": "^15.
|
|
25
|
+
"@types/node": "^20.16.5",
|
|
26
|
+
"eslint": "^9.16.0",
|
|
27
|
+
"globals": "^15.9.0",
|
|
28
28
|
"rimraf": "^5.0.10",
|
|
29
|
-
"typescript": "^5.
|
|
30
|
-
"vitest": "^1.
|
|
29
|
+
"typescript": "^5.6.2",
|
|
30
|
+
"vitest": "^2.1.8"
|
|
31
31
|
},
|
|
32
32
|
"files": [
|
|
33
33
|
"dist",
|