You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Alternatively, you can use `openapi-ts.config.js` and configure the export statement depending on your project setup.
40
40
41
-
<!--
42
-
TODO: uncomment after c12 supports multiple configs
43
-
see https://github.com/unjs/c12/issues/92
44
-
-->
45
-
<!-- ### Multiple Clients
46
-
47
-
If you want to generate multiple clients with a single `openapi-ts` command, you can provide an array of configuration objects.
48
-
49
-
```js
50
-
import { defineConfig } from '@hey-api/openapi-ts';
51
-
52
-
export default defineConfig([
53
-
{
54
-
input: 'path/to/openapi_one.json',
55
-
output: 'src/client_one',
56
-
plugins: ['legacy/fetch'],
57
-
},
58
-
{
59
-
input: 'path/to/openapi_two.json',
60
-
output: 'src/client_two',
61
-
plugins: ['legacy/axios'],
62
-
},
63
-
])
64
-
``` -->
65
-
66
41
## Input
67
42
68
43
You must provide an input so we can load your OpenAPI specification.
@@ -163,6 +138,108 @@ Plugins are responsible for generating artifacts from your input. By default, He
163
138
164
139
You can learn more on the [Output](/openapi-ts/output) page.
165
140
141
+
## Advanced
142
+
143
+
More complex configuration scenarios can be handled by providing an array of inputs, outputs, or configurations.
144
+
145
+
### Multiple jobs
146
+
147
+
Throughout this documentation, we generally reference single job configurations. However, you can easily run multiple jobs by providing an array of configuration objects.
148
+
149
+
::: code-group
150
+
151
+
```js [config]
152
+
exportdefault [
153
+
{
154
+
input:'foo.yaml',
155
+
output:'src/foo',
156
+
},
157
+
{
158
+
input:'bar.yaml',
159
+
output:'src/bar',
160
+
},
161
+
];
162
+
```
163
+
164
+
```md [example]
165
+
src/
166
+
├── foo/
167
+
│ ├── client/
168
+
│ ├── core/
169
+
│ ├── client.gen.ts
170
+
│ ├── index.ts
171
+
│ ├── sdk.gen.ts
172
+
│ └── types.gen.ts
173
+
└── bar/
174
+
├── client/
175
+
├── core/
176
+
├── client.gen.ts
177
+
├── index.ts
178
+
├── sdk.gen.ts
179
+
└── types.gen.ts
180
+
```
181
+
182
+
:::
183
+
184
+
### Job matrix
185
+
186
+
Reusing configuration across multiple jobs is possible by defining a job matrix. You can create a job matrix by providing `input` and `output` arrays of matching length.
187
+
188
+
::: code-group
189
+
190
+
```js [config]
191
+
exportdefault {
192
+
input: ['foo.yaml', 'bar.yaml'],
193
+
output: ['src/foo', 'src/bar'],
194
+
};
195
+
```
196
+
197
+
```md [example]
198
+
src/
199
+
├── foo/
200
+
│ ├── client/
201
+
│ ├── core/
202
+
│ ├── client.gen.ts
203
+
│ ├── index.ts
204
+
│ ├── sdk.gen.ts
205
+
│ └── types.gen.ts
206
+
└── bar/
207
+
├── client/
208
+
├── core/
209
+
├── client.gen.ts
210
+
├── index.ts
211
+
├── sdk.gen.ts
212
+
└── types.gen.ts
213
+
```
214
+
215
+
:::
216
+
217
+
### Merging inputs
218
+
219
+
You can merge inputs by defining multiple inputs and a single output.
220
+
221
+
::: code-group
222
+
223
+
```js [config]
224
+
exportdefault {
225
+
input: ['foo.yaml', 'bar.yaml'],
226
+
output:'src/client',
227
+
};
228
+
```
229
+
230
+
```md [example]
231
+
src/
232
+
└── client/
233
+
├── client/
234
+
├── core/
235
+
├── client.gen.ts
236
+
├── index.ts
237
+
├── sdk.gen.ts
238
+
└── types.gen.ts
239
+
```
240
+
241
+
:::
242
+
166
243
## API
167
244
168
245
You can view the complete list of options in the [UserConfig](https://github.com/hey-api/openapi-ts/blob/main/packages/openapi-ts/src/types/config.d.ts) interface.
Copy file name to clipboardExpand all lines: docs/openapi-ts/configuration/input.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -54,6 +54,8 @@ export default {
54
54
55
55
:::
56
56
57
+
You can learn more about complex use cases in the [Advanced](/openapi-ts/configuration#advanced) section.
58
+
57
59
::: info
58
60
If you use an HTTPS URL with a self-signed certificate in development, you will need to set [`NODE_TLS_REJECT_UNAUTHORIZED=0`](https://github.com/hey-api/openapi-ts/issues/276#issuecomment-2043143501) in your environment.
0 commit comments