Skip to content

Commit f5eb909

Browse files
committed
chore: regenerate example clients after template update
Propagates the client template changes (URL built after request interceptors; finalError threaded through error interceptor chain) into the 10 example projects whose generated client.gen.ts files render one of the three affected client templates. This unblocks the examples:check CI job.
1 parent 1039cf9 commit f5eb909

10 files changed

Lines changed: 29 additions & 22 deletions

File tree

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ export const createClient = (config: Config = {}): Client => {
103103

104104
for (const fn of interceptors.error.fns) {
105105
if (fn) {
106-
finalError = (await fn(error, undefined as any, request, opts)) as unknown;
106+
finalError = (await fn(finalError, undefined as any, request, opts)) as unknown;
107107
}
108108
}
109109

@@ -223,7 +223,7 @@ export const createClient = (config: Config = {}): Client => {
223223

224224
for (const fn of interceptors.error.fns) {
225225
if (fn) {
226-
finalError = (await fn(error, response, request, opts)) as string;
226+
finalError = (await fn(finalError, response, request, opts)) as string;
227227
}
228228
}
229229

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ export const createClient = (config: Config = {}): Client => {
103103

104104
for (const fn of interceptors.error.fns) {
105105
if (fn) {
106-
finalError = (await fn(error, undefined as any, request, opts)) as unknown;
106+
finalError = (await fn(finalError, undefined as any, request, opts)) as unknown;
107107
}
108108
}
109109

@@ -223,7 +223,7 @@ export const createClient = (config: Config = {}): Client => {
223223

224224
for (const fn of interceptors.error.fns) {
225225
if (fn) {
226-
finalError = (await fn(error, response, request, opts)) as string;
226+
finalError = (await fn(finalError, response, request, opts)) as string;
227227
}
228228
}
229229

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ export const createClient = (config: Config = {}): Client => {
103103

104104
for (const fn of interceptorsMiddleware.error.fns) {
105105
if (fn) {
106-
finalError = (await fn(error, response, request, opts)) as string;
106+
finalError = (await fn(finalError, response, request, opts)) as string;
107107
}
108108
}
109109

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ export const createClient = (config: Config = {}): Client => {
103103

104104
for (const fn of interceptors.error.fns) {
105105
if (fn) {
106-
finalError = (await fn(error, undefined as any, request, opts)) as unknown;
106+
finalError = (await fn(finalError, undefined as any, request, opts)) as unknown;
107107
}
108108
}
109109

@@ -223,7 +223,7 @@ export const createClient = (config: Config = {}): Client => {
223223

224224
for (const fn of interceptors.error.fns) {
225225
if (fn) {
226-
finalError = (await fn(error, response, request, opts)) as string;
226+
finalError = (await fn(finalError, response, request, opts)) as string;
227227
}
228228
}
229229

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

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,21 +67,24 @@ export const createClient = (config: Config = {}): Client => {
6767
}
6868

6969
const resolvedOpts = opts as typeof opts & ResolvedRequestOptions<ThrowOnError, Url>;
70-
const url = buildUrl(resolvedOpts);
7170

72-
return { opts: resolvedOpts, url };
71+
return { opts: resolvedOpts };
7372
};
7473

7574
// @ts-expect-error
7675
const request: Client['request'] = async (options) => {
77-
const { opts, url } = await beforeRequest(options);
76+
const { opts } = await beforeRequest(options);
7877

7978
for (const fn of interceptors.request.fns) {
8079
if (fn) {
8180
await fn(opts);
8281
}
8382
}
8483

84+
// Build the URL after request interceptors have run so any mutations to
85+
// `opts.baseUrl`, `opts.url`, `opts.path`, or `opts.query` are honored.
86+
const url = buildUrl(opts);
87+
8588
// fetch must be assigned here, otherwise it would throw the error:
8689
// TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation
8790
const _fetch = opts.fetch!;
@@ -185,7 +188,7 @@ export const createClient = (config: Config = {}): Client => {
185188

186189
for (const fn of interceptors.error.fns) {
187190
if (fn) {
188-
finalError = (await fn(error, response, opts)) as string;
191+
finalError = (await fn(finalError, response, opts)) as string;
189192
}
190193
}
191194

@@ -205,7 +208,11 @@ export const createClient = (config: Config = {}): Client => {
205208
request({ ...options, method });
206209

207210
const makeSseFn = (method: Uppercase<HttpMethod>) => async (options: RequestOptions) => {
208-
const { opts, url } = await beforeRequest(options);
211+
const { opts } = await beforeRequest(options);
212+
// The SSE path applies request interceptors again inside `onRequest`
213+
// (see below), so the URL we seed `createSseClient` with is only the
214+
// initial value; any per-request URL mutation happens there.
215+
const url = buildUrl(opts);
209216
return createSseClient({
210217
...opts,
211218
body: opts.body as BodyInit | null | undefined,

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ export const createClient = (config: Config = {}): Client => {
103103

104104
for (const fn of interceptors.error.fns) {
105105
if (fn) {
106-
finalError = (await fn(error, undefined as any, request, opts)) as unknown;
106+
finalError = (await fn(finalError, undefined as any, request, opts)) as unknown;
107107
}
108108
}
109109

@@ -223,7 +223,7 @@ export const createClient = (config: Config = {}): Client => {
223223

224224
for (const fn of interceptors.error.fns) {
225225
if (fn) {
226-
finalError = (await fn(error, response, request, opts)) as string;
226+
finalError = (await fn(finalError, response, request, opts)) as string;
227227
}
228228
}
229229

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ export const createClient = (config: Config = {}): Client => {
103103

104104
for (const fn of interceptors.error.fns) {
105105
if (fn) {
106-
finalError = (await fn(error, undefined as any, request, opts)) as unknown;
106+
finalError = (await fn(finalError, undefined as any, request, opts)) as unknown;
107107
}
108108
}
109109

@@ -223,7 +223,7 @@ export const createClient = (config: Config = {}): Client => {
223223

224224
for (const fn of interceptors.error.fns) {
225225
if (fn) {
226-
finalError = (await fn(error, response, request, opts)) as string;
226+
finalError = (await fn(finalError, response, request, opts)) as string;
227227
}
228228
}
229229

examples/openapi-ts-tanstack-react-query/src/client/client/client.gen.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ export const createClient = (config: Config = {}): Client => {
103103

104104
for (const fn of interceptors.error.fns) {
105105
if (fn) {
106-
finalError = (await fn(error, undefined as any, request, opts)) as unknown;
106+
finalError = (await fn(finalError, undefined as any, request, opts)) as unknown;
107107
}
108108
}
109109

@@ -223,7 +223,7 @@ export const createClient = (config: Config = {}): Client => {
223223

224224
for (const fn of interceptors.error.fns) {
225225
if (fn) {
226-
finalError = (await fn(error, response, request, opts)) as string;
226+
finalError = (await fn(finalError, response, request, opts)) as string;
227227
}
228228
}
229229

examples/openapi-ts-tanstack-svelte-query/src/client/client/client.gen.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ export const createClient = (config: Config = {}): Client => {
103103

104104
for (const fn of interceptors.error.fns) {
105105
if (fn) {
106-
finalError = (await fn(error, undefined as any, request, opts)) as unknown;
106+
finalError = (await fn(finalError, undefined as any, request, opts)) as unknown;
107107
}
108108
}
109109

@@ -223,7 +223,7 @@ export const createClient = (config: Config = {}): Client => {
223223

224224
for (const fn of interceptors.error.fns) {
225225
if (fn) {
226-
finalError = (await fn(error, response, request, opts)) as string;
226+
finalError = (await fn(finalError, response, request, opts)) as string;
227227
}
228228
}
229229

examples/openapi-ts-tanstack-vue-query/src/client/client/client.gen.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ export const createClient = (config: Config = {}): Client => {
103103

104104
for (const fn of interceptors.error.fns) {
105105
if (fn) {
106-
finalError = (await fn(error, undefined as any, request, opts)) as unknown;
106+
finalError = (await fn(finalError, undefined as any, request, opts)) as unknown;
107107
}
108108
}
109109

@@ -223,7 +223,7 @@ export const createClient = (config: Config = {}): Client => {
223223

224224
for (const fn of interceptors.error.fns) {
225225
if (fn) {
226-
finalError = (await fn(error, response, request, opts)) as string;
226+
finalError = (await fn(finalError, response, request, opts)) as string;
227227
}
228228
}
229229

0 commit comments

Comments
 (0)