Skip to content

Commit 5c53c2c

Browse files
committed
fix: rebuild tests
1 parent 6311821 commit 5c53c2c

File tree

309 files changed

+6907
-2058
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

309 files changed

+6907
-2058
lines changed

examples/openapi-ts-fastify/src/client/client/client.gen.ts

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,40 @@ export const createClient = (config: Config = {}): Client => {
9595
// fetch must be assigned here, otherwise it would throw the error:
9696
// TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation
9797
const _fetch = opts.fetch!;
98-
let response = await _fetch(request);
98+
let response: Response;
99+
100+
try {
101+
response = await _fetch(request);
102+
} catch (error) {
103+
// Handle fetch exceptions (AbortError, network errors, etc.)
104+
let finalError = error;
105+
106+
for (const fn of interceptors.error.fns) {
107+
if (fn) {
108+
finalError = (await fn(
109+
error,
110+
undefined as any,
111+
request,
112+
opts,
113+
)) as unknown;
114+
}
115+
}
116+
117+
finalError = finalError || ({} as unknown);
118+
119+
if (opts.throwOnError) {
120+
throw finalError;
121+
}
122+
123+
// Return error response
124+
return opts.responseStyle === 'data'
125+
? undefined
126+
: {
127+
error: finalError,
128+
request,
129+
response: undefined as any,
130+
};
131+
}
99132

100133
for (const fn of interceptors.response.fns) {
101134
if (fn) {

examples/openapi-ts-fetch/src/client/client/client.gen.ts

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,40 @@ export const createClient = (config: Config = {}): Client => {
9595
// fetch must be assigned here, otherwise it would throw the error:
9696
// TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation
9797
const _fetch = opts.fetch!;
98-
let response = await _fetch(request);
98+
let response: Response;
99+
100+
try {
101+
response = await _fetch(request);
102+
} catch (error) {
103+
// Handle fetch exceptions (AbortError, network errors, etc.)
104+
let finalError = error;
105+
106+
for (const fn of interceptors.error.fns) {
107+
if (fn) {
108+
finalError = (await fn(
109+
error,
110+
undefined as any,
111+
request,
112+
opts,
113+
)) as unknown;
114+
}
115+
}
116+
117+
finalError = finalError || ({} as unknown);
118+
119+
if (opts.throwOnError) {
120+
throw finalError;
121+
}
122+
123+
// Return error response
124+
return opts.responseStyle === 'data'
125+
? undefined
126+
: {
127+
error: finalError,
128+
request,
129+
response: undefined as any,
130+
};
131+
}
99132

100133
for (const fn of interceptors.response.fns) {
101134
if (fn) {

examples/openapi-ts-openai/src/client/client/client.gen.ts

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,40 @@ export const createClient = (config: Config = {}): Client => {
9595
// fetch must be assigned here, otherwise it would throw the error:
9696
// TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation
9797
const _fetch = opts.fetch!;
98-
let response = await _fetch(request);
98+
let response: Response;
99+
100+
try {
101+
response = await _fetch(request);
102+
} catch (error) {
103+
// Handle fetch exceptions (AbortError, network errors, etc.)
104+
let finalError = error;
105+
106+
for (const fn of interceptors.error.fns) {
107+
if (fn) {
108+
finalError = (await fn(
109+
error,
110+
undefined as any,
111+
request,
112+
opts,
113+
)) as unknown;
114+
}
115+
}
116+
117+
finalError = finalError || ({} as unknown);
118+
119+
if (opts.throwOnError) {
120+
throw finalError;
121+
}
122+
123+
// Return error response
124+
return opts.responseStyle === 'data'
125+
? undefined
126+
: {
127+
error: finalError,
128+
request,
129+
response: undefined as any,
130+
};
131+
}
99132

100133
for (const fn of interceptors.response.fns) {
101134
if (fn) {

examples/openapi-ts-pinia-colada/src/client/client/client.gen.ts

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,35 @@ export const createClient = (config: Config = {}): Client => {
8585
// fetch must be assigned here, otherwise it would throw the error:
8686
// TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation
8787
const _fetch = opts.fetch!
88-
let response = await _fetch(request)
88+
let response: Response
89+
90+
try {
91+
response = await _fetch(request)
92+
} catch (error) {
93+
// Handle fetch exceptions (AbortError, network errors, etc.)
94+
let finalError = error
95+
96+
for (const fn of interceptors.error.fns) {
97+
if (fn) {
98+
finalError = (await fn(error, undefined as any, request, opts)) as unknown
99+
}
100+
}
101+
102+
finalError = finalError || ({} as unknown)
103+
104+
if (opts.throwOnError) {
105+
throw finalError
106+
}
107+
108+
// Return error response
109+
return opts.responseStyle === 'data'
110+
? undefined
111+
: {
112+
error: finalError,
113+
request,
114+
response: undefined as any
115+
}
116+
}
89117

90118
for (const fn of interceptors.response.fns) {
91119
if (fn) {

examples/openapi-ts-swr/src/client/client/client.gen.ts

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,40 @@ export const createClient = (config: Config = {}): Client => {
9595
// fetch must be assigned here, otherwise it would throw the error:
9696
// TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation
9797
const _fetch = opts.fetch!;
98-
let response = await _fetch(request);
98+
let response: Response;
99+
100+
try {
101+
response = await _fetch(request);
102+
} catch (error) {
103+
// Handle fetch exceptions (AbortError, network errors, etc.)
104+
let finalError = error;
105+
106+
for (const fn of interceptors.error.fns) {
107+
if (fn) {
108+
finalError = (await fn(
109+
error,
110+
undefined as any,
111+
request,
112+
opts,
113+
)) as unknown;
114+
}
115+
}
116+
117+
finalError = finalError || ({} as unknown);
118+
119+
if (opts.throwOnError) {
120+
throw finalError;
121+
}
122+
123+
// Return error response
124+
return opts.responseStyle === 'data'
125+
? undefined
126+
: {
127+
error: finalError,
128+
request,
129+
response: undefined as any,
130+
};
131+
}
99132

100133
for (const fn of interceptors.response.fns) {
101134
if (fn) {

examples/openapi-ts-swr/src/client/swr.gen.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ import type {
5252
*/
5353
export const addPetMutation = (options?: Options<AddPetData>) => ({
5454
fetcher: async (
55-
_key: readonly [string],
55+
_key: string[],
5656
{
5757
arg,
5858
}: {
@@ -76,7 +76,7 @@ export const addPetMutation = (options?: Options<AddPetData>) => ({
7676
*/
7777
export const updatePetMutation = (options?: Options<UpdatePetData>) => ({
7878
fetcher: async (
79-
_key: readonly [string],
79+
_key: string[],
8080
{
8181
arg,
8282
}: {
@@ -140,7 +140,7 @@ export const findPetsByTagsOptions = (
140140
*/
141141
export const deletePetMutation = (options?: Options<DeletePetData>) => ({
142142
fetcher: async (
143-
_key: readonly [string] | readonly [string, Options<DeletePetData>],
143+
_key: string[] | [string, Options<DeletePetData>],
144144
{
145145
arg,
146146
}: {
@@ -184,7 +184,7 @@ export const updatePetWithFormMutation = (
184184
options?: Options<UpdatePetWithFormData>,
185185
) => ({
186186
fetcher: async (
187-
_key: readonly [string] | readonly [string, Options<UpdatePetWithFormData>],
187+
_key: string[] | [string, Options<UpdatePetWithFormData>],
188188
{
189189
arg,
190190
}: {
@@ -208,7 +208,7 @@ export const updatePetWithFormMutation = (
208208
*/
209209
export const uploadFileMutation = (options?: Options<UploadFileData>) => ({
210210
fetcher: async (
211-
_key: readonly [string] | readonly [string, Options<UploadFileData>],
211+
_key: string[] | [string, Options<UploadFileData>],
212212
{
213213
arg,
214214
}: {
@@ -251,7 +251,7 @@ export const getInventoryOptions = (options?: Options<GetInventoryData>) => ({
251251
*/
252252
export const placeOrderMutation = (options?: Options<PlaceOrderData>) => ({
253253
fetcher: async (
254-
_key: readonly [string],
254+
_key: string[],
255255
{
256256
arg,
257257
}: {
@@ -275,7 +275,7 @@ export const placeOrderMutation = (options?: Options<PlaceOrderData>) => ({
275275
*/
276276
export const deleteOrderMutation = (options?: Options<DeleteOrderData>) => ({
277277
fetcher: async (
278-
_key: readonly [string] | readonly [string, Options<DeleteOrderData>],
278+
_key: string[] | [string, Options<DeleteOrderData>],
279279
{
280280
arg,
281281
}: {
@@ -319,7 +319,7 @@ export const getOrderByIdOptions = (options: Options<GetOrderByIdData>) => ({
319319
*/
320320
export const createUserMutation = (options?: Options<CreateUserData>) => ({
321321
fetcher: async (
322-
_key: readonly [string],
322+
_key: string[],
323323
{
324324
arg,
325325
}: {
@@ -345,7 +345,7 @@ export const createUsersWithListInputMutation = (
345345
options?: Options<CreateUsersWithListInputData>,
346346
) => ({
347347
fetcher: async (
348-
_key: readonly [string],
348+
_key: string[],
349349
{
350350
arg,
351351
}: {
@@ -404,7 +404,7 @@ export const logoutUserOptions = (options?: Options<LogoutUserData>) => ({
404404
*/
405405
export const deleteUserMutation = (options?: Options<DeleteUserData>) => ({
406406
fetcher: async (
407-
_key: readonly [string] | readonly [string, Options<DeleteUserData>],
407+
_key: string[] | [string, Options<DeleteUserData>],
408408
{
409409
arg,
410410
}: {
@@ -446,7 +446,7 @@ export const getUserByNameOptions = (options: Options<GetUserByNameData>) => ({
446446
*/
447447
export const updateUserMutation = (options?: Options<UpdateUserData>) => ({
448448
fetcher: async (
449-
_key: readonly [string] | readonly [string, Options<UpdateUserData>],
449+
_key: string[] | [string, Options<UpdateUserData>],
450450
{
451451
arg,
452452
}: {

0 commit comments

Comments
 (0)