@hey-api/openapi-ts 0.62.3 → 0.63.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/README.md +7 -7
- package/bin/index.cjs +8 -1
- package/dist/index.cjs +179 -179
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +164 -46
- package/dist/index.d.ts +164 -46
- package/dist/index.js +180 -180
- package/dist/index.js.map +1 -1
- package/package.json +8 -4
package/README.md
CHANGED
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
- supports OpenAPI 2.0, 3.0, and 3.1 specifications
|
|
35
35
|
- supports JSON and YAML input files
|
|
36
36
|
- generates TypeScript interfaces and SDKs
|
|
37
|
-
- Fetch API, Axios, Angular, Node.js, and XHR clients available
|
|
37
|
+
- Fetch API, Axios, Nuxt, Angular, Node.js, and XHR clients available
|
|
38
38
|
- plugin ecosystem to reduce third-party boilerplate
|
|
39
39
|
|
|
40
40
|
## Sponsors
|
|
@@ -57,9 +57,9 @@ The fastest way to use `@hey-api/openapi-ts` is via npx
|
|
|
57
57
|
|
|
58
58
|
```sh
|
|
59
59
|
npx @hey-api/openapi-ts \
|
|
60
|
-
-c @hey-api/client-fetch \
|
|
61
60
|
-i path/to/openapi.json \
|
|
62
61
|
-o src/client \
|
|
62
|
+
-c @hey-api/client-fetch
|
|
63
63
|
```
|
|
64
64
|
|
|
65
65
|
Congratulations on creating your first client! 🎉 You can learn more about the generated files on the [Output](https://heyapi.dev/openapi-ts/output) page.
|
|
@@ -114,9 +114,9 @@ You can also generate clients programmatically by importing `@hey-api/openapi-ts
|
|
|
114
114
|
import { createClient } from '@hey-api/openapi-ts';
|
|
115
115
|
|
|
116
116
|
createClient({
|
|
117
|
-
client: '@hey-api/client-fetch',
|
|
118
117
|
input: 'path/to/openapi.json',
|
|
119
118
|
output: 'src/client',
|
|
119
|
+
plugins: ['@hey-api/client-fetch'],
|
|
120
120
|
});
|
|
121
121
|
```
|
|
122
122
|
|
|
@@ -130,9 +130,9 @@ createClient({
|
|
|
130
130
|
import { defineConfig } from '@hey-api/openapi-ts';
|
|
131
131
|
|
|
132
132
|
export default defineConfig({
|
|
133
|
-
client: '@hey-api/client-fetch',
|
|
134
133
|
input: 'path/to/openapi.json',
|
|
135
134
|
output: 'src/client',
|
|
135
|
+
plugins: ['@hey-api/client-fetch'],
|
|
136
136
|
});
|
|
137
137
|
```
|
|
138
138
|
|
|
@@ -141,9 +141,9 @@ export default defineConfig({
|
|
|
141
141
|
```js
|
|
142
142
|
/** @type {import('@hey-api/openapi-ts').UserConfig} */
|
|
143
143
|
module.exports = {
|
|
144
|
-
client: '@hey-api/client-fetch',
|
|
145
144
|
input: 'path/to/openapi.json',
|
|
146
145
|
output: 'src/client',
|
|
146
|
+
plugins: ['@hey-api/client-fetch'],
|
|
147
147
|
};
|
|
148
148
|
```
|
|
149
149
|
|
|
@@ -152,9 +152,9 @@ module.exports = {
|
|
|
152
152
|
```js
|
|
153
153
|
/** @type {import('@hey-api/openapi-ts').UserConfig} */
|
|
154
154
|
export default {
|
|
155
|
-
client: '@hey-api/client-fetch',
|
|
156
155
|
input: 'path/to/openapi.json',
|
|
157
156
|
output: 'src/client',
|
|
157
|
+
plugins: ['@hey-api/client-fetch'],
|
|
158
158
|
};
|
|
159
159
|
```
|
|
160
160
|
|
|
@@ -174,7 +174,7 @@ Output is the next thing to define. It can be either a string pointing to the de
|
|
|
174
174
|
|
|
175
175
|
### Client
|
|
176
176
|
|
|
177
|
-
Clients are responsible for sending the actual HTTP requests.
|
|
177
|
+
Clients are responsible for sending the actual HTTP requests. Using clients is not required, but you must add a client to `plugins` if you're generating SDKs (enabled by default).
|
|
178
178
|
|
|
179
179
|
You can learn more on the [Clients](https://heyapi.dev/openapi-ts/clients) page.
|
|
180
180
|
|
package/bin/index.cjs
CHANGED
|
@@ -13,7 +13,7 @@ const params = program
|
|
|
13
13
|
.version(pkg.version)
|
|
14
14
|
.option(
|
|
15
15
|
'-c, --client <value>',
|
|
16
|
-
'HTTP client to generate [@hey-api/client-axios, @hey-api/client-fetch, legacy/angular, legacy/axios, legacy/fetch, legacy/node, legacy/xhr]',
|
|
16
|
+
'HTTP client to generate [@hey-api/client-axios, @hey-api/client-fetch, @hey-api/client-next, @hey-api/client-nuxt, legacy/angular, legacy/axios, legacy/fetch, legacy/node, legacy/xhr]',
|
|
17
17
|
)
|
|
18
18
|
.option('-d, --debug', 'Set log level to debug')
|
|
19
19
|
.option('--dry-run [value]', 'Skip writing files to disk?')
|
|
@@ -92,6 +92,13 @@ async function start() {
|
|
|
92
92
|
userConfig.plugins = [];
|
|
93
93
|
} else if (params.plugins) {
|
|
94
94
|
userConfig.plugins = params.plugins;
|
|
95
|
+
} else if (userConfig.client) {
|
|
96
|
+
userConfig.plugins = ['@hey-api/typescript', '@hey-api/sdk'];
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
if (userConfig.client) {
|
|
100
|
+
userConfig.plugins.push(userConfig.client);
|
|
101
|
+
delete userConfig.client;
|
|
95
102
|
}
|
|
96
103
|
|
|
97
104
|
userConfig.logs = userConfig.logs
|