@openapi-qraft/cli 1.11.0-beta.5 → 1.12.0-beta.1
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 +19 -0
- package/README.md +30 -0
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# @openapi-qraft/cli
|
|
2
2
|
|
|
3
|
+
## 1.12.0-beta.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- @openapi-qraft/plugin@1.12.0-beta.1
|
|
8
|
+
- @openapi-qraft/tanstack-query-react-plugin@1.12.0-beta.1
|
|
9
|
+
- @openapi-qraft/openapi-typescript-plugin@1.0.5-beta.1
|
|
10
|
+
|
|
11
|
+
## 1.12.0-beta.0
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- Updated dependencies [d4bc3af]
|
|
16
|
+
- Updated dependencies [3d2dd60]
|
|
17
|
+
- Updated dependencies [9cd9909]
|
|
18
|
+
- @openapi-qraft/plugin@1.12.0-beta.0
|
|
19
|
+
- @openapi-qraft/tanstack-query-react-plugin@1.12.0-beta.0
|
|
20
|
+
- @openapi-qraft/openapi-typescript-plugin@1.0.5-beta.0
|
|
21
|
+
|
|
3
22
|
## 1.11.0-beta.5
|
|
4
23
|
|
|
5
24
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -31,6 +31,8 @@ Options:
|
|
|
31
31
|
-rm, --clean Clean output directory before generating services
|
|
32
32
|
--filter-services <glob-pattern> Filter services to be generated by glob pattern. Eg: "/user/**,/post/**". See NPM `micromatch` package for more
|
|
33
33
|
details.
|
|
34
|
+
--operation-predefined-parameters <patterns...> Predefined parameters for services. The specified services parameters will be optional. Eg:
|
|
35
|
+
"/**:header.x-monite-version,query.x-api-key.;/user/**,/post/**:header.x-monite-entity-id"
|
|
34
36
|
--postfix-services <string> Postfix to be added to the generated service name (eg: Service)
|
|
35
37
|
--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.
|
|
36
38
|
(default: "endpoint[0]")
|
|
@@ -66,6 +68,8 @@ npx openapi-qraft --plugin tanstack-query-react --plugin openapi-typescript http
|
|
|
66
68
|
--output-dir src/api
|
|
67
69
|
```
|
|
68
70
|
|
|
71
|
+
## Options
|
|
72
|
+
|
|
69
73
|
### Required
|
|
70
74
|
|
|
71
75
|
- **`-o <path>, --output-dir <path>`:** Specify where to output the generated services.
|
|
@@ -79,6 +83,32 @@ npx openapi-qraft --plugin tanstack-query-react --plugin openapi-typescript http
|
|
|
79
83
|
- Examples:
|
|
80
84
|
- `--filter-services '/user/**,/post/**'` - include only API endpoints that start with `/user/` or `/post/`
|
|
81
85
|
- `--filter-services '**,!/internal/**'` - include _all_ API endpoints _except_ those that start with `/internal/`
|
|
86
|
+
- **`--operation-predefined-parameters <patterns...> `:** Predefined parameters for services. The specified services parameters will be optional. _(optional)_
|
|
87
|
+
|
|
88
|
+
This most wanted option 💎 allows you to **set default parameters** across multiple endpoints. However, if an endpoint doesn't contain a parameter specified in this option, an error will be displayed. For example:
|
|
89
|
+
|
|
90
|
+
```text
|
|
91
|
+
⚠ Missing predefined parameter 'header' 'x-monite-version' in 'post /files' in '/**'
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
To resolve such errors, you can exclude specific endpoints from the predefined parameters using the negation syntax in the glob pattern, like:
|
|
95
|
+
|
|
96
|
+
```
|
|
97
|
+
--operation-predefined-parameters '/**,!/files:header.x-monite-version'
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
- Examples:
|
|
101
|
+
|
|
102
|
+
- `--operation-predefined-parameters '/**:header.x-monite-version'` - set `header.x-monite-version`
|
|
103
|
+
as optional parameters for all services.
|
|
104
|
+
- `--operation-predefined-parameters '/**,!/auth/token:header.x-entity-id'` - set `header.x-entity-id` as optional parameters for all services except `/auth/token`.
|
|
105
|
+
- `--operation-predefined-parameters '/**:header.x-monite-version,query.x-api-key' '/user/**,/post/**:header.x-monite-entity-id'` -
|
|
106
|
+
set `header.x-monite-version` and `query.x-api-key` as optional parameters for all services, and `header.x-monite-entity-id` for the `/user/**` and `/post/**` services.
|
|
107
|
+
|
|
108
|
+
> **Note:** In future versions of the library, this feature will be expanded. Not only will it make parameters optional,
|
|
109
|
+
> but it will also offer typed suggestions for these predefined parameters when creating a client. This enhancement will
|
|
110
|
+
> further improve type safety and developer experience.
|
|
111
|
+
|
|
82
112
|
- **`--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. _(optional, default: `endpoint[0]`)_.
|
|
83
113
|
- Examples:
|
|
84
114
|
- `--service-name-base endpoint[0]` generates `services/FooService.ts` for the endpoint `/foo/bar/baz`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openapi-qraft/cli",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.12.0-beta.1",
|
|
4
4
|
"description": "CLI for generating typed Tanstack Query React Hooks and services from OpenAPI Schemas, improving type safety in React apps",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "tsc --project tsconfig.build.json",
|
|
@@ -15,13 +15,13 @@
|
|
|
15
15
|
"openapi-qraft": "./bin.mjs"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@openapi-qraft/openapi-typescript-plugin": "
|
|
19
|
-
"@openapi-qraft/plugin": "
|
|
20
|
-
"@openapi-qraft/tanstack-query-react-plugin": "
|
|
18
|
+
"@openapi-qraft/openapi-typescript-plugin": "1.0.5-beta.1",
|
|
19
|
+
"@openapi-qraft/plugin": "1.12.0-beta.1",
|
|
20
|
+
"@openapi-qraft/tanstack-query-react-plugin": "1.12.0-beta.1",
|
|
21
21
|
"commander": "^11.1.0"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
|
-
"@openapi-qraft/eslint-config": "
|
|
24
|
+
"@openapi-qraft/eslint-config": "1.0.0",
|
|
25
25
|
"@types/node": "^18.19.4",
|
|
26
26
|
"eslint": "^9.0.0",
|
|
27
27
|
"globals": "^15.0.0",
|