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
Copy file name to clipboardExpand all lines: docs/openapi-ts/configuration/output.md
+62-59Lines changed: 62 additions & 59 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -36,7 +36,11 @@ export default {
36
36
37
37
You can learn more about complex use cases in the [Advanced](/openapi-ts/configuration#advanced) section.
38
38
39
-
## File Name
39
+
## File
40
+
41
+
Control how files are named and annotated in the generated output.
42
+
43
+
### File Name
40
44
41
45
You can customize the naming and casing pattern for files using the `fileName` option.
42
46
@@ -108,66 +112,95 @@ export default {
108
112
109
113
:::
110
114
111
-
##Module Extension
115
+
### File Header
112
116
113
-
You can customize the extension used for TypeScript modules.
117
+
The generated output includes a notice in every file warning that any modifications will be lost when the files are regenerated. You can customize or disable this notice using the `header` option.
114
118
115
119
::: code-group
116
120
117
-
```js [default]
118
-
exportdefault {
119
-
input:'hey-api/backend', // sign up at app.heyapi.dev
120
-
output: {
121
-
importFileExtension:undefined, // [!code ++]
122
-
path:'src/client',
123
-
},
124
-
};
121
+
```js [example]
122
+
/* eslint-disable */
123
+
// This file is auto-generated by @hey-api/openapi-ts
124
+
125
+
/** ... */
125
126
```
126
127
127
-
```js [disabled]
128
+
<!-- prettier-ignore-start -->
129
+
```js [config]
128
130
exportdefault {
129
131
input:'hey-api/backend', // sign up at app.heyapi.dev
130
132
output: {
131
-
importFileExtension:null, // [!code ++]
133
+
header: (ctx) => [ // [!code ++]
134
+
'/* eslint-disable */', // [!code ++]
135
+
...ctx.defaultValue, // [!code ++]
136
+
], // [!code ++]
132
137
path:'src/client',
133
138
},
134
139
};
135
140
```
141
+
<!-- prettier-ignore-end -->
142
+
143
+
:::
144
+
145
+
## Module
146
+
147
+
Control how module specifiers are generated in the output.
148
+
149
+
### Module Extension
150
+
151
+
Set `module.extension` to define the file extension used in import specifiers. This is useful when targeting environments that require fully specified imports (e.g., Node ESM or certain bundlers).
152
+
153
+
::: code-group
154
+
155
+
```js [example]
156
+
importfoofrom'./foo.js';
157
+
importbarfrom'./bar.js';
158
+
```
136
159
137
-
```js [js]
160
+
```js [config]
138
161
exportdefault {
139
162
input:'hey-api/backend', // sign up at app.heyapi.dev
140
163
output: {
141
-
importFileExtension:'.js', // [!code ++]
164
+
module: {
165
+
extension:'.js', // [!code ++]
166
+
},
142
167
path:'src/client',
143
168
},
144
169
};
145
170
```
146
171
147
-
```js [ts]
172
+
:::
173
+
174
+
### Module Path
175
+
176
+
Use `module.resolve` for full control over how module specifiers are generated. This lets you override specific modules or redirect them to custom locations (e.g., CDNs or internal aliases).
177
+
178
+
::: code-group
179
+
180
+
```js [example]
181
+
import*aszfrom'https://esm.sh/zod';
182
+
```
183
+
184
+
<!-- prettier-ignore-start -->
185
+
```js [config]
148
186
exportdefault {
149
187
input:'hey-api/backend', // sign up at app.heyapi.dev
150
188
output: {
151
-
importFileExtension:'.ts', // [!code ++]
189
+
module: {
190
+
resolve(path) { // [!code ++]
191
+
if (path ==='zod') { // [!code ++]
192
+
return'https://esm.sh/zod'; // [!code ++]
193
+
} // [!code ++]
194
+
}, // [!code ++]
195
+
},
152
196
path:'src/client',
153
197
},
154
198
};
155
199
```
200
+
<!-- prettier-ignore-end -->
156
201
157
202
:::
158
203
159
-
By default, we don't add a file extension and let the runtime resolve it.
160
-
161
-
```js
162
-
importfoofrom'./foo';
163
-
```
164
-
165
-
If we detect a [TSConfig file](#tsconfig-path) with `moduleResolution` option set to `nodenext`, we default the extension to `.js`.
166
-
167
-
```js
168
-
importfoofrom'./foo.js';
169
-
```
170
-
171
204
## Source
172
205
173
206
Source is a copy of the input specification used to generate your output. It can be used to power documentation tools or to persist a stable snapshot alongside your generated files.
@@ -337,36 +370,6 @@ export type ChatCompletion_N2 = number;
337
370
338
371
:::
339
372
340
-
## File Header
341
-
342
-
The generated output includes a notice in every file warning that any modifications will be lost when the files are regenerated. You can customize or disable this notice using the `header` option.
343
-
344
-
::: code-group
345
-
346
-
<!-- prettier-ignore-start -->
347
-
```js [config]
348
-
exportdefault {
349
-
input:'hey-api/backend', // sign up at app.heyapi.dev
350
-
output: {
351
-
header: [
352
-
'/* eslint-disable */', // [!code ++]
353
-
'// This file is auto-generated by @hey-api/openapi-ts', // [!code ++]
354
-
],
355
-
path:'src/client',
356
-
},
357
-
};
358
-
```
359
-
<!-- prettier-ignore-end -->
360
-
361
-
```ts [example]
362
-
/* eslint-disable */
363
-
// This file is auto-generated by @hey-api/openapi-ts
364
-
365
-
/** ... */
366
-
```
367
-
368
-
:::
369
-
370
373
## TSConfig Path
371
374
372
375
We use the [TSConfig file](https://www.typescriptlang.org/tsconfig/) to generate output matching your project's settings. By default, we attempt to find a TSConfig file starting from the location of the `@hey-api/openapi-ts` configuration file and traversing up.
Copy file name to clipboardExpand all lines: docs/openapi-ts/migrating.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -422,7 +422,7 @@ If you need to access individual fields, you can do so using the [`.shape`](http
422
422
423
423
### Bundle `@hey-api/client-*` plugins
424
424
425
-
In previous releases, you had to install a separate client package to generate a fully working output, e.g. `npminstall @hey-api/client-fetch`. This created a few challenges: getting started was slower, upgrading was sometimes painful, and bundling too. Beginning with v0.73.0, all Hey API clients are bundled by default and don't require installing any additional dependencies. You can remove any installed client packages and re-run `@hey-api/openapi-ts`.
425
+
In previous releases, you had to install a separate client package to generate a fully working output, e.g.,`npminstall @hey-api/client-fetch`. This created a few challenges: getting started was slower, upgrading was sometimes painful, and bundling too. Beginning with v0.73.0, all Hey API clients are bundled by default and don't require installing any additional dependencies. You can remove any installed client packages and re-run `@hey-api/openapi-ts`.
Copy file name to clipboardExpand all lines: docs/openapi-ts/plugins/pinia-colada.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -60,7 +60,7 @@ The Pinia Colada plugin will generate the following artifacts, depending on the
60
60
61
61
## Queries
62
62
63
-
Queries are generated from [query operations](/openapi-ts/configuration/parser#hooks-query-operations). The generated query functions follow the naming convention of SDK functions and by default append `Query`, e.g. `getPetByIdQuery()`.
63
+
Queries are generated from [query operations](/openapi-ts/configuration/parser#hooks-query-operations). The generated query functions follow the naming convention of SDK functions and by default append `Query`, e.g.,`getPetByIdQuery()`.
64
64
65
65
::: code-group
66
66
@@ -191,7 +191,7 @@ export default {
191
191
192
192
:::
193
193
194
-
Alternatively, you can access the same query key by calling query key functions. The generated query key functions follow the naming convention of SDK functions and by default append `QueryKey`, e.g. `getPetByIdQueryKey()`.
194
+
Alternatively, you can access the same query key by calling query key functions. The generated query key functions follow the naming convention of SDK functions and by default append `QueryKey`, e.g.,`getPetByIdQueryKey()`.
195
195
196
196
::: code-group
197
197
@@ -223,7 +223,7 @@ You can customize the naming and casing pattern for `queryKeys` functions using
223
223
224
224
## Mutations
225
225
226
-
Mutations are generated from [mutation operations](/openapi-ts/configuration/parser#hooks-mutation-operations). The generated mutation functions follow the naming convention of SDK functions and by default append `Mutation`, e.g. `addPetMutation()`.
226
+
Mutations are generated from [mutation operations](/openapi-ts/configuration/parser#hooks-mutation-operations). The generated mutation functions follow the naming convention of SDK functions and by default append `Mutation`, e.g.,`addPetMutation()`.
Copy file name to clipboardExpand all lines: docs/openapi-ts/plugins/tanstack-query.md
+5-5Lines changed: 5 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -115,7 +115,7 @@ The TanStack Query plugin will generate the following artifacts, depending on th
115
115
116
116
## Queries
117
117
118
-
Queries are generated from [query operations](/openapi-ts/configuration/parser#hooks-query-operations). The generated query functions follow the naming convention of SDK functions and by default append `Options`, e.g. `getPetByIdOptions()`.
118
+
Queries are generated from [query operations](/openapi-ts/configuration/parser#hooks-query-operations). The generated query functions follow the naming convention of SDK functions and by default append `Options`, e.g.,`getPetByIdOptions()`.
119
119
120
120
::: code-group
121
121
@@ -281,7 +281,7 @@ export default {
281
281
282
282
:::
283
283
284
-
Alternatively, you can access the same query key by calling query key functions. The generated query key functions follow the naming convention of SDK functions and by default append `QueryKey`, e.g. `getPetByIdQueryKey()`.
284
+
Alternatively, you can access the same query key by calling query key functions. The generated query key functions follow the naming convention of SDK functions and by default append `QueryKey`, e.g.,`getPetByIdQueryKey()`.
285
285
286
286
::: code-group
287
287
@@ -313,7 +313,7 @@ You can customize the naming and casing pattern for `queryKeys` functions using
313
313
314
314
## Infinite Queries
315
315
316
-
Infinite queries are generated from [query operations](/openapi-ts/configuration/parser#hooks-query-operations) if we detect a [pagination](/openapi-ts/configuration/parser#pagination) parameter. The generated infinite query functions follow the naming convention of SDK functions and by default append `InfiniteOptions`, e.g. `getFooInfiniteOptions()`.
316
+
Infinite queries are generated from [query operations](/openapi-ts/configuration/parser#hooks-query-operations) if we detect a [pagination](/openapi-ts/configuration/parser#pagination) parameter. The generated infinite query functions follow the naming convention of SDK functions and by default append `InfiniteOptions`, e.g.,`getFooInfiniteOptions()`.
317
317
318
318
::: code-group
319
319
@@ -483,7 +483,7 @@ export default {
483
483
484
484
:::
485
485
486
-
Alternatively, you can access the same query key by calling query key functions. The generated query key functions follow the naming convention of SDK functions and by default append `InfiniteQueryKey`, e.g. `getPetByIdInfiniteQueryKey()`.
486
+
Alternatively, you can access the same query key by calling query key functions. The generated query key functions follow the naming convention of SDK functions and by default append `InfiniteQueryKey`, e.g.,`getPetByIdInfiniteQueryKey()`.
487
487
488
488
::: code-group
489
489
@@ -515,7 +515,7 @@ You can customize the naming and casing pattern for `infiniteQueryKeys` function
515
515
516
516
## Mutations
517
517
518
-
Mutations are generated from [mutation operations](/openapi-ts/configuration/parser#hooks-mutation-operations). The generated mutation functions follow the naming convention of SDK functions and by default append `Mutation`, e.g. `addPetMutation()`.
518
+
Mutations are generated from [mutation operations](/openapi-ts/configuration/parser#hooks-mutation-operations). The generated mutation functions follow the naming convention of SDK functions and by default append `Mutation`, e.g.,`addPetMutation()`.
0 commit comments