Skip to content

Commit 6fdfb88

Browse files
committed
chore(test): update transformers-additional-properties snapshots
1 parent 3df4433 commit 6fdfb88

3 files changed

Lines changed: 12 additions & 12 deletions

File tree

packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-additional-properties/client/client.gen.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export const createClient = (config: Config = {}): Client => {
3737
...options,
3838
fetch: options.fetch ?? _config.fetch ?? globalThis.fetch,
3939
headers: mergeHeaders(_config.headers, options.headers),
40-
serializedBody: undefined,
40+
serializedBody: undefined as string | undefined,
4141
};
4242

4343
if (opts.security) {
@@ -52,7 +52,7 @@ export const createClient = (config: Config = {}): Client => {
5252
}
5353

5454
if (opts.body !== undefined && opts.bodySerializer) {
55-
opts.serializedBody = opts.bodySerializer(opts.body);
55+
opts.serializedBody = opts.bodySerializer(opts.body) as string | undefined;
5656
}
5757

5858
// remove Content-Type header if body is empty to avoid sending invalid requests
@@ -258,8 +258,10 @@ export const createClient = (config: Config = {}): Client => {
258258
});
259259
};
260260

261+
const _buildUrl: Client['buildUrl'] = (options) => buildUrl({ ..._config, ...options });
262+
261263
return {
262-
buildUrl,
264+
buildUrl: _buildUrl,
263265
connect: makeMethodFn('CONNECT'),
264266
delete: makeMethodFn('DELETE'),
265267
get: makeMethodFn('GET'),

packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-additional-properties/core/bodySerializer.gen.ts

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import type { ArrayStyle, ObjectStyle, SerializerOptions } from './pathSerialize
44

55
export type QuerySerializer = (query: Record<string, unknown>) => string;
66

7-
export type BodySerializer = (body: any) => any;
7+
export type BodySerializer = (body: unknown) => unknown;
88

99
type QuerySerializerOptionsObject = {
1010
allowReserved?: boolean;
@@ -39,12 +39,10 @@ const serializeUrlSearchParamsPair = (data: URLSearchParams, key: string, value:
3939
};
4040

4141
export const formDataBodySerializer = {
42-
bodySerializer: <T extends Record<string, any> | Array<Record<string, any>>>(
43-
body: T,
44-
): FormData => {
42+
bodySerializer: (body: unknown): FormData => {
4543
const data = new FormData();
4644

47-
Object.entries(body).forEach(([key, value]) => {
45+
Object.entries(body as Record<string, unknown>).forEach(([key, value]) => {
4846
if (value === undefined || value === null) {
4947
return;
5048
}
@@ -60,15 +58,15 @@ export const formDataBodySerializer = {
6058
};
6159

6260
export const jsonBodySerializer = {
63-
bodySerializer: <T>(body: T): string =>
61+
bodySerializer: (body: unknown): string =>
6462
JSON.stringify(body, (_key, value) => (typeof value === 'bigint' ? value.toString() : value)),
6563
};
6664

6765
export const urlSearchParamsBodySerializer = {
68-
bodySerializer: <T extends Record<string, any> | Array<Record<string, any>>>(body: T): string => {
66+
bodySerializer: (body: unknown): string => {
6967
const data = new URLSearchParams();
7068

71-
Object.entries(body).forEach(([key, value]) => {
69+
Object.entries(body as Record<string, unknown>).forEach(([key, value]) => {
7270
if (value === undefined || value === null) {
7371
return;
7472
}

packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-additional-properties/core/params.gen.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ interface Params {
9696

9797
const stripEmptySlots = (params: Params) => {
9898
for (const [slot, value] of Object.entries(params)) {
99-
if (value && typeof value === 'object' && !Object.keys(value).length) {
99+
if (value && typeof value === 'object' && !Array.isArray(value) && !Object.keys(value).length) {
100100
delete params[slot as Slot];
101101
}
102102
}

0 commit comments

Comments
 (0)