From 662300b7fa164530f36c9de14d4a283ee2e19fbc Mon Sep 17 00:00:00 2001 From: Fransis Young Date: Sat, 30 Aug 2025 12:47:41 -0400 Subject: [PATCH 01/46] fix(client-fetch): ensures plain/text body is sent with request resolves: #2553 --- .../client-fetch/__tests__/client.test.ts | 92 +++++++++++++++++++ .../@hey-api/client-fetch/bundle/client.ts | 7 +- 2 files changed, 97 insertions(+), 2 deletions(-) diff --git a/packages/openapi-ts/src/plugins/@hey-api/client-fetch/__tests__/client.test.ts b/packages/openapi-ts/src/plugins/@hey-api/client-fetch/__tests__/client.test.ts index 6937bf9b3..06181052d 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/client-fetch/__tests__/client.test.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/client-fetch/__tests__/client.test.ts @@ -1,5 +1,6 @@ import { describe, expect, it, vi } from 'vitest'; +import type { ResolvedRequestOptions } from '../bundle'; import { createClient } from '../bundle/client'; type MockFetch = ((...args: any[]) => any) & { @@ -221,3 +222,94 @@ describe('zero-length body handling', () => { expect((result.data as Blob).size).toBeGreaterThan(0); }); }); + +describe('request body handling', () => { + const client = createClient({ baseUrl: 'https://example.com' }); + + const scenarios = [ + { + body: 'test string', + bodySerializer: null, + contentType: 'text/plain', + expectedSerializedValue: undefined, + expectedValue: async (request: Request) => await request.text(), + }, + { + body: { key: 'value' }, + bodySerializer: (body: object) => JSON.stringify(body), + contentType: 'application/json', + expectedSerializedValue: '{"key":"value"}', + expectedValue: async (request: Request) => await request.json(), + }, + ]; + + it.each(scenarios)( + 'sends $contentType body', + async ({ body, bodySerializer, contentType, expectedValue }) => { + const mockResponse = new Response(JSON.stringify({ success: true }), { + headers: { + 'Content-Type': 'application/json', + }, + status: 200, + }); + + const mockFetch: MockFetch = vi.fn().mockResolvedValueOnce(mockResponse); + + const result = await client.post({ + body, + bodySerializer, + fetch: mockFetch, + headers: { + 'Content-Type': contentType, + }, + url: '/test', + }); + + await expect(expectedValue(result.request)).resolves.toEqual(body); + expect(result.request.headers.get('Content-Type')).toContain(contentType); + }, + ); + + it.each(scenarios)( + 'exposes $contentType serialized and raw body in interceptor', + async ({ body, bodySerializer, contentType, expectedSerializedValue }) => { + const mockResponse = new Response(JSON.stringify({ success: true }), { + headers: { + 'Content-Type': 'application/json', + }, + status: 200, + }); + + const mockFetch: MockFetch = vi.fn().mockResolvedValueOnce(mockResponse); + + const mockRequestInterceptor = vi + .fn() + .mockImplementation( + (request: Request, options: ResolvedRequestOptions) => { + expect(options.serializedBody).toBe(expectedSerializedValue); + expect(options.body).toBe(body); + + return request; + }, + ); + + const interceptorId = client.interceptors.request.use( + mockRequestInterceptor, + ); + + await client.post({ + body, + bodySerializer, + fetch: mockFetch, + headers: { + 'Content-Type': contentType, + }, + url: '/test', + }); + + expect(mockRequestInterceptor).toHaveBeenCalledOnce(); + + client.interceptors.request.eject(interceptorId); + }, + ); +}); diff --git a/packages/openapi-ts/src/plugins/@hey-api/client-fetch/bundle/client.ts b/packages/openapi-ts/src/plugins/@hey-api/client-fetch/bundle/client.ts index 3615a16ac..cd9966528 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/client-fetch/bundle/client.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/client-fetch/bundle/client.ts @@ -63,7 +63,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.serializedBody === undefined || opts.serializedBody === '') { + if (opts.body === undefined || opts.body === '') { opts.headers.delete('Content-Type'); } @@ -78,9 +78,12 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, - body: opts.serializedBody, }; + if (opts.serializedBody) { + requestInit.body = opts.serializedBody; + } + let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { -- 2.51.2 From 9320253eb88172a4d1f41f1429ed63c7379f79ca Mon Sep 17 00:00:00 2001 From: Fransis Young Date: Sat, 30 Aug 2025 23:30:05 -0400 Subject: [PATCH 02/46] fix(client-next): ensures plain/text body is sent with request refs: #2553 --- .../client-next/__tests__/client.test.ts | 100 +++++++++++++++++- .../@hey-api/client-next/bundle/client.ts | 13 ++- 2 files changed, 108 insertions(+), 5 deletions(-) diff --git a/packages/openapi-ts/src/plugins/@hey-api/client-next/__tests__/client.test.ts b/packages/openapi-ts/src/plugins/@hey-api/client-next/__tests__/client.test.ts index 9b7aa96d8..35723cee1 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/client-next/__tests__/client.test.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/client-next/__tests__/client.test.ts @@ -1,6 +1,11 @@ -import { describe, expect, it } from 'vitest'; +import { describe, expect, it, vi } from 'vitest'; import { createClient } from '../bundle/client'; +import type { ResolvedRequestOptions } from '../bundle/types'; + +type MockFetch = ((...args: any[]) => any) & { + preconnect?: any; +}; describe('buildUrl', () => { const client = createClient(); @@ -48,3 +53,96 @@ describe('buildUrl', () => { expect(client.buildUrl(options)).toBe(url); }); }); + +describe('request body handling', () => { + const client = createClient({ baseUrl: 'https://example.com' }); + + const scenarios = [ + { + body: 'test string', + bodySerializer: null, + contentType: 'text/plain', + expectedSerializedValue: undefined, + expectedValue: 'test string', + }, + { + body: { key: 'value' }, + bodySerializer: (body: object) => JSON.stringify(body), + contentType: 'application/json', + expectedSerializedValue: '{"key":"value"}', + expectedValue: '{"key":"value"}', + }, + ]; + + it.each(scenarios)( + 'sends $contentType body', + async ({ body, bodySerializer, contentType, expectedValue }) => { + const mockResponse = new Response(JSON.stringify({ success: true }), { + headers: { + 'Content-Type': 'application/json', + }, + status: 200, + }); + + const mockFetch: MockFetch = vi.fn().mockResolvedValueOnce(mockResponse); + const headers = new Headers({ 'Content-Type': contentType }); + + await client.post({ + body, + bodySerializer, + fetch: mockFetch, + headers, + url: '/test', + }); + + expect(mockFetch).toHaveBeenCalledExactlyOnceWith( + expect.any(String), + expect.objectContaining({ + body: expectedValue, + headers, + }), + ); + }, + ); + + it.each(scenarios)( + 'exposes $contentType serialized and raw body in interceptor', + async ({ body, bodySerializer, contentType, expectedSerializedValue }) => { + const mockResponse = new Response(JSON.stringify({ success: true }), { + headers: { + 'Content-Type': 'application/json', + }, + status: 200, + }); + + const mockFetch: MockFetch = vi.fn().mockResolvedValueOnce(mockResponse); + + const mockRequestInterceptor = vi + .fn() + .mockImplementation((options: ResolvedRequestOptions) => { + expect(options.serializedBody).toBe(expectedSerializedValue); + expect(options.body).toBe(body); + + return options; + }); + + const interceptorId = client.interceptors.request.use( + mockRequestInterceptor, + ); + + await client.post({ + body, + bodySerializer, + fetch: mockFetch, + headers: { + 'Content-Type': contentType, + }, + url: '/test', + }); + + expect(mockRequestInterceptor).toHaveBeenCalledOnce(); + + client.interceptors.request.eject(interceptorId); + }, + ); +}); diff --git a/packages/openapi-ts/src/plugins/@hey-api/client-next/bundle/client.ts b/packages/openapi-ts/src/plugins/@hey-api/client-next/bundle/client.ts index f59fe1934..a6322c6d1 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/client-next/bundle/client.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/client-next/bundle/client.ts @@ -62,7 +62,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.serializedBody === undefined || opts.serializedBody === '') { + if (opts.body === undefined || opts.body === '') { opts.headers.delete('Content-Type'); } @@ -85,10 +85,15 @@ export const createClient = (config: Config = {}): Client => { // fetch must be assigned here, otherwise it would throw the error: // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation const _fetch = opts.fetch!; - let response = await _fetch(url, { + const requestInit: ReqInit = { ...opts, - body: opts.serializedBody as ReqInit['body'], - }); + }; + + if (opts.serializedBody) { + requestInit.body = opts.serializedBody; + } + + let response = await _fetch(url, requestInit); for (const fn of interceptors.response._fns) { if (fn) { -- 2.51.2 From b4d06c60792f2bd416b3ed9b992c61261a9fc71e Mon Sep 17 00:00:00 2001 From: Fransis Young Date: Sat, 30 Aug 2025 23:57:09 -0400 Subject: [PATCH 03/46] test(client): updates snapshots refs: #2553 --- .../body-response-text-plain/client/client.gen.ts | 7 +++++-- .../2.0.x/form-data/client/client.gen.ts | 7 +++++-- .../client/client.gen.ts | 7 +++++-- .../sdk-nested-classes/client/client.gen.ts | 7 +++++-- .../@hey-api/sdk/default/client/client.gen.ts | 7 +++++-- .../@hey-api/sdk/instance/client/client.gen.ts | 7 +++++-- .../@hey-api/sdk/throwOnError/client/client.gen.ts | 7 +++++-- .../type-format-valibot/client/client.gen.ts | 7 +++++-- .../type-format-zod/client/client.gen.ts | 7 +++++-- .../client/client.gen.ts | 7 +++++-- .../client/client.gen.ts | 7 +++++-- .../@pinia/colada/fetch/client/client.gen.ts | 7 +++++-- .../@pinia/colada/group-by-tag/client/client.gen.ts | 7 +++++-- .../asClass/client/client.gen.ts | 7 +++++-- .../fetch/client/client.gen.ts | 7 +++++-- .../name-builder/client/client.gen.ts | 7 +++++-- .../react-query/asClass/client/client.gen.ts | 7 +++++-- .../react-query/fetch/client/client.gen.ts | 7 +++++-- .../react-query/name-builder/client/client.gen.ts | 7 +++++-- .../solid-query/asClass/client/client.gen.ts | 7 +++++-- .../solid-query/fetch/client/client.gen.ts | 7 +++++-- .../solid-query/name-builder/client/client.gen.ts | 7 +++++-- .../svelte-query/asClass/client/client.gen.ts | 7 +++++-- .../svelte-query/fetch/client/client.gen.ts | 7 +++++-- .../svelte-query/name-builder/client/client.gen.ts | 7 +++++-- .../vue-query/asClass/client/client.gen.ts | 7 +++++-- .../@tanstack/vue-query/fetch/client/client.gen.ts | 7 +++++-- .../vue-query/name-builder/client/client.gen.ts | 7 +++++-- .../2.0.x/schema-unknown/client/client.gen.ts | 7 +++++-- .../2.0.x/security-api-key/client/client.gen.ts | 7 +++++-- .../2.0.x/security-basic/client/client.gen.ts | 7 +++++-- .../2.0.x/security-false/client/client.gen.ts | 7 +++++-- .../2.0.x/security-oauth2/client/client.gen.ts | 7 +++++-- .../2.0.x/servers-base-path/client/client.gen.ts | 7 +++++-- .../2.0.x/servers-host/client/client.gen.ts | 7 +++++-- .../2.0.x/servers/client/client.gen.ts | 7 +++++-- .../transforms-read-write/client/client.gen.ts | 7 +++++-- .../body-response-text-plain/client/client.gen.ts | 7 +++++-- .../internal-name-conflict/client/client.gen.ts | 7 +++++-- .../parameter-explode-false/client/client.gen.ts | 7 +++++-- .../client/client.gen.ts | 7 +++++-- .../sdk-nested-classes/client/client.gen.ts | 7 +++++-- .../@hey-api/sdk/default/client/client.gen.ts | 7 +++++-- .../@hey-api/sdk/instance/client/client.gen.ts | 7 +++++-- .../@hey-api/sdk/throwOnError/client/client.gen.ts | 7 +++++-- .../type-format-valibot/client/client.gen.ts | 7 +++++-- .../type-format-zod/client/client.gen.ts | 7 +++++-- .../client/client.gen.ts | 7 +++++-- .../client/client.gen.ts | 7 +++++-- .../@pinia/colada/fetch/client/client.gen.ts | 7 +++++-- .../@pinia/colada/group-by-tag/client/client.gen.ts | 7 +++++-- .../asClass/client/client.gen.ts | 7 +++++-- .../fetch/client/client.gen.ts | 7 +++++-- .../name-builder/client/client.gen.ts | 7 +++++-- .../react-query/asClass/client/client.gen.ts | 7 +++++-- .../react-query/fetch/client/client.gen.ts | 7 +++++-- .../react-query/name-builder/client/client.gen.ts | 7 +++++-- .../solid-query/asClass/client/client.gen.ts | 7 +++++-- .../solid-query/fetch/client/client.gen.ts | 7 +++++-- .../solid-query/name-builder/client/client.gen.ts | 7 +++++-- .../svelte-query/asClass/client/client.gen.ts | 7 +++++-- .../svelte-query/fetch/client/client.gen.ts | 7 +++++-- .../svelte-query/name-builder/client/client.gen.ts | 7 +++++-- .../vue-query/asClass/client/client.gen.ts | 7 +++++-- .../@tanstack/vue-query/fetch/client/client.gen.ts | 7 +++++-- .../vue-query/name-builder/client/client.gen.ts | 7 +++++-- .../3.0.x/security-api-key/client/client.gen.ts | 7 +++++-- .../3.0.x/security-false/client/client.gen.ts | 7 +++++-- .../3.0.x/security-http-bearer/client/client.gen.ts | 7 +++++-- .../3.0.x/security-oauth2/client/client.gen.ts | 7 +++++-- .../security-open-id-connect/client/client.gen.ts | 7 +++++-- .../3.0.x/servers/client/client.gen.ts | 7 +++++-- .../3.0.x/transformers-all-of/client/client.gen.ts | 7 +++++-- .../transformers-any-of-null/client/client.gen.ts | 7 +++++-- .../3.0.x/transformers-array/client/client.gen.ts | 7 +++++-- .../transforms-read-write/client/client.gen.ts | 7 +++++-- .../body-response-text-plain/client/client.gen.ts | 7 +++++-- .../base-url-false/client/client.gen.ts | 7 +++++-- .../base-url-number/client/client.gen.ts | 7 +++++-- .../base-url-strict/client/client.gen.ts | 7 +++++-- .../base-url-string/client/client.gen.ts | 7 +++++-- .../client-fetch/clean-false/client/client.gen.ts | 7 +++++-- .../client-fetch/default/client/client.gen.ts | 7 +++++-- .../sdk-client-optional/client/client.gen.ts | 7 +++++-- .../sdk-client-required/client/client.gen.ts | 7 +++++-- .../tsconfig-nodenext-sdk/client/client.gen.ts | 7 +++++-- .../client-next/base-url-false/client/client.gen.ts | 13 +++++++++---- .../base-url-number/client/client.gen.ts | 13 +++++++++---- .../base-url-strict/client/client.gen.ts | 13 +++++++++---- .../base-url-string/client/client.gen.ts | 13 +++++++++---- .../client-next/clean-false/client/client.gen.ts | 13 +++++++++---- .../client-next/default/client/client.gen.ts | 13 +++++++++---- .../sdk-client-optional/client/client.gen.ts | 13 +++++++++---- .../sdk-client-required/client/client.gen.ts | 13 +++++++++---- .../tsconfig-nodenext-sdk/client/client.gen.ts | 13 +++++++++---- .../3.1.x/headers/client/client.gen.ts | 7 +++++-- .../internal-name-conflict/client/client.gen.ts | 7 +++++-- .../3.1.x/pagination-ref/client/client.gen.ts | 7 +++++-- .../parameter-explode-false/client/client.gen.ts | 7 +++++-- .../client/client.gen.ts | 7 +++++-- .../sdk-nested-classes/client/client.gen.ts | 7 +++++-- .../@hey-api/sdk/default/client/client.gen.ts | 7 +++++-- .../@hey-api/sdk/instance/client/client.gen.ts | 7 +++++-- .../@hey-api/sdk/throwOnError/client/client.gen.ts | 7 +++++-- .../type-format-valibot/client/client.gen.ts | 7 +++++-- .../type-format-zod/client/client.gen.ts | 7 +++++-- .../client/client.gen.ts | 7 +++++-- .../client/client.gen.ts | 7 +++++-- .../@pinia/colada/fetch/client/client.gen.ts | 7 +++++-- .../@pinia/colada/group-by-tag/client/client.gen.ts | 7 +++++-- .../asClass/client/client.gen.ts | 7 +++++-- .../fetch/client/client.gen.ts | 7 +++++-- .../name-builder/client/client.gen.ts | 7 +++++-- .../react-query/asClass/client/client.gen.ts | 7 +++++-- .../react-query/fetch/client/client.gen.ts | 7 +++++-- .../react-query/name-builder/client/client.gen.ts | 7 +++++-- .../solid-query/asClass/client/client.gen.ts | 7 +++++-- .../solid-query/fetch/client/client.gen.ts | 7 +++++-- .../solid-query/name-builder/client/client.gen.ts | 7 +++++-- .../svelte-query/asClass/client/client.gen.ts | 7 +++++-- .../svelte-query/fetch/client/client.gen.ts | 7 +++++-- .../svelte-query/name-builder/client/client.gen.ts | 7 +++++-- .../vue-query/asClass/client/client.gen.ts | 7 +++++-- .../@tanstack/vue-query/fetch/client/client.gen.ts | 7 +++++-- .../vue-query/name-builder/client/client.gen.ts | 7 +++++-- .../3.1.x/security-api-key/client/client.gen.ts | 7 +++++-- .../3.1.x/security-false/client/client.gen.ts | 7 +++++-- .../3.1.x/security-http-bearer/client/client.gen.ts | 7 +++++-- .../3.1.x/security-oauth2/client/client.gen.ts | 7 +++++-- .../security-open-id-connect/client/client.gen.ts | 7 +++++-- .../3.1.x/servers/client/client.gen.ts | 7 +++++-- .../3.1.x/sse-fetch/client/client.gen.ts | 7 +++++-- .../3.1.x/sse-next/client/client.gen.ts | 13 +++++++++---- .../3.1.x/transformers-all-of/client/client.gen.ts | 7 +++++-- .../transformers-any-of-null/client/client.gen.ts | 7 +++++-- .../3.1.x/transformers-array/client/client.gen.ts | 7 +++++-- .../transforms-read-write/client/client.gen.ts | 7 +++++-- .../plugins/@tanstack/meta/client/client.gen.ts | 7 +++++-- .../generated/v3_no_index/client/client.gen.ts.snap | 7 +++++-- 139 files changed, 735 insertions(+), 298 deletions(-) diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/body-response-text-plain/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/body-response-text-plain/client/client.gen.ts index f68339318..ff0238aec 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/body-response-text-plain/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/body-response-text-plain/client/client.gen.ts @@ -65,7 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.serializedBody === undefined || opts.serializedBody === '') { + if (opts.body === undefined || opts.body === '') { opts.headers.delete('Content-Type'); } @@ -80,9 +80,12 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, - body: opts.serializedBody, }; + if (opts.serializedBody) { + requestInit.body = opts.serializedBody; + } + let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/form-data/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/form-data/client/client.gen.ts index f68339318..ff0238aec 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/form-data/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/form-data/client/client.gen.ts @@ -65,7 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.serializedBody === undefined || opts.serializedBody === '') { + if (opts.body === undefined || opts.body === '') { opts.headers.delete('Content-Type'); } @@ -80,9 +80,12 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, - body: opts.serializedBody, }; + if (opts.serializedBody) { + requestInit.body = opts.serializedBody; + } + let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/client-fetch/sdk-nested-classes-instance/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/client-fetch/sdk-nested-classes-instance/client/client.gen.ts index f68339318..ff0238aec 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/client-fetch/sdk-nested-classes-instance/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/client-fetch/sdk-nested-classes-instance/client/client.gen.ts @@ -65,7 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.serializedBody === undefined || opts.serializedBody === '') { + if (opts.body === undefined || opts.body === '') { opts.headers.delete('Content-Type'); } @@ -80,9 +80,12 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, - body: opts.serializedBody, }; + if (opts.serializedBody) { + requestInit.body = opts.serializedBody; + } + let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/client-fetch/sdk-nested-classes/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/client-fetch/sdk-nested-classes/client/client.gen.ts index f68339318..ff0238aec 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/client-fetch/sdk-nested-classes/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/client-fetch/sdk-nested-classes/client/client.gen.ts @@ -65,7 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.serializedBody === undefined || opts.serializedBody === '') { + if (opts.body === undefined || opts.body === '') { opts.headers.delete('Content-Type'); } @@ -80,9 +80,12 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, - body: opts.serializedBody, }; + if (opts.serializedBody) { + requestInit.body = opts.serializedBody; + } + let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/sdk/default/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/sdk/default/client/client.gen.ts index f68339318..ff0238aec 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/sdk/default/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/sdk/default/client/client.gen.ts @@ -65,7 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.serializedBody === undefined || opts.serializedBody === '') { + if (opts.body === undefined || opts.body === '') { opts.headers.delete('Content-Type'); } @@ -80,9 +80,12 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, - body: opts.serializedBody, }; + if (opts.serializedBody) { + requestInit.body = opts.serializedBody; + } + let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/sdk/instance/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/sdk/instance/client/client.gen.ts index f68339318..ff0238aec 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/sdk/instance/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/sdk/instance/client/client.gen.ts @@ -65,7 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.serializedBody === undefined || opts.serializedBody === '') { + if (opts.body === undefined || opts.body === '') { opts.headers.delete('Content-Type'); } @@ -80,9 +80,12 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, - body: opts.serializedBody, }; + if (opts.serializedBody) { + requestInit.body = opts.serializedBody; + } + let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/sdk/throwOnError/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/sdk/throwOnError/client/client.gen.ts index f68339318..ff0238aec 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/sdk/throwOnError/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/sdk/throwOnError/client/client.gen.ts @@ -65,7 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.serializedBody === undefined || opts.serializedBody === '') { + if (opts.body === undefined || opts.body === '') { opts.headers.delete('Content-Type'); } @@ -80,9 +80,12 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, - body: opts.serializedBody, }; + if (opts.serializedBody) { + requestInit.body = opts.serializedBody; + } + let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/transformers/type-format-valibot/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/transformers/type-format-valibot/client/client.gen.ts index f68339318..ff0238aec 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/transformers/type-format-valibot/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/transformers/type-format-valibot/client/client.gen.ts @@ -65,7 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.serializedBody === undefined || opts.serializedBody === '') { + if (opts.body === undefined || opts.body === '') { opts.headers.delete('Content-Type'); } @@ -80,9 +80,12 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, - body: opts.serializedBody, }; + if (opts.serializedBody) { + requestInit.body = opts.serializedBody; + } + let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/transformers/type-format-zod/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/transformers/type-format-zod/client/client.gen.ts index f68339318..ff0238aec 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/transformers/type-format-zod/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/transformers/type-format-zod/client/client.gen.ts @@ -65,7 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.serializedBody === undefined || opts.serializedBody === '') { + if (opts.body === undefined || opts.body === '') { opts.headers.delete('Content-Type'); } @@ -80,9 +80,12 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, - body: opts.serializedBody, }; + if (opts.serializedBody) { + requestInit.body = opts.serializedBody; + } + let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/typescript/transforms-read-write-custom-name/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/typescript/transforms-read-write-custom-name/client/client.gen.ts index f68339318..ff0238aec 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/typescript/transforms-read-write-custom-name/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/typescript/transforms-read-write-custom-name/client/client.gen.ts @@ -65,7 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.serializedBody === undefined || opts.serializedBody === '') { + if (opts.body === undefined || opts.body === '') { opts.headers.delete('Content-Type'); } @@ -80,9 +80,12 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, - body: opts.serializedBody, }; + if (opts.serializedBody) { + requestInit.body = opts.serializedBody; + } + let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/typescript/transforms-read-write-ignore/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/typescript/transforms-read-write-ignore/client/client.gen.ts index f68339318..ff0238aec 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/typescript/transforms-read-write-ignore/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/typescript/transforms-read-write-ignore/client/client.gen.ts @@ -65,7 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.serializedBody === undefined || opts.serializedBody === '') { + if (opts.body === undefined || opts.body === '') { opts.headers.delete('Content-Type'); } @@ -80,9 +80,12 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, - body: opts.serializedBody, }; + if (opts.serializedBody) { + requestInit.body = opts.serializedBody; + } + let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@pinia/colada/fetch/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@pinia/colada/fetch/client/client.gen.ts index f68339318..ff0238aec 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@pinia/colada/fetch/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@pinia/colada/fetch/client/client.gen.ts @@ -65,7 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.serializedBody === undefined || opts.serializedBody === '') { + if (opts.body === undefined || opts.body === '') { opts.headers.delete('Content-Type'); } @@ -80,9 +80,12 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, - body: opts.serializedBody, }; + if (opts.serializedBody) { + requestInit.body = opts.serializedBody; + } + let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@pinia/colada/group-by-tag/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@pinia/colada/group-by-tag/client/client.gen.ts index f68339318..ff0238aec 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@pinia/colada/group-by-tag/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@pinia/colada/group-by-tag/client/client.gen.ts @@ -65,7 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.serializedBody === undefined || opts.serializedBody === '') { + if (opts.body === undefined || opts.body === '') { opts.headers.delete('Content-Type'); } @@ -80,9 +80,12 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, - body: opts.serializedBody, }; + if (opts.serializedBody) { + requestInit.body = opts.serializedBody; + } + let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/asClass/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/asClass/client/client.gen.ts index f68339318..ff0238aec 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/asClass/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/asClass/client/client.gen.ts @@ -65,7 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.serializedBody === undefined || opts.serializedBody === '') { + if (opts.body === undefined || opts.body === '') { opts.headers.delete('Content-Type'); } @@ -80,9 +80,12 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, - body: opts.serializedBody, }; + if (opts.serializedBody) { + requestInit.body = opts.serializedBody; + } + let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/fetch/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/fetch/client/client.gen.ts index f68339318..ff0238aec 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/fetch/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/fetch/client/client.gen.ts @@ -65,7 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.serializedBody === undefined || opts.serializedBody === '') { + if (opts.body === undefined || opts.body === '') { opts.headers.delete('Content-Type'); } @@ -80,9 +80,12 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, - body: opts.serializedBody, }; + if (opts.serializedBody) { + requestInit.body = opts.serializedBody; + } + let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/name-builder/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/name-builder/client/client.gen.ts index f68339318..ff0238aec 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/name-builder/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/name-builder/client/client.gen.ts @@ -65,7 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.serializedBody === undefined || opts.serializedBody === '') { + if (opts.body === undefined || opts.body === '') { opts.headers.delete('Content-Type'); } @@ -80,9 +80,12 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, - body: opts.serializedBody, }; + if (opts.serializedBody) { + requestInit.body = opts.serializedBody; + } + let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/react-query/asClass/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/react-query/asClass/client/client.gen.ts index f68339318..ff0238aec 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/react-query/asClass/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/react-query/asClass/client/client.gen.ts @@ -65,7 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.serializedBody === undefined || opts.serializedBody === '') { + if (opts.body === undefined || opts.body === '') { opts.headers.delete('Content-Type'); } @@ -80,9 +80,12 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, - body: opts.serializedBody, }; + if (opts.serializedBody) { + requestInit.body = opts.serializedBody; + } + let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/react-query/fetch/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/react-query/fetch/client/client.gen.ts index f68339318..ff0238aec 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/react-query/fetch/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/react-query/fetch/client/client.gen.ts @@ -65,7 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.serializedBody === undefined || opts.serializedBody === '') { + if (opts.body === undefined || opts.body === '') { opts.headers.delete('Content-Type'); } @@ -80,9 +80,12 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, - body: opts.serializedBody, }; + if (opts.serializedBody) { + requestInit.body = opts.serializedBody; + } + let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/react-query/name-builder/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/react-query/name-builder/client/client.gen.ts index f68339318..ff0238aec 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/react-query/name-builder/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/react-query/name-builder/client/client.gen.ts @@ -65,7 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.serializedBody === undefined || opts.serializedBody === '') { + if (opts.body === undefined || opts.body === '') { opts.headers.delete('Content-Type'); } @@ -80,9 +80,12 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, - body: opts.serializedBody, }; + if (opts.serializedBody) { + requestInit.body = opts.serializedBody; + } + let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/solid-query/asClass/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/solid-query/asClass/client/client.gen.ts index f68339318..ff0238aec 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/solid-query/asClass/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/solid-query/asClass/client/client.gen.ts @@ -65,7 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.serializedBody === undefined || opts.serializedBody === '') { + if (opts.body === undefined || opts.body === '') { opts.headers.delete('Content-Type'); } @@ -80,9 +80,12 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, - body: opts.serializedBody, }; + if (opts.serializedBody) { + requestInit.body = opts.serializedBody; + } + let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/solid-query/fetch/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/solid-query/fetch/client/client.gen.ts index f68339318..ff0238aec 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/solid-query/fetch/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/solid-query/fetch/client/client.gen.ts @@ -65,7 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.serializedBody === undefined || opts.serializedBody === '') { + if (opts.body === undefined || opts.body === '') { opts.headers.delete('Content-Type'); } @@ -80,9 +80,12 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, - body: opts.serializedBody, }; + if (opts.serializedBody) { + requestInit.body = opts.serializedBody; + } + let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/solid-query/name-builder/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/solid-query/name-builder/client/client.gen.ts index f68339318..ff0238aec 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/solid-query/name-builder/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/solid-query/name-builder/client/client.gen.ts @@ -65,7 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.serializedBody === undefined || opts.serializedBody === '') { + if (opts.body === undefined || opts.body === '') { opts.headers.delete('Content-Type'); } @@ -80,9 +80,12 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, - body: opts.serializedBody, }; + if (opts.serializedBody) { + requestInit.body = opts.serializedBody; + } + let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/svelte-query/asClass/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/svelte-query/asClass/client/client.gen.ts index f68339318..ff0238aec 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/svelte-query/asClass/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/svelte-query/asClass/client/client.gen.ts @@ -65,7 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.serializedBody === undefined || opts.serializedBody === '') { + if (opts.body === undefined || opts.body === '') { opts.headers.delete('Content-Type'); } @@ -80,9 +80,12 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, - body: opts.serializedBody, }; + if (opts.serializedBody) { + requestInit.body = opts.serializedBody; + } + let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/svelte-query/fetch/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/svelte-query/fetch/client/client.gen.ts index f68339318..ff0238aec 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/svelte-query/fetch/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/svelte-query/fetch/client/client.gen.ts @@ -65,7 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.serializedBody === undefined || opts.serializedBody === '') { + if (opts.body === undefined || opts.body === '') { opts.headers.delete('Content-Type'); } @@ -80,9 +80,12 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, - body: opts.serializedBody, }; + if (opts.serializedBody) { + requestInit.body = opts.serializedBody; + } + let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/svelte-query/name-builder/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/svelte-query/name-builder/client/client.gen.ts index f68339318..ff0238aec 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/svelte-query/name-builder/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/svelte-query/name-builder/client/client.gen.ts @@ -65,7 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.serializedBody === undefined || opts.serializedBody === '') { + if (opts.body === undefined || opts.body === '') { opts.headers.delete('Content-Type'); } @@ -80,9 +80,12 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, - body: opts.serializedBody, }; + if (opts.serializedBody) { + requestInit.body = opts.serializedBody; + } + let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/vue-query/asClass/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/vue-query/asClass/client/client.gen.ts index f68339318..ff0238aec 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/vue-query/asClass/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/vue-query/asClass/client/client.gen.ts @@ -65,7 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.serializedBody === undefined || opts.serializedBody === '') { + if (opts.body === undefined || opts.body === '') { opts.headers.delete('Content-Type'); } @@ -80,9 +80,12 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, - body: opts.serializedBody, }; + if (opts.serializedBody) { + requestInit.body = opts.serializedBody; + } + let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/vue-query/fetch/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/vue-query/fetch/client/client.gen.ts index f68339318..ff0238aec 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/vue-query/fetch/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/vue-query/fetch/client/client.gen.ts @@ -65,7 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.serializedBody === undefined || opts.serializedBody === '') { + if (opts.body === undefined || opts.body === '') { opts.headers.delete('Content-Type'); } @@ -80,9 +80,12 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, - body: opts.serializedBody, }; + if (opts.serializedBody) { + requestInit.body = opts.serializedBody; + } + let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/vue-query/name-builder/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/vue-query/name-builder/client/client.gen.ts index f68339318..ff0238aec 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/vue-query/name-builder/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/vue-query/name-builder/client/client.gen.ts @@ -65,7 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.serializedBody === undefined || opts.serializedBody === '') { + if (opts.body === undefined || opts.body === '') { opts.headers.delete('Content-Type'); } @@ -80,9 +80,12 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, - body: opts.serializedBody, }; + if (opts.serializedBody) { + requestInit.body = opts.serializedBody; + } + let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/schema-unknown/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/schema-unknown/client/client.gen.ts index f68339318..ff0238aec 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/schema-unknown/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/schema-unknown/client/client.gen.ts @@ -65,7 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.serializedBody === undefined || opts.serializedBody === '') { + if (opts.body === undefined || opts.body === '') { opts.headers.delete('Content-Type'); } @@ -80,9 +80,12 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, - body: opts.serializedBody, }; + if (opts.serializedBody) { + requestInit.body = opts.serializedBody; + } + let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-api-key/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-api-key/client/client.gen.ts index f68339318..ff0238aec 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-api-key/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-api-key/client/client.gen.ts @@ -65,7 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.serializedBody === undefined || opts.serializedBody === '') { + if (opts.body === undefined || opts.body === '') { opts.headers.delete('Content-Type'); } @@ -80,9 +80,12 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, - body: opts.serializedBody, }; + if (opts.serializedBody) { + requestInit.body = opts.serializedBody; + } + let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-basic/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-basic/client/client.gen.ts index f68339318..ff0238aec 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-basic/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-basic/client/client.gen.ts @@ -65,7 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.serializedBody === undefined || opts.serializedBody === '') { + if (opts.body === undefined || opts.body === '') { opts.headers.delete('Content-Type'); } @@ -80,9 +80,12 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, - body: opts.serializedBody, }; + if (opts.serializedBody) { + requestInit.body = opts.serializedBody; + } + let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-false/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-false/client/client.gen.ts index f68339318..ff0238aec 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-false/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-false/client/client.gen.ts @@ -65,7 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.serializedBody === undefined || opts.serializedBody === '') { + if (opts.body === undefined || opts.body === '') { opts.headers.delete('Content-Type'); } @@ -80,9 +80,12 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, - body: opts.serializedBody, }; + if (opts.serializedBody) { + requestInit.body = opts.serializedBody; + } + let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-oauth2/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-oauth2/client/client.gen.ts index f68339318..ff0238aec 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-oauth2/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-oauth2/client/client.gen.ts @@ -65,7 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.serializedBody === undefined || opts.serializedBody === '') { + if (opts.body === undefined || opts.body === '') { opts.headers.delete('Content-Type'); } @@ -80,9 +80,12 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, - body: opts.serializedBody, }; + if (opts.serializedBody) { + requestInit.body = opts.serializedBody; + } + let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/servers-base-path/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/servers-base-path/client/client.gen.ts index f68339318..ff0238aec 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/servers-base-path/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/servers-base-path/client/client.gen.ts @@ -65,7 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.serializedBody === undefined || opts.serializedBody === '') { + if (opts.body === undefined || opts.body === '') { opts.headers.delete('Content-Type'); } @@ -80,9 +80,12 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, - body: opts.serializedBody, }; + if (opts.serializedBody) { + requestInit.body = opts.serializedBody; + } + let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/servers-host/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/servers-host/client/client.gen.ts index f68339318..ff0238aec 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/servers-host/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/servers-host/client/client.gen.ts @@ -65,7 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.serializedBody === undefined || opts.serializedBody === '') { + if (opts.body === undefined || opts.body === '') { opts.headers.delete('Content-Type'); } @@ -80,9 +80,12 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, - body: opts.serializedBody, }; + if (opts.serializedBody) { + requestInit.body = opts.serializedBody; + } + let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/servers/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/servers/client/client.gen.ts index f68339318..ff0238aec 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/servers/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/servers/client/client.gen.ts @@ -65,7 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.serializedBody === undefined || opts.serializedBody === '') { + if (opts.body === undefined || opts.body === '') { opts.headers.delete('Content-Type'); } @@ -80,9 +80,12 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, - body: opts.serializedBody, }; + if (opts.serializedBody) { + requestInit.body = opts.serializedBody; + } + let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/transforms-read-write/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/transforms-read-write/client/client.gen.ts index f68339318..ff0238aec 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/transforms-read-write/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/transforms-read-write/client/client.gen.ts @@ -65,7 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.serializedBody === undefined || opts.serializedBody === '') { + if (opts.body === undefined || opts.body === '') { opts.headers.delete('Content-Type'); } @@ -80,9 +80,12 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, - body: opts.serializedBody, }; + if (opts.serializedBody) { + requestInit.body = opts.serializedBody; + } + let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/body-response-text-plain/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/body-response-text-plain/client/client.gen.ts index f68339318..ff0238aec 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/body-response-text-plain/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/body-response-text-plain/client/client.gen.ts @@ -65,7 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.serializedBody === undefined || opts.serializedBody === '') { + if (opts.body === undefined || opts.body === '') { opts.headers.delete('Content-Type'); } @@ -80,9 +80,12 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, - body: opts.serializedBody, }; + if (opts.serializedBody) { + requestInit.body = opts.serializedBody; + } + let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/internal-name-conflict/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/internal-name-conflict/client/client.gen.ts index f68339318..ff0238aec 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/internal-name-conflict/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/internal-name-conflict/client/client.gen.ts @@ -65,7 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.serializedBody === undefined || opts.serializedBody === '') { + if (opts.body === undefined || opts.body === '') { opts.headers.delete('Content-Type'); } @@ -80,9 +80,12 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, - body: opts.serializedBody, }; + if (opts.serializedBody) { + requestInit.body = opts.serializedBody; + } + let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/parameter-explode-false/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/parameter-explode-false/client/client.gen.ts index f68339318..ff0238aec 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/parameter-explode-false/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/parameter-explode-false/client/client.gen.ts @@ -65,7 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.serializedBody === undefined || opts.serializedBody === '') { + if (opts.body === undefined || opts.body === '') { opts.headers.delete('Content-Type'); } @@ -80,9 +80,12 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, - body: opts.serializedBody, }; + if (opts.serializedBody) { + requestInit.body = opts.serializedBody; + } + let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/client-fetch/sdk-nested-classes-instance/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/client-fetch/sdk-nested-classes-instance/client/client.gen.ts index f68339318..ff0238aec 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/client-fetch/sdk-nested-classes-instance/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/client-fetch/sdk-nested-classes-instance/client/client.gen.ts @@ -65,7 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.serializedBody === undefined || opts.serializedBody === '') { + if (opts.body === undefined || opts.body === '') { opts.headers.delete('Content-Type'); } @@ -80,9 +80,12 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, - body: opts.serializedBody, }; + if (opts.serializedBody) { + requestInit.body = opts.serializedBody; + } + let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/client-fetch/sdk-nested-classes/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/client-fetch/sdk-nested-classes/client/client.gen.ts index f68339318..ff0238aec 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/client-fetch/sdk-nested-classes/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/client-fetch/sdk-nested-classes/client/client.gen.ts @@ -65,7 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.serializedBody === undefined || opts.serializedBody === '') { + if (opts.body === undefined || opts.body === '') { opts.headers.delete('Content-Type'); } @@ -80,9 +80,12 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, - body: opts.serializedBody, }; + if (opts.serializedBody) { + requestInit.body = opts.serializedBody; + } + let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/sdk/default/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/sdk/default/client/client.gen.ts index f68339318..ff0238aec 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/sdk/default/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/sdk/default/client/client.gen.ts @@ -65,7 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.serializedBody === undefined || opts.serializedBody === '') { + if (opts.body === undefined || opts.body === '') { opts.headers.delete('Content-Type'); } @@ -80,9 +80,12 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, - body: opts.serializedBody, }; + if (opts.serializedBody) { + requestInit.body = opts.serializedBody; + } + let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/sdk/instance/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/sdk/instance/client/client.gen.ts index f68339318..ff0238aec 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/sdk/instance/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/sdk/instance/client/client.gen.ts @@ -65,7 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.serializedBody === undefined || opts.serializedBody === '') { + if (opts.body === undefined || opts.body === '') { opts.headers.delete('Content-Type'); } @@ -80,9 +80,12 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, - body: opts.serializedBody, }; + if (opts.serializedBody) { + requestInit.body = opts.serializedBody; + } + let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/sdk/throwOnError/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/sdk/throwOnError/client/client.gen.ts index f68339318..ff0238aec 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/sdk/throwOnError/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/sdk/throwOnError/client/client.gen.ts @@ -65,7 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.serializedBody === undefined || opts.serializedBody === '') { + if (opts.body === undefined || opts.body === '') { opts.headers.delete('Content-Type'); } @@ -80,9 +80,12 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, - body: opts.serializedBody, }; + if (opts.serializedBody) { + requestInit.body = opts.serializedBody; + } + let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/transformers/type-format-valibot/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/transformers/type-format-valibot/client/client.gen.ts index f68339318..ff0238aec 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/transformers/type-format-valibot/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/transformers/type-format-valibot/client/client.gen.ts @@ -65,7 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.serializedBody === undefined || opts.serializedBody === '') { + if (opts.body === undefined || opts.body === '') { opts.headers.delete('Content-Type'); } @@ -80,9 +80,12 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, - body: opts.serializedBody, }; + if (opts.serializedBody) { + requestInit.body = opts.serializedBody; + } + let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/transformers/type-format-zod/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/transformers/type-format-zod/client/client.gen.ts index f68339318..ff0238aec 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/transformers/type-format-zod/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/transformers/type-format-zod/client/client.gen.ts @@ -65,7 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.serializedBody === undefined || opts.serializedBody === '') { + if (opts.body === undefined || opts.body === '') { opts.headers.delete('Content-Type'); } @@ -80,9 +80,12 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, - body: opts.serializedBody, }; + if (opts.serializedBody) { + requestInit.body = opts.serializedBody; + } + let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/typescript/transforms-read-write-custom-name/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/typescript/transforms-read-write-custom-name/client/client.gen.ts index f68339318..ff0238aec 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/typescript/transforms-read-write-custom-name/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/typescript/transforms-read-write-custom-name/client/client.gen.ts @@ -65,7 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.serializedBody === undefined || opts.serializedBody === '') { + if (opts.body === undefined || opts.body === '') { opts.headers.delete('Content-Type'); } @@ -80,9 +80,12 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, - body: opts.serializedBody, }; + if (opts.serializedBody) { + requestInit.body = opts.serializedBody; + } + let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/typescript/transforms-read-write-ignore/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/typescript/transforms-read-write-ignore/client/client.gen.ts index f68339318..ff0238aec 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/typescript/transforms-read-write-ignore/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/typescript/transforms-read-write-ignore/client/client.gen.ts @@ -65,7 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.serializedBody === undefined || opts.serializedBody === '') { + if (opts.body === undefined || opts.body === '') { opts.headers.delete('Content-Type'); } @@ -80,9 +80,12 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, - body: opts.serializedBody, }; + if (opts.serializedBody) { + requestInit.body = opts.serializedBody; + } + let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@pinia/colada/fetch/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@pinia/colada/fetch/client/client.gen.ts index f68339318..ff0238aec 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@pinia/colada/fetch/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@pinia/colada/fetch/client/client.gen.ts @@ -65,7 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.serializedBody === undefined || opts.serializedBody === '') { + if (opts.body === undefined || opts.body === '') { opts.headers.delete('Content-Type'); } @@ -80,9 +80,12 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, - body: opts.serializedBody, }; + if (opts.serializedBody) { + requestInit.body = opts.serializedBody; + } + let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@pinia/colada/group-by-tag/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@pinia/colada/group-by-tag/client/client.gen.ts index f68339318..ff0238aec 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@pinia/colada/group-by-tag/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@pinia/colada/group-by-tag/client/client.gen.ts @@ -65,7 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.serializedBody === undefined || opts.serializedBody === '') { + if (opts.body === undefined || opts.body === '') { opts.headers.delete('Content-Type'); } @@ -80,9 +80,12 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, - body: opts.serializedBody, }; + if (opts.serializedBody) { + requestInit.body = opts.serializedBody; + } + let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/angular-query-experimental/asClass/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/angular-query-experimental/asClass/client/client.gen.ts index f68339318..ff0238aec 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/angular-query-experimental/asClass/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/angular-query-experimental/asClass/client/client.gen.ts @@ -65,7 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.serializedBody === undefined || opts.serializedBody === '') { + if (opts.body === undefined || opts.body === '') { opts.headers.delete('Content-Type'); } @@ -80,9 +80,12 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, - body: opts.serializedBody, }; + if (opts.serializedBody) { + requestInit.body = opts.serializedBody; + } + let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/angular-query-experimental/fetch/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/angular-query-experimental/fetch/client/client.gen.ts index f68339318..ff0238aec 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/angular-query-experimental/fetch/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/angular-query-experimental/fetch/client/client.gen.ts @@ -65,7 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.serializedBody === undefined || opts.serializedBody === '') { + if (opts.body === undefined || opts.body === '') { opts.headers.delete('Content-Type'); } @@ -80,9 +80,12 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, - body: opts.serializedBody, }; + if (opts.serializedBody) { + requestInit.body = opts.serializedBody; + } + let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/angular-query-experimental/name-builder/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/angular-query-experimental/name-builder/client/client.gen.ts index f68339318..ff0238aec 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/angular-query-experimental/name-builder/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/angular-query-experimental/name-builder/client/client.gen.ts @@ -65,7 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.serializedBody === undefined || opts.serializedBody === '') { + if (opts.body === undefined || opts.body === '') { opts.headers.delete('Content-Type'); } @@ -80,9 +80,12 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, - body: opts.serializedBody, }; + if (opts.serializedBody) { + requestInit.body = opts.serializedBody; + } + let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/react-query/asClass/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/react-query/asClass/client/client.gen.ts index f68339318..ff0238aec 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/react-query/asClass/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/react-query/asClass/client/client.gen.ts @@ -65,7 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.serializedBody === undefined || opts.serializedBody === '') { + if (opts.body === undefined || opts.body === '') { opts.headers.delete('Content-Type'); } @@ -80,9 +80,12 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, - body: opts.serializedBody, }; + if (opts.serializedBody) { + requestInit.body = opts.serializedBody; + } + let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/react-query/fetch/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/react-query/fetch/client/client.gen.ts index f68339318..ff0238aec 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/react-query/fetch/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/react-query/fetch/client/client.gen.ts @@ -65,7 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.serializedBody === undefined || opts.serializedBody === '') { + if (opts.body === undefined || opts.body === '') { opts.headers.delete('Content-Type'); } @@ -80,9 +80,12 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, - body: opts.serializedBody, }; + if (opts.serializedBody) { + requestInit.body = opts.serializedBody; + } + let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/react-query/name-builder/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/react-query/name-builder/client/client.gen.ts index f68339318..ff0238aec 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/react-query/name-builder/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/react-query/name-builder/client/client.gen.ts @@ -65,7 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.serializedBody === undefined || opts.serializedBody === '') { + if (opts.body === undefined || opts.body === '') { opts.headers.delete('Content-Type'); } @@ -80,9 +80,12 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, - body: opts.serializedBody, }; + if (opts.serializedBody) { + requestInit.body = opts.serializedBody; + } + let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/solid-query/asClass/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/solid-query/asClass/client/client.gen.ts index f68339318..ff0238aec 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/solid-query/asClass/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/solid-query/asClass/client/client.gen.ts @@ -65,7 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.serializedBody === undefined || opts.serializedBody === '') { + if (opts.body === undefined || opts.body === '') { opts.headers.delete('Content-Type'); } @@ -80,9 +80,12 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, - body: opts.serializedBody, }; + if (opts.serializedBody) { + requestInit.body = opts.serializedBody; + } + let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/solid-query/fetch/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/solid-query/fetch/client/client.gen.ts index f68339318..ff0238aec 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/solid-query/fetch/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/solid-query/fetch/client/client.gen.ts @@ -65,7 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.serializedBody === undefined || opts.serializedBody === '') { + if (opts.body === undefined || opts.body === '') { opts.headers.delete('Content-Type'); } @@ -80,9 +80,12 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, - body: opts.serializedBody, }; + if (opts.serializedBody) { + requestInit.body = opts.serializedBody; + } + let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/solid-query/name-builder/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/solid-query/name-builder/client/client.gen.ts index f68339318..ff0238aec 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/solid-query/name-builder/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/solid-query/name-builder/client/client.gen.ts @@ -65,7 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.serializedBody === undefined || opts.serializedBody === '') { + if (opts.body === undefined || opts.body === '') { opts.headers.delete('Content-Type'); } @@ -80,9 +80,12 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, - body: opts.serializedBody, }; + if (opts.serializedBody) { + requestInit.body = opts.serializedBody; + } + let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/svelte-query/asClass/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/svelte-query/asClass/client/client.gen.ts index f68339318..ff0238aec 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/svelte-query/asClass/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/svelte-query/asClass/client/client.gen.ts @@ -65,7 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.serializedBody === undefined || opts.serializedBody === '') { + if (opts.body === undefined || opts.body === '') { opts.headers.delete('Content-Type'); } @@ -80,9 +80,12 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, - body: opts.serializedBody, }; + if (opts.serializedBody) { + requestInit.body = opts.serializedBody; + } + let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/svelte-query/fetch/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/svelte-query/fetch/client/client.gen.ts index f68339318..ff0238aec 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/svelte-query/fetch/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/svelte-query/fetch/client/client.gen.ts @@ -65,7 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.serializedBody === undefined || opts.serializedBody === '') { + if (opts.body === undefined || opts.body === '') { opts.headers.delete('Content-Type'); } @@ -80,9 +80,12 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, - body: opts.serializedBody, }; + if (opts.serializedBody) { + requestInit.body = opts.serializedBody; + } + let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/svelte-query/name-builder/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/svelte-query/name-builder/client/client.gen.ts index f68339318..ff0238aec 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/svelte-query/name-builder/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/svelte-query/name-builder/client/client.gen.ts @@ -65,7 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.serializedBody === undefined || opts.serializedBody === '') { + if (opts.body === undefined || opts.body === '') { opts.headers.delete('Content-Type'); } @@ -80,9 +80,12 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, - body: opts.serializedBody, }; + if (opts.serializedBody) { + requestInit.body = opts.serializedBody; + } + let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/vue-query/asClass/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/vue-query/asClass/client/client.gen.ts index f68339318..ff0238aec 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/vue-query/asClass/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/vue-query/asClass/client/client.gen.ts @@ -65,7 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.serializedBody === undefined || opts.serializedBody === '') { + if (opts.body === undefined || opts.body === '') { opts.headers.delete('Content-Type'); } @@ -80,9 +80,12 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, - body: opts.serializedBody, }; + if (opts.serializedBody) { + requestInit.body = opts.serializedBody; + } + let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/vue-query/fetch/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/vue-query/fetch/client/client.gen.ts index f68339318..ff0238aec 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/vue-query/fetch/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/vue-query/fetch/client/client.gen.ts @@ -65,7 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.serializedBody === undefined || opts.serializedBody === '') { + if (opts.body === undefined || opts.body === '') { opts.headers.delete('Content-Type'); } @@ -80,9 +80,12 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, - body: opts.serializedBody, }; + if (opts.serializedBody) { + requestInit.body = opts.serializedBody; + } + let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/vue-query/name-builder/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/vue-query/name-builder/client/client.gen.ts index f68339318..ff0238aec 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/vue-query/name-builder/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/vue-query/name-builder/client/client.gen.ts @@ -65,7 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.serializedBody === undefined || opts.serializedBody === '') { + if (opts.body === undefined || opts.body === '') { opts.headers.delete('Content-Type'); } @@ -80,9 +80,12 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, - body: opts.serializedBody, }; + if (opts.serializedBody) { + requestInit.body = opts.serializedBody; + } + let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-api-key/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-api-key/client/client.gen.ts index f68339318..ff0238aec 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-api-key/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-api-key/client/client.gen.ts @@ -65,7 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.serializedBody === undefined || opts.serializedBody === '') { + if (opts.body === undefined || opts.body === '') { opts.headers.delete('Content-Type'); } @@ -80,9 +80,12 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, - body: opts.serializedBody, }; + if (opts.serializedBody) { + requestInit.body = opts.serializedBody; + } + let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-false/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-false/client/client.gen.ts index f68339318..ff0238aec 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-false/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-false/client/client.gen.ts @@ -65,7 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.serializedBody === undefined || opts.serializedBody === '') { + if (opts.body === undefined || opts.body === '') { opts.headers.delete('Content-Type'); } @@ -80,9 +80,12 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, - body: opts.serializedBody, }; + if (opts.serializedBody) { + requestInit.body = opts.serializedBody; + } + let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-http-bearer/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-http-bearer/client/client.gen.ts index f68339318..ff0238aec 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-http-bearer/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-http-bearer/client/client.gen.ts @@ -65,7 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.serializedBody === undefined || opts.serializedBody === '') { + if (opts.body === undefined || opts.body === '') { opts.headers.delete('Content-Type'); } @@ -80,9 +80,12 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, - body: opts.serializedBody, }; + if (opts.serializedBody) { + requestInit.body = opts.serializedBody; + } + let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-oauth2/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-oauth2/client/client.gen.ts index f68339318..ff0238aec 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-oauth2/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-oauth2/client/client.gen.ts @@ -65,7 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.serializedBody === undefined || opts.serializedBody === '') { + if (opts.body === undefined || opts.body === '') { opts.headers.delete('Content-Type'); } @@ -80,9 +80,12 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, - body: opts.serializedBody, }; + if (opts.serializedBody) { + requestInit.body = opts.serializedBody; + } + let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-open-id-connect/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-open-id-connect/client/client.gen.ts index f68339318..ff0238aec 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-open-id-connect/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-open-id-connect/client/client.gen.ts @@ -65,7 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.serializedBody === undefined || opts.serializedBody === '') { + if (opts.body === undefined || opts.body === '') { opts.headers.delete('Content-Type'); } @@ -80,9 +80,12 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, - body: opts.serializedBody, }; + if (opts.serializedBody) { + requestInit.body = opts.serializedBody; + } + let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/servers/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/servers/client/client.gen.ts index f68339318..ff0238aec 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/servers/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/servers/client/client.gen.ts @@ -65,7 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.serializedBody === undefined || opts.serializedBody === '') { + if (opts.body === undefined || opts.body === '') { opts.headers.delete('Content-Type'); } @@ -80,9 +80,12 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, - body: opts.serializedBody, }; + if (opts.serializedBody) { + requestInit.body = opts.serializedBody; + } + let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transformers-all-of/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transformers-all-of/client/client.gen.ts index f68339318..ff0238aec 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transformers-all-of/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transformers-all-of/client/client.gen.ts @@ -65,7 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.serializedBody === undefined || opts.serializedBody === '') { + if (opts.body === undefined || opts.body === '') { opts.headers.delete('Content-Type'); } @@ -80,9 +80,12 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, - body: opts.serializedBody, }; + if (opts.serializedBody) { + requestInit.body = opts.serializedBody; + } + let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transformers-any-of-null/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transformers-any-of-null/client/client.gen.ts index f68339318..ff0238aec 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transformers-any-of-null/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transformers-any-of-null/client/client.gen.ts @@ -65,7 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.serializedBody === undefined || opts.serializedBody === '') { + if (opts.body === undefined || opts.body === '') { opts.headers.delete('Content-Type'); } @@ -80,9 +80,12 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, - body: opts.serializedBody, }; + if (opts.serializedBody) { + requestInit.body = opts.serializedBody; + } + let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transformers-array/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transformers-array/client/client.gen.ts index f68339318..ff0238aec 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transformers-array/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transformers-array/client/client.gen.ts @@ -65,7 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.serializedBody === undefined || opts.serializedBody === '') { + if (opts.body === undefined || opts.body === '') { opts.headers.delete('Content-Type'); } @@ -80,9 +80,12 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, - body: opts.serializedBody, }; + if (opts.serializedBody) { + requestInit.body = opts.serializedBody; + } + let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transforms-read-write/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transforms-read-write/client/client.gen.ts index f68339318..ff0238aec 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transforms-read-write/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transforms-read-write/client/client.gen.ts @@ -65,7 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.serializedBody === undefined || opts.serializedBody === '') { + if (opts.body === undefined || opts.body === '') { opts.headers.delete('Content-Type'); } @@ -80,9 +80,12 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, - body: opts.serializedBody, }; + if (opts.serializedBody) { + requestInit.body = opts.serializedBody; + } + let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/body-response-text-plain/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/body-response-text-plain/client/client.gen.ts index f68339318..ff0238aec 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/body-response-text-plain/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/body-response-text-plain/client/client.gen.ts @@ -65,7 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.serializedBody === undefined || opts.serializedBody === '') { + if (opts.body === undefined || opts.body === '') { opts.headers.delete('Content-Type'); } @@ -80,9 +80,12 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, - body: opts.serializedBody, }; + if (opts.serializedBody) { + requestInit.body = opts.serializedBody; + } + let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-false/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-false/client/client.gen.ts index f68339318..ff0238aec 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-false/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-false/client/client.gen.ts @@ -65,7 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.serializedBody === undefined || opts.serializedBody === '') { + if (opts.body === undefined || opts.body === '') { opts.headers.delete('Content-Type'); } @@ -80,9 +80,12 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, - body: opts.serializedBody, }; + if (opts.serializedBody) { + requestInit.body = opts.serializedBody; + } + let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-number/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-number/client/client.gen.ts index f68339318..ff0238aec 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-number/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-number/client/client.gen.ts @@ -65,7 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.serializedBody === undefined || opts.serializedBody === '') { + if (opts.body === undefined || opts.body === '') { opts.headers.delete('Content-Type'); } @@ -80,9 +80,12 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, - body: opts.serializedBody, }; + if (opts.serializedBody) { + requestInit.body = opts.serializedBody; + } + let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-strict/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-strict/client/client.gen.ts index f68339318..ff0238aec 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-strict/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-strict/client/client.gen.ts @@ -65,7 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.serializedBody === undefined || opts.serializedBody === '') { + if (opts.body === undefined || opts.body === '') { opts.headers.delete('Content-Type'); } @@ -80,9 +80,12 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, - body: opts.serializedBody, }; + if (opts.serializedBody) { + requestInit.body = opts.serializedBody; + } + let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-string/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-string/client/client.gen.ts index f68339318..ff0238aec 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-string/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-string/client/client.gen.ts @@ -65,7 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.serializedBody === undefined || opts.serializedBody === '') { + if (opts.body === undefined || opts.body === '') { opts.headers.delete('Content-Type'); } @@ -80,9 +80,12 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, - body: opts.serializedBody, }; + if (opts.serializedBody) { + requestInit.body = opts.serializedBody; + } + let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/clean-false/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/clean-false/client/client.gen.ts index f68339318..ff0238aec 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/clean-false/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/clean-false/client/client.gen.ts @@ -65,7 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.serializedBody === undefined || opts.serializedBody === '') { + if (opts.body === undefined || opts.body === '') { opts.headers.delete('Content-Type'); } @@ -80,9 +80,12 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, - body: opts.serializedBody, }; + if (opts.serializedBody) { + requestInit.body = opts.serializedBody; + } + let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/default/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/default/client/client.gen.ts index f68339318..ff0238aec 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/default/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/default/client/client.gen.ts @@ -65,7 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.serializedBody === undefined || opts.serializedBody === '') { + if (opts.body === undefined || opts.body === '') { opts.headers.delete('Content-Type'); } @@ -80,9 +80,12 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, - body: opts.serializedBody, }; + if (opts.serializedBody) { + requestInit.body = opts.serializedBody; + } + let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/sdk-client-optional/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/sdk-client-optional/client/client.gen.ts index f68339318..ff0238aec 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/sdk-client-optional/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/sdk-client-optional/client/client.gen.ts @@ -65,7 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.serializedBody === undefined || opts.serializedBody === '') { + if (opts.body === undefined || opts.body === '') { opts.headers.delete('Content-Type'); } @@ -80,9 +80,12 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, - body: opts.serializedBody, }; + if (opts.serializedBody) { + requestInit.body = opts.serializedBody; + } + let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/sdk-client-required/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/sdk-client-required/client/client.gen.ts index f68339318..ff0238aec 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/sdk-client-required/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/sdk-client-required/client/client.gen.ts @@ -65,7 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.serializedBody === undefined || opts.serializedBody === '') { + if (opts.body === undefined || opts.body === '') { opts.headers.delete('Content-Type'); } @@ -80,9 +80,12 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, - body: opts.serializedBody, }; + if (opts.serializedBody) { + requestInit.body = opts.serializedBody; + } + let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/tsconfig-nodenext-sdk/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/tsconfig-nodenext-sdk/client/client.gen.ts index 136c0eb5d..55d5140a5 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/tsconfig-nodenext-sdk/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/tsconfig-nodenext-sdk/client/client.gen.ts @@ -65,7 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.serializedBody === undefined || opts.serializedBody === '') { + if (opts.body === undefined || opts.body === '') { opts.headers.delete('Content-Type'); } @@ -80,9 +80,12 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, - body: opts.serializedBody, }; + if (opts.serializedBody) { + requestInit.body = opts.serializedBody; + } + let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-false/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-false/client/client.gen.ts index 9a3f20891..17450b9b5 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-false/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-false/client/client.gen.ts @@ -64,7 +64,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.serializedBody === undefined || opts.serializedBody === '') { + if (opts.body === undefined || opts.body === '') { opts.headers.delete('Content-Type'); } @@ -87,10 +87,15 @@ export const createClient = (config: Config = {}): Client => { // fetch must be assigned here, otherwise it would throw the error: // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation const _fetch = opts.fetch!; - let response = await _fetch(url, { + const requestInit: ReqInit = { ...opts, - body: opts.serializedBody as ReqInit['body'], - }); + }; + + if (opts.serializedBody) { + requestInit.body = opts.serializedBody; + } + + let response = await _fetch(url, requestInit); for (const fn of interceptors.response._fns) { if (fn) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-number/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-number/client/client.gen.ts index 9a3f20891..17450b9b5 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-number/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-number/client/client.gen.ts @@ -64,7 +64,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.serializedBody === undefined || opts.serializedBody === '') { + if (opts.body === undefined || opts.body === '') { opts.headers.delete('Content-Type'); } @@ -87,10 +87,15 @@ export const createClient = (config: Config = {}): Client => { // fetch must be assigned here, otherwise it would throw the error: // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation const _fetch = opts.fetch!; - let response = await _fetch(url, { + const requestInit: ReqInit = { ...opts, - body: opts.serializedBody as ReqInit['body'], - }); + }; + + if (opts.serializedBody) { + requestInit.body = opts.serializedBody; + } + + let response = await _fetch(url, requestInit); for (const fn of interceptors.response._fns) { if (fn) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-strict/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-strict/client/client.gen.ts index 9a3f20891..17450b9b5 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-strict/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-strict/client/client.gen.ts @@ -64,7 +64,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.serializedBody === undefined || opts.serializedBody === '') { + if (opts.body === undefined || opts.body === '') { opts.headers.delete('Content-Type'); } @@ -87,10 +87,15 @@ export const createClient = (config: Config = {}): Client => { // fetch must be assigned here, otherwise it would throw the error: // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation const _fetch = opts.fetch!; - let response = await _fetch(url, { + const requestInit: ReqInit = { ...opts, - body: opts.serializedBody as ReqInit['body'], - }); + }; + + if (opts.serializedBody) { + requestInit.body = opts.serializedBody; + } + + let response = await _fetch(url, requestInit); for (const fn of interceptors.response._fns) { if (fn) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-string/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-string/client/client.gen.ts index 9a3f20891..17450b9b5 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-string/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-string/client/client.gen.ts @@ -64,7 +64,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.serializedBody === undefined || opts.serializedBody === '') { + if (opts.body === undefined || opts.body === '') { opts.headers.delete('Content-Type'); } @@ -87,10 +87,15 @@ export const createClient = (config: Config = {}): Client => { // fetch must be assigned here, otherwise it would throw the error: // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation const _fetch = opts.fetch!; - let response = await _fetch(url, { + const requestInit: ReqInit = { ...opts, - body: opts.serializedBody as ReqInit['body'], - }); + }; + + if (opts.serializedBody) { + requestInit.body = opts.serializedBody; + } + + let response = await _fetch(url, requestInit); for (const fn of interceptors.response._fns) { if (fn) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/clean-false/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/clean-false/client/client.gen.ts index 9a3f20891..17450b9b5 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/clean-false/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/clean-false/client/client.gen.ts @@ -64,7 +64,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.serializedBody === undefined || opts.serializedBody === '') { + if (opts.body === undefined || opts.body === '') { opts.headers.delete('Content-Type'); } @@ -87,10 +87,15 @@ export const createClient = (config: Config = {}): Client => { // fetch must be assigned here, otherwise it would throw the error: // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation const _fetch = opts.fetch!; - let response = await _fetch(url, { + const requestInit: ReqInit = { ...opts, - body: opts.serializedBody as ReqInit['body'], - }); + }; + + if (opts.serializedBody) { + requestInit.body = opts.serializedBody; + } + + let response = await _fetch(url, requestInit); for (const fn of interceptors.response._fns) { if (fn) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/default/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/default/client/client.gen.ts index 9a3f20891..17450b9b5 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/default/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/default/client/client.gen.ts @@ -64,7 +64,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.serializedBody === undefined || opts.serializedBody === '') { + if (opts.body === undefined || opts.body === '') { opts.headers.delete('Content-Type'); } @@ -87,10 +87,15 @@ export const createClient = (config: Config = {}): Client => { // fetch must be assigned here, otherwise it would throw the error: // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation const _fetch = opts.fetch!; - let response = await _fetch(url, { + const requestInit: ReqInit = { ...opts, - body: opts.serializedBody as ReqInit['body'], - }); + }; + + if (opts.serializedBody) { + requestInit.body = opts.serializedBody; + } + + let response = await _fetch(url, requestInit); for (const fn of interceptors.response._fns) { if (fn) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/sdk-client-optional/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/sdk-client-optional/client/client.gen.ts index 9a3f20891..17450b9b5 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/sdk-client-optional/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/sdk-client-optional/client/client.gen.ts @@ -64,7 +64,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.serializedBody === undefined || opts.serializedBody === '') { + if (opts.body === undefined || opts.body === '') { opts.headers.delete('Content-Type'); } @@ -87,10 +87,15 @@ export const createClient = (config: Config = {}): Client => { // fetch must be assigned here, otherwise it would throw the error: // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation const _fetch = opts.fetch!; - let response = await _fetch(url, { + const requestInit: ReqInit = { ...opts, - body: opts.serializedBody as ReqInit['body'], - }); + }; + + if (opts.serializedBody) { + requestInit.body = opts.serializedBody; + } + + let response = await _fetch(url, requestInit); for (const fn of interceptors.response._fns) { if (fn) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/sdk-client-required/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/sdk-client-required/client/client.gen.ts index 9a3f20891..17450b9b5 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/sdk-client-required/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/sdk-client-required/client/client.gen.ts @@ -64,7 +64,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.serializedBody === undefined || opts.serializedBody === '') { + if (opts.body === undefined || opts.body === '') { opts.headers.delete('Content-Type'); } @@ -87,10 +87,15 @@ export const createClient = (config: Config = {}): Client => { // fetch must be assigned here, otherwise it would throw the error: // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation const _fetch = opts.fetch!; - let response = await _fetch(url, { + const requestInit: ReqInit = { ...opts, - body: opts.serializedBody as ReqInit['body'], - }); + }; + + if (opts.serializedBody) { + requestInit.body = opts.serializedBody; + } + + let response = await _fetch(url, requestInit); for (const fn of interceptors.response._fns) { if (fn) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/tsconfig-nodenext-sdk/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/tsconfig-nodenext-sdk/client/client.gen.ts index 3c5df8c21..1b6204c57 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/tsconfig-nodenext-sdk/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/tsconfig-nodenext-sdk/client/client.gen.ts @@ -64,7 +64,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.serializedBody === undefined || opts.serializedBody === '') { + if (opts.body === undefined || opts.body === '') { opts.headers.delete('Content-Type'); } @@ -87,10 +87,15 @@ export const createClient = (config: Config = {}): Client => { // fetch must be assigned here, otherwise it would throw the error: // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation const _fetch = opts.fetch!; - let response = await _fetch(url, { + const requestInit: ReqInit = { ...opts, - body: opts.serializedBody as ReqInit['body'], - }); + }; + + if (opts.serializedBody) { + requestInit.body = opts.serializedBody; + } + + let response = await _fetch(url, requestInit); for (const fn of interceptors.response._fns) { if (fn) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/headers/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/headers/client/client.gen.ts index f68339318..ff0238aec 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/headers/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/headers/client/client.gen.ts @@ -65,7 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.serializedBody === undefined || opts.serializedBody === '') { + if (opts.body === undefined || opts.body === '') { opts.headers.delete('Content-Type'); } @@ -80,9 +80,12 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, - body: opts.serializedBody, }; + if (opts.serializedBody) { + requestInit.body = opts.serializedBody; + } + let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/internal-name-conflict/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/internal-name-conflict/client/client.gen.ts index f68339318..ff0238aec 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/internal-name-conflict/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/internal-name-conflict/client/client.gen.ts @@ -65,7 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.serializedBody === undefined || opts.serializedBody === '') { + if (opts.body === undefined || opts.body === '') { opts.headers.delete('Content-Type'); } @@ -80,9 +80,12 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, - body: opts.serializedBody, }; + if (opts.serializedBody) { + requestInit.body = opts.serializedBody; + } + let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/pagination-ref/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/pagination-ref/client/client.gen.ts index f68339318..ff0238aec 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/pagination-ref/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/pagination-ref/client/client.gen.ts @@ -65,7 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.serializedBody === undefined || opts.serializedBody === '') { + if (opts.body === undefined || opts.body === '') { opts.headers.delete('Content-Type'); } @@ -80,9 +80,12 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, - body: opts.serializedBody, }; + if (opts.serializedBody) { + requestInit.body = opts.serializedBody; + } + let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/parameter-explode-false/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/parameter-explode-false/client/client.gen.ts index f68339318..ff0238aec 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/parameter-explode-false/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/parameter-explode-false/client/client.gen.ts @@ -65,7 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.serializedBody === undefined || opts.serializedBody === '') { + if (opts.body === undefined || opts.body === '') { opts.headers.delete('Content-Type'); } @@ -80,9 +80,12 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, - body: opts.serializedBody, }; + if (opts.serializedBody) { + requestInit.body = opts.serializedBody; + } + let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/client-fetch/sdk-nested-classes-instance/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/client-fetch/sdk-nested-classes-instance/client/client.gen.ts index f68339318..ff0238aec 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/client-fetch/sdk-nested-classes-instance/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/client-fetch/sdk-nested-classes-instance/client/client.gen.ts @@ -65,7 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.serializedBody === undefined || opts.serializedBody === '') { + if (opts.body === undefined || opts.body === '') { opts.headers.delete('Content-Type'); } @@ -80,9 +80,12 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, - body: opts.serializedBody, }; + if (opts.serializedBody) { + requestInit.body = opts.serializedBody; + } + let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/client-fetch/sdk-nested-classes/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/client-fetch/sdk-nested-classes/client/client.gen.ts index f68339318..ff0238aec 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/client-fetch/sdk-nested-classes/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/client-fetch/sdk-nested-classes/client/client.gen.ts @@ -65,7 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.serializedBody === undefined || opts.serializedBody === '') { + if (opts.body === undefined || opts.body === '') { opts.headers.delete('Content-Type'); } @@ -80,9 +80,12 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, - body: opts.serializedBody, }; + if (opts.serializedBody) { + requestInit.body = opts.serializedBody; + } + let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/sdk/default/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/sdk/default/client/client.gen.ts index f68339318..ff0238aec 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/sdk/default/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/sdk/default/client/client.gen.ts @@ -65,7 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.serializedBody === undefined || opts.serializedBody === '') { + if (opts.body === undefined || opts.body === '') { opts.headers.delete('Content-Type'); } @@ -80,9 +80,12 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, - body: opts.serializedBody, }; + if (opts.serializedBody) { + requestInit.body = opts.serializedBody; + } + let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/sdk/instance/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/sdk/instance/client/client.gen.ts index f68339318..ff0238aec 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/sdk/instance/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/sdk/instance/client/client.gen.ts @@ -65,7 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.serializedBody === undefined || opts.serializedBody === '') { + if (opts.body === undefined || opts.body === '') { opts.headers.delete('Content-Type'); } @@ -80,9 +80,12 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, - body: opts.serializedBody, }; + if (opts.serializedBody) { + requestInit.body = opts.serializedBody; + } + let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/sdk/throwOnError/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/sdk/throwOnError/client/client.gen.ts index f68339318..ff0238aec 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/sdk/throwOnError/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/sdk/throwOnError/client/client.gen.ts @@ -65,7 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.serializedBody === undefined || opts.serializedBody === '') { + if (opts.body === undefined || opts.body === '') { opts.headers.delete('Content-Type'); } @@ -80,9 +80,12 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, - body: opts.serializedBody, }; + if (opts.serializedBody) { + requestInit.body = opts.serializedBody; + } + let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/transformers/type-format-valibot/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/transformers/type-format-valibot/client/client.gen.ts index f68339318..ff0238aec 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/transformers/type-format-valibot/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/transformers/type-format-valibot/client/client.gen.ts @@ -65,7 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.serializedBody === undefined || opts.serializedBody === '') { + if (opts.body === undefined || opts.body === '') { opts.headers.delete('Content-Type'); } @@ -80,9 +80,12 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, - body: opts.serializedBody, }; + if (opts.serializedBody) { + requestInit.body = opts.serializedBody; + } + let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/transformers/type-format-zod/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/transformers/type-format-zod/client/client.gen.ts index f68339318..ff0238aec 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/transformers/type-format-zod/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/transformers/type-format-zod/client/client.gen.ts @@ -65,7 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.serializedBody === undefined || opts.serializedBody === '') { + if (opts.body === undefined || opts.body === '') { opts.headers.delete('Content-Type'); } @@ -80,9 +80,12 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, - body: opts.serializedBody, }; + if (opts.serializedBody) { + requestInit.body = opts.serializedBody; + } + let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/typescript/transforms-read-write-custom-name/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/typescript/transforms-read-write-custom-name/client/client.gen.ts index f68339318..ff0238aec 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/typescript/transforms-read-write-custom-name/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/typescript/transforms-read-write-custom-name/client/client.gen.ts @@ -65,7 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.serializedBody === undefined || opts.serializedBody === '') { + if (opts.body === undefined || opts.body === '') { opts.headers.delete('Content-Type'); } @@ -80,9 +80,12 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, - body: opts.serializedBody, }; + if (opts.serializedBody) { + requestInit.body = opts.serializedBody; + } + let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/typescript/transforms-read-write-ignore/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/typescript/transforms-read-write-ignore/client/client.gen.ts index f68339318..ff0238aec 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/typescript/transforms-read-write-ignore/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/typescript/transforms-read-write-ignore/client/client.gen.ts @@ -65,7 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.serializedBody === undefined || opts.serializedBody === '') { + if (opts.body === undefined || opts.body === '') { opts.headers.delete('Content-Type'); } @@ -80,9 +80,12 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, - body: opts.serializedBody, }; + if (opts.serializedBody) { + requestInit.body = opts.serializedBody; + } + let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@pinia/colada/fetch/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@pinia/colada/fetch/client/client.gen.ts index f68339318..ff0238aec 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@pinia/colada/fetch/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@pinia/colada/fetch/client/client.gen.ts @@ -65,7 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.serializedBody === undefined || opts.serializedBody === '') { + if (opts.body === undefined || opts.body === '') { opts.headers.delete('Content-Type'); } @@ -80,9 +80,12 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, - body: opts.serializedBody, }; + if (opts.serializedBody) { + requestInit.body = opts.serializedBody; + } + let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@pinia/colada/group-by-tag/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@pinia/colada/group-by-tag/client/client.gen.ts index f68339318..ff0238aec 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@pinia/colada/group-by-tag/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@pinia/colada/group-by-tag/client/client.gen.ts @@ -65,7 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.serializedBody === undefined || opts.serializedBody === '') { + if (opts.body === undefined || opts.body === '') { opts.headers.delete('Content-Type'); } @@ -80,9 +80,12 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, - body: opts.serializedBody, }; + if (opts.serializedBody) { + requestInit.body = opts.serializedBody; + } + let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/angular-query-experimental/asClass/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/angular-query-experimental/asClass/client/client.gen.ts index f68339318..ff0238aec 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/angular-query-experimental/asClass/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/angular-query-experimental/asClass/client/client.gen.ts @@ -65,7 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.serializedBody === undefined || opts.serializedBody === '') { + if (opts.body === undefined || opts.body === '') { opts.headers.delete('Content-Type'); } @@ -80,9 +80,12 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, - body: opts.serializedBody, }; + if (opts.serializedBody) { + requestInit.body = opts.serializedBody; + } + let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/angular-query-experimental/fetch/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/angular-query-experimental/fetch/client/client.gen.ts index f68339318..ff0238aec 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/angular-query-experimental/fetch/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/angular-query-experimental/fetch/client/client.gen.ts @@ -65,7 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.serializedBody === undefined || opts.serializedBody === '') { + if (opts.body === undefined || opts.body === '') { opts.headers.delete('Content-Type'); } @@ -80,9 +80,12 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, - body: opts.serializedBody, }; + if (opts.serializedBody) { + requestInit.body = opts.serializedBody; + } + let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/angular-query-experimental/name-builder/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/angular-query-experimental/name-builder/client/client.gen.ts index f68339318..ff0238aec 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/angular-query-experimental/name-builder/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/angular-query-experimental/name-builder/client/client.gen.ts @@ -65,7 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.serializedBody === undefined || opts.serializedBody === '') { + if (opts.body === undefined || opts.body === '') { opts.headers.delete('Content-Type'); } @@ -80,9 +80,12 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, - body: opts.serializedBody, }; + if (opts.serializedBody) { + requestInit.body = opts.serializedBody; + } + let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/react-query/asClass/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/react-query/asClass/client/client.gen.ts index f68339318..ff0238aec 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/react-query/asClass/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/react-query/asClass/client/client.gen.ts @@ -65,7 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.serializedBody === undefined || opts.serializedBody === '') { + if (opts.body === undefined || opts.body === '') { opts.headers.delete('Content-Type'); } @@ -80,9 +80,12 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, - body: opts.serializedBody, }; + if (opts.serializedBody) { + requestInit.body = opts.serializedBody; + } + let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/react-query/fetch/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/react-query/fetch/client/client.gen.ts index f68339318..ff0238aec 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/react-query/fetch/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/react-query/fetch/client/client.gen.ts @@ -65,7 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.serializedBody === undefined || opts.serializedBody === '') { + if (opts.body === undefined || opts.body === '') { opts.headers.delete('Content-Type'); } @@ -80,9 +80,12 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, - body: opts.serializedBody, }; + if (opts.serializedBody) { + requestInit.body = opts.serializedBody; + } + let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/react-query/name-builder/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/react-query/name-builder/client/client.gen.ts index f68339318..ff0238aec 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/react-query/name-builder/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/react-query/name-builder/client/client.gen.ts @@ -65,7 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.serializedBody === undefined || opts.serializedBody === '') { + if (opts.body === undefined || opts.body === '') { opts.headers.delete('Content-Type'); } @@ -80,9 +80,12 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, - body: opts.serializedBody, }; + if (opts.serializedBody) { + requestInit.body = opts.serializedBody; + } + let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/solid-query/asClass/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/solid-query/asClass/client/client.gen.ts index f68339318..ff0238aec 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/solid-query/asClass/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/solid-query/asClass/client/client.gen.ts @@ -65,7 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.serializedBody === undefined || opts.serializedBody === '') { + if (opts.body === undefined || opts.body === '') { opts.headers.delete('Content-Type'); } @@ -80,9 +80,12 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, - body: opts.serializedBody, }; + if (opts.serializedBody) { + requestInit.body = opts.serializedBody; + } + let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/solid-query/fetch/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/solid-query/fetch/client/client.gen.ts index f68339318..ff0238aec 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/solid-query/fetch/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/solid-query/fetch/client/client.gen.ts @@ -65,7 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.serializedBody === undefined || opts.serializedBody === '') { + if (opts.body === undefined || opts.body === '') { opts.headers.delete('Content-Type'); } @@ -80,9 +80,12 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, - body: opts.serializedBody, }; + if (opts.serializedBody) { + requestInit.body = opts.serializedBody; + } + let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/solid-query/name-builder/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/solid-query/name-builder/client/client.gen.ts index f68339318..ff0238aec 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/solid-query/name-builder/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/solid-query/name-builder/client/client.gen.ts @@ -65,7 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.serializedBody === undefined || opts.serializedBody === '') { + if (opts.body === undefined || opts.body === '') { opts.headers.delete('Content-Type'); } @@ -80,9 +80,12 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, - body: opts.serializedBody, }; + if (opts.serializedBody) { + requestInit.body = opts.serializedBody; + } + let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/svelte-query/asClass/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/svelte-query/asClass/client/client.gen.ts index f68339318..ff0238aec 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/svelte-query/asClass/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/svelte-query/asClass/client/client.gen.ts @@ -65,7 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.serializedBody === undefined || opts.serializedBody === '') { + if (opts.body === undefined || opts.body === '') { opts.headers.delete('Content-Type'); } @@ -80,9 +80,12 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, - body: opts.serializedBody, }; + if (opts.serializedBody) { + requestInit.body = opts.serializedBody; + } + let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/svelte-query/fetch/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/svelte-query/fetch/client/client.gen.ts index f68339318..ff0238aec 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/svelte-query/fetch/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/svelte-query/fetch/client/client.gen.ts @@ -65,7 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.serializedBody === undefined || opts.serializedBody === '') { + if (opts.body === undefined || opts.body === '') { opts.headers.delete('Content-Type'); } @@ -80,9 +80,12 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, - body: opts.serializedBody, }; + if (opts.serializedBody) { + requestInit.body = opts.serializedBody; + } + let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/svelte-query/name-builder/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/svelte-query/name-builder/client/client.gen.ts index f68339318..ff0238aec 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/svelte-query/name-builder/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/svelte-query/name-builder/client/client.gen.ts @@ -65,7 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.serializedBody === undefined || opts.serializedBody === '') { + if (opts.body === undefined || opts.body === '') { opts.headers.delete('Content-Type'); } @@ -80,9 +80,12 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, - body: opts.serializedBody, }; + if (opts.serializedBody) { + requestInit.body = opts.serializedBody; + } + let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/vue-query/asClass/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/vue-query/asClass/client/client.gen.ts index f68339318..ff0238aec 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/vue-query/asClass/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/vue-query/asClass/client/client.gen.ts @@ -65,7 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.serializedBody === undefined || opts.serializedBody === '') { + if (opts.body === undefined || opts.body === '') { opts.headers.delete('Content-Type'); } @@ -80,9 +80,12 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, - body: opts.serializedBody, }; + if (opts.serializedBody) { + requestInit.body = opts.serializedBody; + } + let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/vue-query/fetch/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/vue-query/fetch/client/client.gen.ts index f68339318..ff0238aec 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/vue-query/fetch/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/vue-query/fetch/client/client.gen.ts @@ -65,7 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.serializedBody === undefined || opts.serializedBody === '') { + if (opts.body === undefined || opts.body === '') { opts.headers.delete('Content-Type'); } @@ -80,9 +80,12 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, - body: opts.serializedBody, }; + if (opts.serializedBody) { + requestInit.body = opts.serializedBody; + } + let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/vue-query/name-builder/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/vue-query/name-builder/client/client.gen.ts index f68339318..ff0238aec 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/vue-query/name-builder/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/vue-query/name-builder/client/client.gen.ts @@ -65,7 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.serializedBody === undefined || opts.serializedBody === '') { + if (opts.body === undefined || opts.body === '') { opts.headers.delete('Content-Type'); } @@ -80,9 +80,12 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, - body: opts.serializedBody, }; + if (opts.serializedBody) { + requestInit.body = opts.serializedBody; + } + let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-api-key/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-api-key/client/client.gen.ts index f68339318..ff0238aec 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-api-key/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-api-key/client/client.gen.ts @@ -65,7 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.serializedBody === undefined || opts.serializedBody === '') { + if (opts.body === undefined || opts.body === '') { opts.headers.delete('Content-Type'); } @@ -80,9 +80,12 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, - body: opts.serializedBody, }; + if (opts.serializedBody) { + requestInit.body = opts.serializedBody; + } + let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-false/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-false/client/client.gen.ts index f68339318..ff0238aec 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-false/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-false/client/client.gen.ts @@ -65,7 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.serializedBody === undefined || opts.serializedBody === '') { + if (opts.body === undefined || opts.body === '') { opts.headers.delete('Content-Type'); } @@ -80,9 +80,12 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, - body: opts.serializedBody, }; + if (opts.serializedBody) { + requestInit.body = opts.serializedBody; + } + let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-http-bearer/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-http-bearer/client/client.gen.ts index f68339318..ff0238aec 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-http-bearer/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-http-bearer/client/client.gen.ts @@ -65,7 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.serializedBody === undefined || opts.serializedBody === '') { + if (opts.body === undefined || opts.body === '') { opts.headers.delete('Content-Type'); } @@ -80,9 +80,12 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, - body: opts.serializedBody, }; + if (opts.serializedBody) { + requestInit.body = opts.serializedBody; + } + let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-oauth2/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-oauth2/client/client.gen.ts index f68339318..ff0238aec 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-oauth2/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-oauth2/client/client.gen.ts @@ -65,7 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.serializedBody === undefined || opts.serializedBody === '') { + if (opts.body === undefined || opts.body === '') { opts.headers.delete('Content-Type'); } @@ -80,9 +80,12 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, - body: opts.serializedBody, }; + if (opts.serializedBody) { + requestInit.body = opts.serializedBody; + } + let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-open-id-connect/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-open-id-connect/client/client.gen.ts index f68339318..ff0238aec 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-open-id-connect/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-open-id-connect/client/client.gen.ts @@ -65,7 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.serializedBody === undefined || opts.serializedBody === '') { + if (opts.body === undefined || opts.body === '') { opts.headers.delete('Content-Type'); } @@ -80,9 +80,12 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, - body: opts.serializedBody, }; + if (opts.serializedBody) { + requestInit.body = opts.serializedBody; + } + let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/servers/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/servers/client/client.gen.ts index f68339318..ff0238aec 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/servers/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/servers/client/client.gen.ts @@ -65,7 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.serializedBody === undefined || opts.serializedBody === '') { + if (opts.body === undefined || opts.body === '') { opts.headers.delete('Content-Type'); } @@ -80,9 +80,12 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, - body: opts.serializedBody, }; + if (opts.serializedBody) { + requestInit.body = opts.serializedBody; + } + let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-fetch/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-fetch/client/client.gen.ts index f68339318..ff0238aec 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-fetch/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-fetch/client/client.gen.ts @@ -65,7 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.serializedBody === undefined || opts.serializedBody === '') { + if (opts.body === undefined || opts.body === '') { opts.headers.delete('Content-Type'); } @@ -80,9 +80,12 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, - body: opts.serializedBody, }; + if (opts.serializedBody) { + requestInit.body = opts.serializedBody; + } + let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-next/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-next/client/client.gen.ts index 9a3f20891..17450b9b5 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-next/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-next/client/client.gen.ts @@ -64,7 +64,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.serializedBody === undefined || opts.serializedBody === '') { + if (opts.body === undefined || opts.body === '') { opts.headers.delete('Content-Type'); } @@ -87,10 +87,15 @@ export const createClient = (config: Config = {}): Client => { // fetch must be assigned here, otherwise it would throw the error: // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation const _fetch = opts.fetch!; - let response = await _fetch(url, { + const requestInit: ReqInit = { ...opts, - body: opts.serializedBody as ReqInit['body'], - }); + }; + + if (opts.serializedBody) { + requestInit.body = opts.serializedBody; + } + + let response = await _fetch(url, requestInit); for (const fn of interceptors.response._fns) { if (fn) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-all-of/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-all-of/client/client.gen.ts index f68339318..ff0238aec 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-all-of/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-all-of/client/client.gen.ts @@ -65,7 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.serializedBody === undefined || opts.serializedBody === '') { + if (opts.body === undefined || opts.body === '') { opts.headers.delete('Content-Type'); } @@ -80,9 +80,12 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, - body: opts.serializedBody, }; + if (opts.serializedBody) { + requestInit.body = opts.serializedBody; + } + let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-any-of-null/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-any-of-null/client/client.gen.ts index f68339318..ff0238aec 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-any-of-null/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-any-of-null/client/client.gen.ts @@ -65,7 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.serializedBody === undefined || opts.serializedBody === '') { + if (opts.body === undefined || opts.body === '') { opts.headers.delete('Content-Type'); } @@ -80,9 +80,12 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, - body: opts.serializedBody, }; + if (opts.serializedBody) { + requestInit.body = opts.serializedBody; + } + let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-array/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-array/client/client.gen.ts index f68339318..ff0238aec 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-array/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-array/client/client.gen.ts @@ -65,7 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.serializedBody === undefined || opts.serializedBody === '') { + if (opts.body === undefined || opts.body === '') { opts.headers.delete('Content-Type'); } @@ -80,9 +80,12 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, - body: opts.serializedBody, }; + if (opts.serializedBody) { + requestInit.body = opts.serializedBody; + } + let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transforms-read-write/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transforms-read-write/client/client.gen.ts index f68339318..ff0238aec 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transforms-read-write/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transforms-read-write/client/client.gen.ts @@ -65,7 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.serializedBody === undefined || opts.serializedBody === '') { + if (opts.body === undefined || opts.body === '') { opts.headers.delete('Content-Type'); } @@ -80,9 +80,12 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, - body: opts.serializedBody, }; + if (opts.serializedBody) { + requestInit.body = opts.serializedBody; + } + let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/plugins/@tanstack/meta/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/plugins/@tanstack/meta/client/client.gen.ts index f68339318..ff0238aec 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/plugins/@tanstack/meta/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/plugins/@tanstack/meta/client/client.gen.ts @@ -65,7 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.serializedBody === undefined || opts.serializedBody === '') { + if (opts.body === undefined || opts.body === '') { opts.headers.delete('Content-Type'); } @@ -80,9 +80,12 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, - body: opts.serializedBody, }; + if (opts.serializedBody) { + requestInit.body = opts.serializedBody; + } + let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/test/generated/v3_no_index/client/client.gen.ts.snap b/packages/openapi-ts-tests/main/test/__snapshots__/test/generated/v3_no_index/client/client.gen.ts.snap index f68339318..ff0238aec 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/test/generated/v3_no_index/client/client.gen.ts.snap +++ b/packages/openapi-ts-tests/main/test/__snapshots__/test/generated/v3_no_index/client/client.gen.ts.snap @@ -65,7 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.serializedBody === undefined || opts.serializedBody === '') { + if (opts.body === undefined || opts.body === '') { opts.headers.delete('Content-Type'); } @@ -80,9 +80,12 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, - body: opts.serializedBody, }; + if (opts.serializedBody) { + requestInit.body = opts.serializedBody; + } + let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { -- 2.51.2 From e9770dfd1513ffbf13098d46bd8449bfe854e36d Mon Sep 17 00:00:00 2001 From: Max Scopp Date: Sun, 31 Aug 2025 19:34:16 +0200 Subject: [PATCH 04/46] fix(angular): allow `httpResource` to skip requests when `undefined` is returned --- .../@angular/common/http/resources.gen.ts | 157 +++++++---- .../src/client/client/client.gen.ts | 87 ++++-- .../src/client/client/types.gen.ts | 69 +++-- .../src/client/core/serverSentEvents.gen.ts | 264 ++++++++++++++++++ .../src/client/core/types.gen.ts | 42 ++- .../src/client/core/utils.gen.ts | 114 ++++++++ .../src/client/client/client.gen.ts | 87 ++++-- .../src/client/client/types.gen.ts | 69 +++-- .../src/client/core/serverSentEvents.gen.ts | 264 ++++++++++++++++++ .../src/client/core/types.gen.ts | 42 ++- .../src/client/core/utils.gen.ts | 114 ++++++++ .../plugins/@angular/common/httpResources.ts | 117 ++++++-- 12 files changed, 1208 insertions(+), 218 deletions(-) create mode 100644 examples/openapi-ts-angular-common/src/client/core/serverSentEvents.gen.ts create mode 100644 examples/openapi-ts-angular-common/src/client/core/utils.gen.ts create mode 100644 examples/openapi-ts-angular/src/client/core/serverSentEvents.gen.ts create mode 100644 examples/openapi-ts-angular/src/client/core/utils.gen.ts diff --git a/examples/openapi-ts-angular-common/src/client/@angular/common/http/resources.gen.ts b/examples/openapi-ts-angular-common/src/client/@angular/common/http/resources.gen.ts index 213278143..f4be36afb 100644 --- a/examples/openapi-ts-angular-common/src/client/@angular/common/http/resources.gen.ts +++ b/examples/openapi-ts-angular-common/src/client/@angular/common/http/resources.gen.ts @@ -70,9 +70,12 @@ export class PetServiceResources { * Add a new pet to the store. */ public addPet( - options: () => Options, + options: () => Options | undefined, ) { - return httpResource(() => addPetRequest(options())); + return httpResource(() => { + const opts = options ? options() : undefined; + return opts ? addPetRequest(opts) : undefined; + }); } /** @@ -80,9 +83,12 @@ export class PetServiceResources { * Update an existing pet by Id. */ public updatePet( - options: () => Options, + options: () => Options | undefined, ) { - return httpResource(() => updatePetRequest(options())); + return httpResource(() => { + const opts = options ? options() : undefined; + return opts ? updatePetRequest(opts) : undefined; + }); } /** @@ -90,11 +96,12 @@ export class PetServiceResources { * Multiple status values can be provided with comma separated strings. */ public findPetsByStatus( - options: () => Options, + options: () => Options | undefined, ) { - return httpResource(() => - findPetsByStatusRequest(options()), - ); + return httpResource(() => { + const opts = options ? options() : undefined; + return opts ? findPetsByStatusRequest(opts) : undefined; + }); } /** @@ -102,11 +109,12 @@ export class PetServiceResources { * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. */ public findPetsByTags( - options: () => Options, + options: () => Options | undefined, ) { - return httpResource(() => - findPetsByTagsRequest(options()), - ); + return httpResource(() => { + const opts = options ? options() : undefined; + return opts ? findPetsByTagsRequest(opts) : undefined; + }); } /** @@ -114,9 +122,12 @@ export class PetServiceResources { * Delete a pet. */ public deletePet( - options: () => Options, + options: () => Options | undefined, ) { - return httpResource(() => deletePetRequest(options())); + return httpResource(() => { + const opts = options ? options() : undefined; + return opts ? deletePetRequest(opts) : undefined; + }); } /** @@ -124,9 +135,12 @@ export class PetServiceResources { * Returns a single pet. */ public getPetById( - options: () => Options, + options: () => Options | undefined, ) { - return httpResource(() => getPetByIdRequest(options())); + return httpResource(() => { + const opts = options ? options() : undefined; + return opts ? getPetByIdRequest(opts) : undefined; + }); } /** @@ -134,11 +148,12 @@ export class PetServiceResources { * Updates a pet resource based on the form data. */ public updatePetWithForm( - options: () => Options, + options: () => Options | undefined, ) { - return httpResource(() => - updatePetWithFormRequest(options()), - ); + return httpResource(() => { + const opts = options ? options() : undefined; + return opts ? updatePetWithFormRequest(opts) : undefined; + }); } /** @@ -146,9 +161,12 @@ export class PetServiceResources { * Upload image of the pet. */ public uploadFile( - options: () => Options, + options: () => Options | undefined, ) { - return httpResource(() => uploadFileRequest(options())); + return httpResource(() => { + const opts = options ? options() : undefined; + return opts ? uploadFileRequest(opts) : undefined; + }); } } @@ -161,11 +179,12 @@ export class StoreServiceResources { * Returns a map of status codes to quantities. */ public getInventory( - options?: () => Options, + options?: () => Options | undefined, ) { - return httpResource(() => - getInventoryRequest(options ? options() : undefined), - ); + return httpResource(() => { + const opts = options ? options() : undefined; + return opts ? getInventoryRequest(opts) : undefined; + }); } /** @@ -173,11 +192,12 @@ export class StoreServiceResources { * Place a new order in the store. */ public placeOrder( - options?: () => Options, + options?: () => Options | undefined, ) { - return httpResource(() => - placeOrderRequest(options ? options() : undefined), - ); + return httpResource(() => { + const opts = options ? options() : undefined; + return opts ? placeOrderRequest(opts) : undefined; + }); } /** @@ -185,9 +205,12 @@ export class StoreServiceResources { * For valid response try integer IDs with value < 1000. Anything above 1000 or non-integers will generate API errors. */ public deleteOrder( - options: () => Options, + options: () => Options | undefined, ) { - return httpResource(() => deleteOrderRequest(options())); + return httpResource(() => { + const opts = options ? options() : undefined; + return opts ? deleteOrderRequest(opts) : undefined; + }); } /** @@ -195,11 +218,12 @@ export class StoreServiceResources { * For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions. */ public getOrderById( - options: () => Options, + options: () => Options | undefined, ) { - return httpResource(() => - getOrderByIdRequest(options()), - ); + return httpResource(() => { + const opts = options ? options() : undefined; + return opts ? getOrderByIdRequest(opts) : undefined; + }); } } @@ -212,11 +236,12 @@ export class UserServiceResources { * This can only be done by the logged in user. */ public createUser( - options?: () => Options, + options?: () => Options | undefined, ) { - return httpResource(() => - createUserRequest(options ? options() : undefined), - ); + return httpResource(() => { + const opts = options ? options() : undefined; + return opts ? createUserRequest(opts) : undefined; + }); } /** @@ -224,11 +249,14 @@ export class UserServiceResources { * Creates list of users with given input array. */ public createUsersWithListInput( - options?: () => Options, + options?: () => + | Options + | undefined, ) { - return httpResource(() => - createUsersWithListInputRequest(options ? options() : undefined), - ); + return httpResource(() => { + const opts = options ? options() : undefined; + return opts ? createUsersWithListInputRequest(opts) : undefined; + }); } /** @@ -236,11 +264,12 @@ export class UserServiceResources { * Log into the system. */ public loginUser( - options?: () => Options, + options?: () => Options | undefined, ) { - return httpResource(() => - loginUserRequest(options ? options() : undefined), - ); + return httpResource(() => { + const opts = options ? options() : undefined; + return opts ? loginUserRequest(opts) : undefined; + }); } /** @@ -248,11 +277,12 @@ export class UserServiceResources { * Log user out of the system. */ public logoutUser( - options?: () => Options, + options?: () => Options | undefined, ) { - return httpResource(() => - logoutUserRequest(options ? options() : undefined), - ); + return httpResource(() => { + const opts = options ? options() : undefined; + return opts ? logoutUserRequest(opts) : undefined; + }); } /** @@ -260,9 +290,12 @@ export class UserServiceResources { * This can only be done by the logged in user. */ public deleteUser( - options: () => Options, + options: () => Options | undefined, ) { - return httpResource(() => deleteUserRequest(options())); + return httpResource(() => { + const opts = options ? options() : undefined; + return opts ? deleteUserRequest(opts) : undefined; + }); } /** @@ -270,11 +303,12 @@ export class UserServiceResources { * Get user detail based on username. */ public getUserByName( - options: () => Options, + options: () => Options | undefined, ) { - return httpResource(() => - getUserByNameRequest(options()), - ); + return httpResource(() => { + const opts = options ? options() : undefined; + return opts ? getUserByNameRequest(opts) : undefined; + }); } /** @@ -282,8 +316,11 @@ export class UserServiceResources { * This can only be done by the logged in user. */ public updateUser( - options: () => Options, + options: () => Options | undefined, ) { - return httpResource(() => updateUserRequest(options())); + return httpResource(() => { + const opts = options ? options() : undefined; + return opts ? updateUserRequest(opts) : undefined; + }); } } diff --git a/examples/openapi-ts-angular-common/src/client/client/client.gen.ts b/examples/openapi-ts-angular-common/src/client/client/client.gen.ts index 74f611765..93b77ace4 100644 --- a/examples/openapi-ts-angular-common/src/client/client/client.gen.ts +++ b/examples/openapi-ts-angular-common/src/client/client/client.gen.ts @@ -16,6 +16,8 @@ import { import { firstValueFrom } from 'rxjs'; import { filter } from 'rxjs/operators'; +import { createSseClient } from '../core/serverSentEvents.gen'; +import type { HttpMethod } from '../core/types.gen'; import type { Client, Config, @@ -60,14 +62,13 @@ export const createClient = (config: Config = {}): Client => { ThrowOnError extends boolean = false, TResponseStyle extends ResponseStyle = 'fields', >( - options: RequestOptions, + options: RequestOptions, ) => { const opts = { ..._config, ...options, headers: mergeHeaders(_config.headers, options.headers), httpClient: options.httpClient ?? _config.httpClient, - method: 'GET', serializedBody: options.body as any, }; @@ -94,7 +95,7 @@ export const createClient = (config: Config = {}): Client => { const url = buildUrl(opts as any); const req = new HttpRequest( - opts.method, + opts.method ?? 'GET', url, opts.serializedBody || null, { @@ -103,11 +104,11 @@ export const createClient = (config: Config = {}): Client => { }, ); - return { opts, req }; + return { opts, req, url }; }; - const request: Client['request'] = async (options) => { - const { opts, req: initialReq } = requestOptions(options); + const beforeRequest = async (options: RequestOptions) => { + const { opts, req, url } = requestOptions(options); if (opts.security) { await setAuthParams({ @@ -120,6 +121,13 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } + return { opts, req, url }; + }; + + const request: Client['request'] = async (options) => { + // @ts-expect-error + const { opts, req: initialReq } = await beforeRequest(options); + let req = initialReq; for (const fn of interceptors.request._fns) { @@ -128,26 +136,28 @@ export const createClient = (config: Config = {}): Client => { } } - let response; - const result = { + const result: { + request: HttpRequest; + response: any; + } = { request: req, - response, + response: null, }; try { - response = await firstValueFrom( + result.response = (await firstValueFrom( opts .httpClient!.request(req) .pipe(filter((event) => event.type === HttpEventType.Response)), - ); + )) as HttpResponse; for (const fn of interceptors.response._fns) { if (fn) { - response = await fn(response, req, opts as any); + result.response = await fn(result.response, req, opts as any); } } - let bodyResponse: any = response.body; + let bodyResponse = result.response.body; if (opts.responseValidator) { await opts.responseValidator(bodyResponse); @@ -162,7 +172,7 @@ export const createClient = (config: Config = {}): Client => { : { data: bodyResponse, ...result }; } catch (error) { if (error instanceof HttpErrorResponse) { - response = error; + result.response = error; } let finalError = error instanceof HttpErrorResponse ? error.error : error; @@ -171,7 +181,7 @@ export const createClient = (config: Config = {}): Client => { if (fn) { finalError = (await fn( finalError, - response as HttpResponse, + result.response as any, req, opts as any, )) as string; @@ -191,18 +201,34 @@ export const createClient = (config: Config = {}): Client => { } }; + const makeMethodFn = + (method: Uppercase) => (options: RequestOptions) => + request({ ...options, method }); + + const makeSseFn = + (method: Uppercase) => async (options: RequestOptions) => { + const { opts, url } = await beforeRequest(options); + return createSseClient({ + ...opts, + body: opts.body as BodyInit | null | undefined, + headers: opts.headers as unknown as Record, + method, + url, + }); + }; + return { buildUrl, - connect: (options) => request({ ...options, method: 'CONNECT' }), - delete: (options) => request({ ...options, method: 'DELETE' }), - get: (options) => request({ ...options, method: 'GET' }), + connect: makeMethodFn('CONNECT'), + delete: makeMethodFn('DELETE'), + get: makeMethodFn('GET'), getConfig, - head: (options) => request({ ...options, method: 'HEAD' }), + head: makeMethodFn('HEAD'), interceptors, - options: (options) => request({ ...options, method: 'OPTIONS' }), - patch: (options) => request({ ...options, method: 'PATCH' }), - post: (options) => request({ ...options, method: 'POST' }), - put: (options) => request({ ...options, method: 'PUT' }), + options: makeMethodFn('OPTIONS'), + patch: makeMethodFn('PATCH'), + post: makeMethodFn('POST'), + put: makeMethodFn('PUT'), request, requestOptions: (options) => { if (options.security) { @@ -218,6 +244,17 @@ export const createClient = (config: Config = {}): Client => { return requestOptions(options).req; }, setConfig, - trace: (options) => request({ ...options, method: 'TRACE' }), - }; + sse: { + connect: makeSseFn('CONNECT'), + delete: makeSseFn('DELETE'), + get: makeSseFn('GET'), + head: makeSseFn('HEAD'), + options: makeSseFn('OPTIONS'), + patch: makeSseFn('PATCH'), + post: makeSseFn('POST'), + put: makeSseFn('PUT'), + trace: makeSseFn('TRACE'), + }, + trace: makeMethodFn('TRACE'), + } as Client; }; diff --git a/examples/openapi-ts-angular-common/src/client/client/types.gen.ts b/examples/openapi-ts-angular-common/src/client/client/types.gen.ts index 488cf889c..6cdf8ad48 100644 --- a/examples/openapi-ts-angular-common/src/client/client/types.gen.ts +++ b/examples/openapi-ts-angular-common/src/client/client/types.gen.ts @@ -10,6 +10,10 @@ import type { import type { Injector } from '@angular/core'; import type { Auth } from '../core/auth.gen'; +import type { + ServerSentEventsOptions, + ServerSentEventsResult, +} from '../core/serverSentEvents.gen'; import type { Client as CoreClient, Config as CoreConfig, @@ -63,13 +67,22 @@ export interface Config } export interface RequestOptions< + TData = unknown, TResponseStyle extends ResponseStyle = 'fields', ThrowOnError extends boolean = boolean, Url extends string = string, > extends Config<{ - responseStyle: TResponseStyle; - throwOnError: ThrowOnError; - }> { + responseStyle: TResponseStyle; + throwOnError: ThrowOnError; + }>, + Pick< + ServerSentEventsOptions, + | 'onSseError' + | 'onSseEvent' + | 'sseDefaultRetryDelay' + | 'sseMaxRetryAttempts' + | 'sseMaxRetryDelay' + > { /** * Any body that you want to add to your request. * @@ -93,7 +106,7 @@ export interface ResolvedRequestOptions< TResponseStyle extends ResponseStyle = 'fields', ThrowOnError extends boolean = boolean, Url extends string = string, -> extends RequestOptions { +> extends RequestOptions { serializedBody?: string; } @@ -150,24 +163,36 @@ type MethodFn = < ThrowOnError extends boolean = false, TResponseStyle extends ResponseStyle = 'fields', >( - options: Omit, 'method'>, + options: Omit, 'method'>, ) => RequestResult; +type SseFn = < + TData = unknown, + TError = unknown, + ThrowOnError extends boolean = false, + TResponseStyle extends ResponseStyle = 'fields', +>( + options: Omit, 'method'>, +) => Promise>; + type RequestFn = < TData = unknown, TError = unknown, ThrowOnError extends boolean = false, TResponseStyle extends ResponseStyle = 'fields', >( - options: Omit, 'method'> & - Pick>, 'method'>, + options: Omit, 'method'> & + Pick< + Required>, + 'method' + >, ) => RequestResult; type RequestOptionsFn = < ThrowOnError extends boolean = false, TResponseStyle extends ResponseStyle = 'fields', >( - options: RequestOptions, + options: RequestOptions, ) => HttpRequest; type BuildUrlFn = < @@ -181,14 +206,19 @@ type BuildUrlFn = < options: Pick & Options, ) => string; -export type Client = CoreClient & { +export type Client = CoreClient< + RequestFn, + Config, + MethodFn, + BuildUrlFn, + SseFn +> & { interceptors: Middleware< HttpRequest, HttpResponse, unknown, ResolvedRequestOptions >; - requestOptions: RequestOptionsFn; }; @@ -217,9 +247,10 @@ type OmitKeys = Pick>; export type Options< TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean, + TResponse = unknown, TResponseStyle extends ResponseStyle = 'fields', > = OmitKeys< - RequestOptions, + RequestOptions, 'body' | 'path' | 'query' | 'url' > & Omit; @@ -231,18 +262,22 @@ export type OptionsLegacyParser< > = TData extends { body?: any } ? TData extends { headers?: any } ? OmitKeys< - RequestOptions, + RequestOptions, 'body' | 'headers' | 'url' > & TData - : OmitKeys, 'body' | 'url'> & + : OmitKeys< + RequestOptions, + 'body' | 'url' + > & TData & - Pick, 'headers'> + Pick, 'headers'> : TData extends { headers?: any } ? OmitKeys< - RequestOptions, + RequestOptions, 'headers' | 'url' > & TData & - Pick, 'body'> - : OmitKeys, 'url'> & TData; + Pick, 'body'> + : OmitKeys, 'url'> & + TData; diff --git a/examples/openapi-ts-angular-common/src/client/core/serverSentEvents.gen.ts b/examples/openapi-ts-angular-common/src/client/core/serverSentEvents.gen.ts new file mode 100644 index 000000000..f8fd78e28 --- /dev/null +++ b/examples/openapi-ts-angular-common/src/client/core/serverSentEvents.gen.ts @@ -0,0 +1,264 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import type { Config } from './types.gen'; + +export type ServerSentEventsOptions = Omit< + RequestInit, + 'method' +> & + Pick & { + /** + * Fetch API implementation. You can use this option to provide a custom + * fetch instance. + * + * @default globalThis.fetch + */ + fetch?: typeof fetch; + /** + * Implementing clients can call request interceptors inside this hook. + */ + onRequest?: (url: string, init: RequestInit) => Promise; + /** + * Callback invoked when a network or parsing error occurs during streaming. + * + * This option applies only if the endpoint returns a stream of events. + * + * @param error The error that occurred. + */ + onSseError?: (error: unknown) => void; + /** + * Callback invoked when an event is streamed from the server. + * + * This option applies only if the endpoint returns a stream of events. + * + * @param event Event streamed from the server. + * @returns Nothing (void). + */ + onSseEvent?: (event: StreamEvent) => void; + serializedBody?: RequestInit['body']; + /** + * Default retry delay in milliseconds. + * + * This option applies only if the endpoint returns a stream of events. + * + * @default 3000 + */ + sseDefaultRetryDelay?: number; + /** + * Maximum number of retry attempts before giving up. + */ + sseMaxRetryAttempts?: number; + /** + * Maximum retry delay in milliseconds. + * + * Applies only when exponential backoff is used. + * + * This option applies only if the endpoint returns a stream of events. + * + * @default 30000 + */ + sseMaxRetryDelay?: number; + /** + * Optional sleep function for retry backoff. + * + * Defaults to using `setTimeout`. + */ + sseSleepFn?: (ms: number) => Promise; + url: string; + }; + +export interface StreamEvent { + data: TData; + event?: string; + id?: string; + retry?: number; +} + +export type ServerSentEventsResult< + TData = unknown, + TReturn = void, + TNext = unknown, +> = { + stream: AsyncGenerator< + TData extends Record ? TData[keyof TData] : TData, + TReturn, + TNext + >; +}; + +export const createSseClient = ({ + onRequest, + onSseError, + onSseEvent, + responseTransformer, + responseValidator, + sseDefaultRetryDelay, + sseMaxRetryAttempts, + sseMaxRetryDelay, + sseSleepFn, + url, + ...options +}: ServerSentEventsOptions): ServerSentEventsResult => { + let lastEventId: string | undefined; + + const sleep = + sseSleepFn ?? + ((ms: number) => new Promise((resolve) => setTimeout(resolve, ms))); + + const createStream = async function* () { + let retryDelay: number = sseDefaultRetryDelay ?? 3000; + let attempt = 0; + const signal = options.signal ?? new AbortController().signal; + + while (true) { + if (signal.aborted) break; + + attempt++; + + const headers = + options.headers instanceof Headers + ? options.headers + : new Headers(options.headers as Record | undefined); + + if (lastEventId !== undefined) { + headers.set('Last-Event-ID', lastEventId); + } + + try { + const requestInit: RequestInit = { + redirect: 'follow', + ...options, + body: options.serializedBody, + headers, + signal, + }; + let request = new Request(url, requestInit); + if (onRequest) { + request = await onRequest(url, requestInit); + } + // fetch must be assigned here, otherwise it would throw the error: + // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation + const _fetch = options.fetch ?? globalThis.fetch; + const response = await _fetch(request); + + if (!response.ok) + throw new Error( + `SSE failed: ${response.status} ${response.statusText}`, + ); + + if (!response.body) throw new Error('No body in SSE response'); + + const reader = response.body + .pipeThrough(new TextDecoderStream()) + .getReader(); + + let buffer = ''; + + const abortHandler = () => { + try { + reader.cancel(); + } catch { + // noop + } + }; + + signal.addEventListener('abort', abortHandler); + + try { + while (true) { + const { done, value } = await reader.read(); + if (done) break; + buffer += value; + + const chunks = buffer.split('\n\n'); + buffer = chunks.pop() ?? ''; + + for (const chunk of chunks) { + const lines = chunk.split('\n'); + const dataLines: Array = []; + let eventName: string | undefined; + + for (const line of lines) { + if (line.startsWith('data:')) { + dataLines.push(line.replace(/^data:\s*/, '')); + } else if (line.startsWith('event:')) { + eventName = line.replace(/^event:\s*/, ''); + } else if (line.startsWith('id:')) { + lastEventId = line.replace(/^id:\s*/, ''); + } else if (line.startsWith('retry:')) { + const parsed = Number.parseInt( + line.replace(/^retry:\s*/, ''), + 10, + ); + if (!Number.isNaN(parsed)) { + retryDelay = parsed; + } + } + } + + let data: unknown; + let parsedJson = false; + + if (dataLines.length) { + const rawData = dataLines.join('\n'); + try { + data = JSON.parse(rawData); + parsedJson = true; + } catch { + data = rawData; + } + } + + if (parsedJson) { + if (responseValidator) { + await responseValidator(data); + } + + if (responseTransformer) { + data = await responseTransformer(data); + } + } + + onSseEvent?.({ + data, + event: eventName, + id: lastEventId, + retry: retryDelay, + }); + + if (dataLines.length) { + yield data as any; + } + } + } + } finally { + signal.removeEventListener('abort', abortHandler); + reader.releaseLock(); + } + + break; // exit loop on normal completion + } catch (error) { + // connection failed or aborted; retry after delay + onSseError?.(error); + + if ( + sseMaxRetryAttempts !== undefined && + attempt >= sseMaxRetryAttempts + ) { + break; // stop after firing error + } + + // exponential backoff: double retry each attempt, cap at 30s + const backoff = Math.min( + retryDelay * 2 ** (attempt - 1), + sseMaxRetryDelay ?? 30000, + ); + await sleep(backoff); + } + } + }; + + const stream = createStream(); + + return { stream }; +}; diff --git a/examples/openapi-ts-angular-common/src/client/core/types.gen.ts b/examples/openapi-ts-angular-common/src/client/core/types.gen.ts index 5bfae35c0..643c070c9 100644 --- a/examples/openapi-ts-angular-common/src/client/core/types.gen.ts +++ b/examples/openapi-ts-angular-common/src/client/core/types.gen.ts @@ -7,29 +7,36 @@ import type { QuerySerializerOptions, } from './bodySerializer.gen'; -export interface Client< +export type HttpMethod = + | 'connect' + | 'delete' + | 'get' + | 'head' + | 'options' + | 'patch' + | 'post' + | 'put' + | 'trace'; + +export type Client< RequestFn = never, Config = unknown, MethodFn = never, BuildUrlFn = never, -> { + SseFn = never, +> = { /** * Returns the final request URL. */ buildUrl: BuildUrlFn; - connect: MethodFn; - delete: MethodFn; - get: MethodFn; getConfig: () => Config; - head: MethodFn; - options: MethodFn; - patch: MethodFn; - post: MethodFn; - put: MethodFn; request: RequestFn; setConfig: (config: Config) => Config; - trace: MethodFn; -} +} & { + [K in HttpMethod]: MethodFn; +} & ([SseFn] extends [never] + ? { sse?: never } + : { sse: { [K in HttpMethod]: SseFn } }); export interface Config { /** @@ -65,16 +72,7 @@ export interface Config { * * {@link https://developer.mozilla.org/docs/Web/API/fetch#method See more} */ - method?: - | 'CONNECT' - | 'DELETE' - | 'GET' - | 'HEAD' - | 'OPTIONS' - | 'PATCH' - | 'POST' - | 'PUT' - | 'TRACE'; + method?: Uppercase; /** * A function for serializing request query parameters. By default, arrays * will be exploded in form style, objects will be exploded in deepObject diff --git a/examples/openapi-ts-angular-common/src/client/core/utils.gen.ts b/examples/openapi-ts-angular-common/src/client/core/utils.gen.ts new file mode 100644 index 000000000..ac31396fe --- /dev/null +++ b/examples/openapi-ts-angular-common/src/client/core/utils.gen.ts @@ -0,0 +1,114 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import type { QuerySerializer } from './bodySerializer.gen'; +import { + type ArraySeparatorStyle, + serializeArrayParam, + serializeObjectParam, + serializePrimitiveParam, +} from './pathSerializer.gen'; + +export interface PathSerializer { + path: Record; + url: string; +} + +export const PATH_PARAM_RE = /\{[^{}]+\}/g; + +export const defaultPathSerializer = ({ path, url: _url }: PathSerializer) => { + let url = _url; + const matches = _url.match(PATH_PARAM_RE); + if (matches) { + for (const match of matches) { + let explode = false; + let name = match.substring(1, match.length - 1); + let style: ArraySeparatorStyle = 'simple'; + + if (name.endsWith('*')) { + explode = true; + name = name.substring(0, name.length - 1); + } + + if (name.startsWith('.')) { + name = name.substring(1); + style = 'label'; + } else if (name.startsWith(';')) { + name = name.substring(1); + style = 'matrix'; + } + + const value = path[name]; + + if (value === undefined || value === null) { + continue; + } + + if (Array.isArray(value)) { + url = url.replace( + match, + serializeArrayParam({ explode, name, style, value }), + ); + continue; + } + + if (typeof value === 'object') { + url = url.replace( + match, + serializeObjectParam({ + explode, + name, + style, + value: value as Record, + valueOnly: true, + }), + ); + continue; + } + + if (style === 'matrix') { + url = url.replace( + match, + `;${serializePrimitiveParam({ + name, + value: value as string, + })}`, + ); + continue; + } + + const replaceValue = encodeURIComponent( + style === 'label' ? `.${value as string}` : (value as string), + ); + url = url.replace(match, replaceValue); + } + } + return url; +}; + +export const getUrl = ({ + baseUrl, + path, + query, + querySerializer, + url: _url, +}: { + baseUrl?: string; + path?: Record; + query?: Record; + querySerializer: QuerySerializer; + url: string; +}) => { + const pathUrl = _url.startsWith('/') ? _url : `/${_url}`; + let url = (baseUrl ?? '') + pathUrl; + if (path) { + url = defaultPathSerializer({ path, url }); + } + let search = query ? querySerializer(query) : ''; + if (search.startsWith('?')) { + search = search.substring(1); + } + if (search) { + url += `?${search}`; + } + return url; +}; diff --git a/examples/openapi-ts-angular/src/client/client/client.gen.ts b/examples/openapi-ts-angular/src/client/client/client.gen.ts index 74f611765..93b77ace4 100644 --- a/examples/openapi-ts-angular/src/client/client/client.gen.ts +++ b/examples/openapi-ts-angular/src/client/client/client.gen.ts @@ -16,6 +16,8 @@ import { import { firstValueFrom } from 'rxjs'; import { filter } from 'rxjs/operators'; +import { createSseClient } from '../core/serverSentEvents.gen'; +import type { HttpMethod } from '../core/types.gen'; import type { Client, Config, @@ -60,14 +62,13 @@ export const createClient = (config: Config = {}): Client => { ThrowOnError extends boolean = false, TResponseStyle extends ResponseStyle = 'fields', >( - options: RequestOptions, + options: RequestOptions, ) => { const opts = { ..._config, ...options, headers: mergeHeaders(_config.headers, options.headers), httpClient: options.httpClient ?? _config.httpClient, - method: 'GET', serializedBody: options.body as any, }; @@ -94,7 +95,7 @@ export const createClient = (config: Config = {}): Client => { const url = buildUrl(opts as any); const req = new HttpRequest( - opts.method, + opts.method ?? 'GET', url, opts.serializedBody || null, { @@ -103,11 +104,11 @@ export const createClient = (config: Config = {}): Client => { }, ); - return { opts, req }; + return { opts, req, url }; }; - const request: Client['request'] = async (options) => { - const { opts, req: initialReq } = requestOptions(options); + const beforeRequest = async (options: RequestOptions) => { + const { opts, req, url } = requestOptions(options); if (opts.security) { await setAuthParams({ @@ -120,6 +121,13 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } + return { opts, req, url }; + }; + + const request: Client['request'] = async (options) => { + // @ts-expect-error + const { opts, req: initialReq } = await beforeRequest(options); + let req = initialReq; for (const fn of interceptors.request._fns) { @@ -128,26 +136,28 @@ export const createClient = (config: Config = {}): Client => { } } - let response; - const result = { + const result: { + request: HttpRequest; + response: any; + } = { request: req, - response, + response: null, }; try { - response = await firstValueFrom( + result.response = (await firstValueFrom( opts .httpClient!.request(req) .pipe(filter((event) => event.type === HttpEventType.Response)), - ); + )) as HttpResponse; for (const fn of interceptors.response._fns) { if (fn) { - response = await fn(response, req, opts as any); + result.response = await fn(result.response, req, opts as any); } } - let bodyResponse: any = response.body; + let bodyResponse = result.response.body; if (opts.responseValidator) { await opts.responseValidator(bodyResponse); @@ -162,7 +172,7 @@ export const createClient = (config: Config = {}): Client => { : { data: bodyResponse, ...result }; } catch (error) { if (error instanceof HttpErrorResponse) { - response = error; + result.response = error; } let finalError = error instanceof HttpErrorResponse ? error.error : error; @@ -171,7 +181,7 @@ export const createClient = (config: Config = {}): Client => { if (fn) { finalError = (await fn( finalError, - response as HttpResponse, + result.response as any, req, opts as any, )) as string; @@ -191,18 +201,34 @@ export const createClient = (config: Config = {}): Client => { } }; + const makeMethodFn = + (method: Uppercase) => (options: RequestOptions) => + request({ ...options, method }); + + const makeSseFn = + (method: Uppercase) => async (options: RequestOptions) => { + const { opts, url } = await beforeRequest(options); + return createSseClient({ + ...opts, + body: opts.body as BodyInit | null | undefined, + headers: opts.headers as unknown as Record, + method, + url, + }); + }; + return { buildUrl, - connect: (options) => request({ ...options, method: 'CONNECT' }), - delete: (options) => request({ ...options, method: 'DELETE' }), - get: (options) => request({ ...options, method: 'GET' }), + connect: makeMethodFn('CONNECT'), + delete: makeMethodFn('DELETE'), + get: makeMethodFn('GET'), getConfig, - head: (options) => request({ ...options, method: 'HEAD' }), + head: makeMethodFn('HEAD'), interceptors, - options: (options) => request({ ...options, method: 'OPTIONS' }), - patch: (options) => request({ ...options, method: 'PATCH' }), - post: (options) => request({ ...options, method: 'POST' }), - put: (options) => request({ ...options, method: 'PUT' }), + options: makeMethodFn('OPTIONS'), + patch: makeMethodFn('PATCH'), + post: makeMethodFn('POST'), + put: makeMethodFn('PUT'), request, requestOptions: (options) => { if (options.security) { @@ -218,6 +244,17 @@ export const createClient = (config: Config = {}): Client => { return requestOptions(options).req; }, setConfig, - trace: (options) => request({ ...options, method: 'TRACE' }), - }; + sse: { + connect: makeSseFn('CONNECT'), + delete: makeSseFn('DELETE'), + get: makeSseFn('GET'), + head: makeSseFn('HEAD'), + options: makeSseFn('OPTIONS'), + patch: makeSseFn('PATCH'), + post: makeSseFn('POST'), + put: makeSseFn('PUT'), + trace: makeSseFn('TRACE'), + }, + trace: makeMethodFn('TRACE'), + } as Client; }; diff --git a/examples/openapi-ts-angular/src/client/client/types.gen.ts b/examples/openapi-ts-angular/src/client/client/types.gen.ts index 488cf889c..6cdf8ad48 100644 --- a/examples/openapi-ts-angular/src/client/client/types.gen.ts +++ b/examples/openapi-ts-angular/src/client/client/types.gen.ts @@ -10,6 +10,10 @@ import type { import type { Injector } from '@angular/core'; import type { Auth } from '../core/auth.gen'; +import type { + ServerSentEventsOptions, + ServerSentEventsResult, +} from '../core/serverSentEvents.gen'; import type { Client as CoreClient, Config as CoreConfig, @@ -63,13 +67,22 @@ export interface Config } export interface RequestOptions< + TData = unknown, TResponseStyle extends ResponseStyle = 'fields', ThrowOnError extends boolean = boolean, Url extends string = string, > extends Config<{ - responseStyle: TResponseStyle; - throwOnError: ThrowOnError; - }> { + responseStyle: TResponseStyle; + throwOnError: ThrowOnError; + }>, + Pick< + ServerSentEventsOptions, + | 'onSseError' + | 'onSseEvent' + | 'sseDefaultRetryDelay' + | 'sseMaxRetryAttempts' + | 'sseMaxRetryDelay' + > { /** * Any body that you want to add to your request. * @@ -93,7 +106,7 @@ export interface ResolvedRequestOptions< TResponseStyle extends ResponseStyle = 'fields', ThrowOnError extends boolean = boolean, Url extends string = string, -> extends RequestOptions { +> extends RequestOptions { serializedBody?: string; } @@ -150,24 +163,36 @@ type MethodFn = < ThrowOnError extends boolean = false, TResponseStyle extends ResponseStyle = 'fields', >( - options: Omit, 'method'>, + options: Omit, 'method'>, ) => RequestResult; +type SseFn = < + TData = unknown, + TError = unknown, + ThrowOnError extends boolean = false, + TResponseStyle extends ResponseStyle = 'fields', +>( + options: Omit, 'method'>, +) => Promise>; + type RequestFn = < TData = unknown, TError = unknown, ThrowOnError extends boolean = false, TResponseStyle extends ResponseStyle = 'fields', >( - options: Omit, 'method'> & - Pick>, 'method'>, + options: Omit, 'method'> & + Pick< + Required>, + 'method' + >, ) => RequestResult; type RequestOptionsFn = < ThrowOnError extends boolean = false, TResponseStyle extends ResponseStyle = 'fields', >( - options: RequestOptions, + options: RequestOptions, ) => HttpRequest; type BuildUrlFn = < @@ -181,14 +206,19 @@ type BuildUrlFn = < options: Pick & Options, ) => string; -export type Client = CoreClient & { +export type Client = CoreClient< + RequestFn, + Config, + MethodFn, + BuildUrlFn, + SseFn +> & { interceptors: Middleware< HttpRequest, HttpResponse, unknown, ResolvedRequestOptions >; - requestOptions: RequestOptionsFn; }; @@ -217,9 +247,10 @@ type OmitKeys = Pick>; export type Options< TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean, + TResponse = unknown, TResponseStyle extends ResponseStyle = 'fields', > = OmitKeys< - RequestOptions, + RequestOptions, 'body' | 'path' | 'query' | 'url' > & Omit; @@ -231,18 +262,22 @@ export type OptionsLegacyParser< > = TData extends { body?: any } ? TData extends { headers?: any } ? OmitKeys< - RequestOptions, + RequestOptions, 'body' | 'headers' | 'url' > & TData - : OmitKeys, 'body' | 'url'> & + : OmitKeys< + RequestOptions, + 'body' | 'url' + > & TData & - Pick, 'headers'> + Pick, 'headers'> : TData extends { headers?: any } ? OmitKeys< - RequestOptions, + RequestOptions, 'headers' | 'url' > & TData & - Pick, 'body'> - : OmitKeys, 'url'> & TData; + Pick, 'body'> + : OmitKeys, 'url'> & + TData; diff --git a/examples/openapi-ts-angular/src/client/core/serverSentEvents.gen.ts b/examples/openapi-ts-angular/src/client/core/serverSentEvents.gen.ts new file mode 100644 index 000000000..f8fd78e28 --- /dev/null +++ b/examples/openapi-ts-angular/src/client/core/serverSentEvents.gen.ts @@ -0,0 +1,264 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import type { Config } from './types.gen'; + +export type ServerSentEventsOptions = Omit< + RequestInit, + 'method' +> & + Pick & { + /** + * Fetch API implementation. You can use this option to provide a custom + * fetch instance. + * + * @default globalThis.fetch + */ + fetch?: typeof fetch; + /** + * Implementing clients can call request interceptors inside this hook. + */ + onRequest?: (url: string, init: RequestInit) => Promise; + /** + * Callback invoked when a network or parsing error occurs during streaming. + * + * This option applies only if the endpoint returns a stream of events. + * + * @param error The error that occurred. + */ + onSseError?: (error: unknown) => void; + /** + * Callback invoked when an event is streamed from the server. + * + * This option applies only if the endpoint returns a stream of events. + * + * @param event Event streamed from the server. + * @returns Nothing (void). + */ + onSseEvent?: (event: StreamEvent) => void; + serializedBody?: RequestInit['body']; + /** + * Default retry delay in milliseconds. + * + * This option applies only if the endpoint returns a stream of events. + * + * @default 3000 + */ + sseDefaultRetryDelay?: number; + /** + * Maximum number of retry attempts before giving up. + */ + sseMaxRetryAttempts?: number; + /** + * Maximum retry delay in milliseconds. + * + * Applies only when exponential backoff is used. + * + * This option applies only if the endpoint returns a stream of events. + * + * @default 30000 + */ + sseMaxRetryDelay?: number; + /** + * Optional sleep function for retry backoff. + * + * Defaults to using `setTimeout`. + */ + sseSleepFn?: (ms: number) => Promise; + url: string; + }; + +export interface StreamEvent { + data: TData; + event?: string; + id?: string; + retry?: number; +} + +export type ServerSentEventsResult< + TData = unknown, + TReturn = void, + TNext = unknown, +> = { + stream: AsyncGenerator< + TData extends Record ? TData[keyof TData] : TData, + TReturn, + TNext + >; +}; + +export const createSseClient = ({ + onRequest, + onSseError, + onSseEvent, + responseTransformer, + responseValidator, + sseDefaultRetryDelay, + sseMaxRetryAttempts, + sseMaxRetryDelay, + sseSleepFn, + url, + ...options +}: ServerSentEventsOptions): ServerSentEventsResult => { + let lastEventId: string | undefined; + + const sleep = + sseSleepFn ?? + ((ms: number) => new Promise((resolve) => setTimeout(resolve, ms))); + + const createStream = async function* () { + let retryDelay: number = sseDefaultRetryDelay ?? 3000; + let attempt = 0; + const signal = options.signal ?? new AbortController().signal; + + while (true) { + if (signal.aborted) break; + + attempt++; + + const headers = + options.headers instanceof Headers + ? options.headers + : new Headers(options.headers as Record | undefined); + + if (lastEventId !== undefined) { + headers.set('Last-Event-ID', lastEventId); + } + + try { + const requestInit: RequestInit = { + redirect: 'follow', + ...options, + body: options.serializedBody, + headers, + signal, + }; + let request = new Request(url, requestInit); + if (onRequest) { + request = await onRequest(url, requestInit); + } + // fetch must be assigned here, otherwise it would throw the error: + // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation + const _fetch = options.fetch ?? globalThis.fetch; + const response = await _fetch(request); + + if (!response.ok) + throw new Error( + `SSE failed: ${response.status} ${response.statusText}`, + ); + + if (!response.body) throw new Error('No body in SSE response'); + + const reader = response.body + .pipeThrough(new TextDecoderStream()) + .getReader(); + + let buffer = ''; + + const abortHandler = () => { + try { + reader.cancel(); + } catch { + // noop + } + }; + + signal.addEventListener('abort', abortHandler); + + try { + while (true) { + const { done, value } = await reader.read(); + if (done) break; + buffer += value; + + const chunks = buffer.split('\n\n'); + buffer = chunks.pop() ?? ''; + + for (const chunk of chunks) { + const lines = chunk.split('\n'); + const dataLines: Array = []; + let eventName: string | undefined; + + for (const line of lines) { + if (line.startsWith('data:')) { + dataLines.push(line.replace(/^data:\s*/, '')); + } else if (line.startsWith('event:')) { + eventName = line.replace(/^event:\s*/, ''); + } else if (line.startsWith('id:')) { + lastEventId = line.replace(/^id:\s*/, ''); + } else if (line.startsWith('retry:')) { + const parsed = Number.parseInt( + line.replace(/^retry:\s*/, ''), + 10, + ); + if (!Number.isNaN(parsed)) { + retryDelay = parsed; + } + } + } + + let data: unknown; + let parsedJson = false; + + if (dataLines.length) { + const rawData = dataLines.join('\n'); + try { + data = JSON.parse(rawData); + parsedJson = true; + } catch { + data = rawData; + } + } + + if (parsedJson) { + if (responseValidator) { + await responseValidator(data); + } + + if (responseTransformer) { + data = await responseTransformer(data); + } + } + + onSseEvent?.({ + data, + event: eventName, + id: lastEventId, + retry: retryDelay, + }); + + if (dataLines.length) { + yield data as any; + } + } + } + } finally { + signal.removeEventListener('abort', abortHandler); + reader.releaseLock(); + } + + break; // exit loop on normal completion + } catch (error) { + // connection failed or aborted; retry after delay + onSseError?.(error); + + if ( + sseMaxRetryAttempts !== undefined && + attempt >= sseMaxRetryAttempts + ) { + break; // stop after firing error + } + + // exponential backoff: double retry each attempt, cap at 30s + const backoff = Math.min( + retryDelay * 2 ** (attempt - 1), + sseMaxRetryDelay ?? 30000, + ); + await sleep(backoff); + } + } + }; + + const stream = createStream(); + + return { stream }; +}; diff --git a/examples/openapi-ts-angular/src/client/core/types.gen.ts b/examples/openapi-ts-angular/src/client/core/types.gen.ts index 5bfae35c0..643c070c9 100644 --- a/examples/openapi-ts-angular/src/client/core/types.gen.ts +++ b/examples/openapi-ts-angular/src/client/core/types.gen.ts @@ -7,29 +7,36 @@ import type { QuerySerializerOptions, } from './bodySerializer.gen'; -export interface Client< +export type HttpMethod = + | 'connect' + | 'delete' + | 'get' + | 'head' + | 'options' + | 'patch' + | 'post' + | 'put' + | 'trace'; + +export type Client< RequestFn = never, Config = unknown, MethodFn = never, BuildUrlFn = never, -> { + SseFn = never, +> = { /** * Returns the final request URL. */ buildUrl: BuildUrlFn; - connect: MethodFn; - delete: MethodFn; - get: MethodFn; getConfig: () => Config; - head: MethodFn; - options: MethodFn; - patch: MethodFn; - post: MethodFn; - put: MethodFn; request: RequestFn; setConfig: (config: Config) => Config; - trace: MethodFn; -} +} & { + [K in HttpMethod]: MethodFn; +} & ([SseFn] extends [never] + ? { sse?: never } + : { sse: { [K in HttpMethod]: SseFn } }); export interface Config { /** @@ -65,16 +72,7 @@ export interface Config { * * {@link https://developer.mozilla.org/docs/Web/API/fetch#method See more} */ - method?: - | 'CONNECT' - | 'DELETE' - | 'GET' - | 'HEAD' - | 'OPTIONS' - | 'PATCH' - | 'POST' - | 'PUT' - | 'TRACE'; + method?: Uppercase; /** * A function for serializing request query parameters. By default, arrays * will be exploded in form style, objects will be exploded in deepObject diff --git a/examples/openapi-ts-angular/src/client/core/utils.gen.ts b/examples/openapi-ts-angular/src/client/core/utils.gen.ts new file mode 100644 index 000000000..ac31396fe --- /dev/null +++ b/examples/openapi-ts-angular/src/client/core/utils.gen.ts @@ -0,0 +1,114 @@ +// This file is auto-generated by @hey-api/openapi-ts + +import type { QuerySerializer } from './bodySerializer.gen'; +import { + type ArraySeparatorStyle, + serializeArrayParam, + serializeObjectParam, + serializePrimitiveParam, +} from './pathSerializer.gen'; + +export interface PathSerializer { + path: Record; + url: string; +} + +export const PATH_PARAM_RE = /\{[^{}]+\}/g; + +export const defaultPathSerializer = ({ path, url: _url }: PathSerializer) => { + let url = _url; + const matches = _url.match(PATH_PARAM_RE); + if (matches) { + for (const match of matches) { + let explode = false; + let name = match.substring(1, match.length - 1); + let style: ArraySeparatorStyle = 'simple'; + + if (name.endsWith('*')) { + explode = true; + name = name.substring(0, name.length - 1); + } + + if (name.startsWith('.')) { + name = name.substring(1); + style = 'label'; + } else if (name.startsWith(';')) { + name = name.substring(1); + style = 'matrix'; + } + + const value = path[name]; + + if (value === undefined || value === null) { + continue; + } + + if (Array.isArray(value)) { + url = url.replace( + match, + serializeArrayParam({ explode, name, style, value }), + ); + continue; + } + + if (typeof value === 'object') { + url = url.replace( + match, + serializeObjectParam({ + explode, + name, + style, + value: value as Record, + valueOnly: true, + }), + ); + continue; + } + + if (style === 'matrix') { + url = url.replace( + match, + `;${serializePrimitiveParam({ + name, + value: value as string, + })}`, + ); + continue; + } + + const replaceValue = encodeURIComponent( + style === 'label' ? `.${value as string}` : (value as string), + ); + url = url.replace(match, replaceValue); + } + } + return url; +}; + +export const getUrl = ({ + baseUrl, + path, + query, + querySerializer, + url: _url, +}: { + baseUrl?: string; + path?: Record; + query?: Record; + querySerializer: QuerySerializer; + url: string; +}) => { + const pathUrl = _url.startsWith('/') ? _url : `/${_url}`; + let url = (baseUrl ?? '') + pathUrl; + if (path) { + url = defaultPathSerializer({ path, url }); + } + let search = query ? querySerializer(query) : ''; + if (search.startsWith('?')) { + search = search.substring(1); + } + if (search) { + url += `?${search}`; + } + return url; +}; diff --git a/packages/openapi-ts/src/plugins/@angular/common/httpResources.ts b/packages/openapi-ts/src/plugins/@angular/common/httpResources.ts index 132c62569..e65a92162 100644 --- a/packages/openapi-ts/src/plugins/@angular/common/httpResources.ts +++ b/packages/openapi-ts/src/plugins/@angular/common/httpResources.ts @@ -1,4 +1,4 @@ -import type ts from 'typescript'; +import ts from 'typescript'; import type { GeneratedFile } from '../../../generate/file'; import type { IR } from '../../../ir/types'; @@ -15,6 +15,26 @@ import { import { REQUEST_APIS_SUFFIX, RESOURCE_APIS_SUFFIX } from './constants'; import type { AngularCommonPlugin } from './types'; +// Helper function to create a variable statement +const createVariableStatement = ( + name: string, + initializer: ts.Expression, +): ts.VariableStatement => + ts.factory.createVariableStatement( + undefined, + ts.factory.createVariableDeclarationList( + [ + ts.factory.createVariableDeclaration( + name, + undefined, + undefined, + initializer, + ), + ], + ts.NodeFlags.Const, + ), + ); + interface AngularServiceClassEntry { className: string; classes: Set; @@ -198,13 +218,11 @@ const generateAngularFunctionServices = ({ const generateResourceCallExpression = ({ file, - isRequiredOptions, operation, plugin, responseTypeName, }: { file: GeneratedFile; - isRequiredOptions: boolean; operation: IR.OperationObject; plugin: AngularCommonPlugin['Instance']; responseTypeName: string; @@ -213,22 +231,6 @@ const generateResourceCallExpression = ({ // Check if httpRequest is configured to use classes const useRequestClasses = plugin.config.httpRequests.asClass; - let requestFunctionCall; - - // Create the options call expression based on whether options are required - const optionsCallExpression = isRequiredOptions - ? tsc.callExpression({ - functionName: 'options', - parameters: [], - }) - : tsc.conditionalExpression({ - condition: tsc.identifier({ text: 'options' }), - whenFalse: tsc.identifier({ text: 'undefined' }), - whenTrue: tsc.callExpression({ - functionName: 'options', - parameters: [], - }), - }); if (useRequestClasses) { // For class-based request methods, use inject and class hierarchy @@ -278,9 +280,37 @@ const generateResourceCallExpression = ({ name: requestMethodName, }); - requestFunctionCall = tsc.callExpression({ - functionName: methodAccess, - parameters: [optionsCallExpression], + return tsc.callExpression({ + functionName: 'httpResource', + parameters: [ + tsc.arrowFunction({ + parameters: [], + statements: [ + createVariableStatement( + 'opts', + tsc.conditionalExpression({ + condition: tsc.identifier({ text: 'options' }), + whenFalse: tsc.identifier({ text: 'undefined' }), + whenTrue: tsc.callExpression({ + functionName: 'options', + parameters: [], + }), + }), + ), + tsc.returnStatement({ + expression: tsc.conditionalExpression({ + condition: tsc.identifier({ text: 'opts' }), + whenFalse: tsc.identifier({ text: 'undefined' }), + whenTrue: tsc.callExpression({ + functionName: methodAccess, + parameters: [tsc.identifier({ text: 'opts' })], + }), + }), + }), + ], + }), + ], + types: [tsc.typeNode(responseTypeName)], }); } } else { @@ -296,12 +326,41 @@ const generateResourceCallExpression = ({ name: requestFunctionName, }); - requestFunctionCall = tsc.callExpression({ - functionName: requestImport.name, - parameters: [optionsCallExpression], + return tsc.callExpression({ + functionName: 'httpResource', + parameters: [ + tsc.arrowFunction({ + parameters: [], + statements: [ + createVariableStatement( + 'opts', + tsc.conditionalExpression({ + condition: tsc.identifier({ text: 'options' }), + whenFalse: tsc.identifier({ text: 'undefined' }), + whenTrue: tsc.callExpression({ + functionName: 'options', + parameters: [], + }), + }), + ), + tsc.returnStatement({ + expression: tsc.conditionalExpression({ + condition: tsc.identifier({ text: 'opts' }), + whenFalse: tsc.identifier({ text: 'undefined' }), + whenTrue: tsc.callExpression({ + functionName: requestImport.name, + parameters: [tsc.identifier({ text: 'opts' })], + }), + }), + }), + ], + }), + ], + types: [tsc.typeNode(responseTypeName)], }); } + // Fallback return (should not reach here) return tsc.callExpression({ functionName: 'httpResource', parameters: [ @@ -309,7 +368,7 @@ const generateResourceCallExpression = ({ parameters: [], statements: [ tsc.returnStatement({ - expression: requestFunctionCall, + expression: tsc.identifier({ text: 'undefined' }), }), ], }), @@ -360,7 +419,7 @@ const generateAngularResourceMethod = ({ { isRequired: isRequiredOptions, name: 'options', - type: `() => Options<${dataType.name || 'unknown'}, ThrowOnError>`, + type: `() => Options<${dataType.name || 'unknown'}, ThrowOnError> | undefined`, }, ], returnType: undefined, @@ -368,7 +427,6 @@ const generateAngularResourceMethod = ({ tsc.returnStatement({ expression: generateResourceCallExpression({ file, - isRequiredOptions, operation, plugin, responseTypeName: responseType.name || 'unknown', @@ -425,14 +483,13 @@ const generateAngularResourceFunction = ({ { isRequired: isRequiredOptions, name: 'options', - type: `() => Options<${dataType.name || 'unknown'}, ThrowOnError>`, + type: `() => Options<${dataType.name || 'unknown'}, ThrowOnError> | undefined`, }, ], statements: [ tsc.returnStatement({ expression: generateResourceCallExpression({ file, - isRequiredOptions, operation, plugin, responseTypeName: responseType.name || 'unknown', -- 2.51.2 From 7fe3aa1d240c007cddb7a240a067f6e1de7c7e28 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Mon, 1 Sep 2025 01:01:52 +0000 Subject: [PATCH 05/46] chore(docs): update contributors list --- docs/partials/contributors-list.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/partials/contributors-list.md b/docs/partials/contributors-list.md index dd0b29e19..1896f9ef8 100644 --- a/docs/partials/contributors-list.md +++ b/docs/partials/contributors-list.md @@ -11,6 +11,7 @@ - [Bogdan ](https://github.com/BogdanMaier) - [Brian Tarricone](https://github.com/kelnos) - [Carl Kittelberger](https://github.com/icedream) +- [Changwan](https://github.com/WooWan) - [Chris Wiggins](https://github.com/chriswiggins) - [Daniel Roe](https://github.com/danielroe) - [Daschi](https://github.com/Daschi1) -- 2.51.2 From ee35b337909c2dfa76b8aa915d4b6e185deafa2b Mon Sep 17 00:00:00 2001 From: Lubos Date: Mon, 1 Sep 2025 16:34:45 +0800 Subject: [PATCH 06/46] Create sweet-dragons-reflect.md --- .changeset/sweet-dragons-reflect.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/sweet-dragons-reflect.md diff --git a/.changeset/sweet-dragons-reflect.md b/.changeset/sweet-dragons-reflect.md new file mode 100644 index 000000000..72b6871eb --- /dev/null +++ b/.changeset/sweet-dragons-reflect.md @@ -0,0 +1,5 @@ +--- +"@hey-api/openapi-ts": patch +--- + +fix(angular): allow `httpResource` to skip requests when `undefined` is returned -- 2.51.2 From 4d71bcd6c871a5153b83d363df68c8041b85fdb5 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 1 Sep 2025 09:14:37 +0000 Subject: [PATCH 07/46] ci: release --- .changeset/sweet-dragons-reflect.md | 5 ----- packages/openapi-ts/CHANGELOG.md | 6 ++++++ packages/openapi-ts/package.json | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) delete mode 100644 .changeset/sweet-dragons-reflect.md diff --git a/.changeset/sweet-dragons-reflect.md b/.changeset/sweet-dragons-reflect.md deleted file mode 100644 index 72b6871eb..000000000 --- a/.changeset/sweet-dragons-reflect.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@hey-api/openapi-ts": patch ---- - -fix(angular): allow `httpResource` to skip requests when `undefined` is returned diff --git a/packages/openapi-ts/CHANGELOG.md b/packages/openapi-ts/CHANGELOG.md index de64293bc..278c65ada 100644 --- a/packages/openapi-ts/CHANGELOG.md +++ b/packages/openapi-ts/CHANGELOG.md @@ -1,5 +1,11 @@ # @hey-api/openapi-ts +## 0.82.3 + +### Patch Changes + +- fix(angular): allow `httpResource` to skip requests when `undefined` is returned ([#2572](https://github.com/hey-api/openapi-ts/pull/2572)) ([`ee35b33`](https://github.com/hey-api/openapi-ts/commit/ee35b337909c2dfa76b8aa915d4b6e185deafa2b)) by [@max-scopp](https://github.com/max-scopp) + ## 0.82.2 ### Patch Changes diff --git a/packages/openapi-ts/package.json b/packages/openapi-ts/package.json index 3dd43ae31..a91e20513 100644 --- a/packages/openapi-ts/package.json +++ b/packages/openapi-ts/package.json @@ -1,6 +1,6 @@ { "name": "@hey-api/openapi-ts", - "version": "0.82.2", + "version": "0.82.3", "description": "🚀 The OpenAPI to TypeScript codegen. Generate clients, SDKs, validators, and more.", "homepage": "https://heyapi.dev/", "repository": { -- 2.51.2 From 4064f51aaf262401f186e422b124143a4df09b99 Mon Sep 17 00:00:00 2001 From: Fransis Young Date: Mon, 1 Sep 2025 10:51:27 -0400 Subject: [PATCH 08/46] fix(client-fetch): ensures valid serialized or unserialized body is sent with request refs: #2553 --- .../client-fetch/__tests__/client.test.ts | 126 +++++++++++++++--- .../@hey-api/client-fetch/bundle/client.ts | 29 +++- 2 files changed, 131 insertions(+), 24 deletions(-) diff --git a/packages/openapi-ts/src/plugins/@hey-api/client-fetch/__tests__/client.test.ts b/packages/openapi-ts/src/plugins/@hey-api/client-fetch/__tests__/client.test.ts index 06181052d..b99f0823e 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/client-fetch/__tests__/client.test.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/client-fetch/__tests__/client.test.ts @@ -223,29 +223,88 @@ describe('zero-length body handling', () => { }); }); -describe('request body handling', () => { +describe('unserialized request body handling', () => { + const client = createClient({ baseUrl: 'https://example.com' }); + + const scenarios = [ + { body: 0, textValue: '0' }, + { body: false, textValue: 'false' }, + { body: 'test string', textValue: 'test string' }, + { body: '', textValue: '' }, + ]; + + it.each(scenarios)( + 'handles plain text body with $body value', + async ({ body, textValue }) => { + const mockResponse = new Response(JSON.stringify({ success: true }), { + headers: { + 'Content-Type': 'application/json', + }, + status: 200, + }); + + const mockFetch: MockFetch = vi.fn().mockResolvedValueOnce(mockResponse); + + const result = await client.post({ + body, + bodySerializer: null, + fetch: mockFetch, + headers: { + 'Content-Type': 'text/plain', + }, + url: '/test', + }); + + expect(mockFetch).toHaveBeenCalledWith( + expect.objectContaining({ + body: expect.any(ReadableStream), + }), + ); + + await expect(result.request.text()).resolves.toEqual(textValue); + expect(result.request.headers.get('Content-Type')).toEqual('text/plain'); + }, + ); +}); + +describe('serialized request body handling', () => { const client = createClient({ baseUrl: 'https://example.com' }); const scenarios = [ { - body: 'test string', - bodySerializer: null, - contentType: 'text/plain', - expectedSerializedValue: undefined, - expectedValue: async (request: Request) => await request.text(), + expectBodyValue: false, + expectContentHeader: false, + serializedBody: '', + textValue: '', }, { - body: { key: 'value' }, - bodySerializer: (body: object) => JSON.stringify(body), - contentType: 'application/json', - expectedSerializedValue: '{"key":"value"}', - expectedValue: async (request: Request) => await request.json(), + expectBodyValue: true, + expectContentHeader: true, + serializedBody: 0, + textValue: '0', + }, + { + expectBodyValue: true, + expectContentHeader: true, + serializedBody: false, + textValue: 'false', + }, + { + expectBodyValue: true, + expectContentHeader: true, + serializedBody: '{"key":"value"}', + textValue: '{"key":"value"}', }, ]; it.each(scenarios)( - 'sends $contentType body', - async ({ body, bodySerializer, contentType, expectedValue }) => { + 'handles $serializedBody serializedBody', + async ({ + expectBodyValue, + expectContentHeader, + serializedBody, + textValue, + }) => { const mockResponse = new Response(JSON.stringify({ success: true }), { headers: { 'Content-Type': 'application/json', @@ -256,22 +315,51 @@ describe('request body handling', () => { const mockFetch: MockFetch = vi.fn().mockResolvedValueOnce(mockResponse); const result = await client.post({ - body, - bodySerializer, + body: {}, + bodySerializer: () => serializedBody, fetch: mockFetch, headers: { - 'Content-Type': contentType, + 'Content-Type': 'application/json', }, url: '/test', }); - await expect(expectedValue(result.request)).resolves.toEqual(body); - expect(result.request.headers.get('Content-Type')).toContain(contentType); + expect(mockFetch).toHaveBeenCalledWith( + expect.objectContaining({ + body: expectBodyValue ? expect.any(ReadableStream) : null, + }), + ); + + await expect(result.request.text()).resolves.toEqual(textValue); + expect(result.request.headers.get('Content-Type')).toEqual( + expectContentHeader ? 'application/json' : null, + ); }, ); +}); + +describe('request interceptor', () => { + const client = createClient({ baseUrl: 'https://example.com' }); + + const scenarios = [ + { + body: 'test string', + bodySerializer: null, + contentType: 'text/plain', + expectedSerializedValue: undefined, + expectedValue: async (request: Request) => await request.text(), + }, + { + body: { key: 'value' }, + bodySerializer: (body: object) => JSON.stringify(body), + contentType: 'application/json', + expectedSerializedValue: '{"key":"value"}', + expectedValue: async (request: Request) => await request.json(), + }, + ]; it.each(scenarios)( - 'exposes $contentType serialized and raw body in interceptor', + 'exposes $contentType serialized and raw body values', async ({ body, bodySerializer, contentType, expectedSerializedValue }) => { const mockResponse = new Response(JSON.stringify({ success: true }), { headers: { diff --git a/packages/openapi-ts/src/plugins/@hey-api/client-fetch/bundle/client.ts b/packages/openapi-ts/src/plugins/@hey-api/client-fetch/bundle/client.ts index cd9966528..397399cf1 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/client-fetch/bundle/client.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/client-fetch/bundle/client.ts @@ -63,7 +63,10 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.body === undefined || opts.body === '') { + if ( + opts.body === undefined || + (opts.serializedBody !== undefined && opts.serializedBody === '') + ) { opts.headers.delete('Content-Type'); } @@ -78,12 +81,9 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, + body: getValidRequestBody(opts), }; - if (opts.serializedBody) { - requestInit.body = opts.serializedBody; - } - let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { @@ -213,6 +213,25 @@ export const createClient = (config: Config = {}): Client => { }; }; + function getValidRequestBody(options: ResolvedRequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + return null; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); -- 2.51.2 From 3b2ca4ef1376761f020fdcee0f092bd97eba626b Mon Sep 17 00:00:00 2001 From: Fransis Young Date: Tue, 2 Sep 2025 07:16:31 -0400 Subject: [PATCH 09/46] fix(client-fetch): ensures request body can be serialized when defined refs: #2553 --- .../@hey-api/client-fetch/__tests__/client.test.ts | 9 +++++++-- .../src/plugins/@hey-api/client-fetch/bundle/client.ts | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/packages/openapi-ts/src/plugins/@hey-api/client-fetch/__tests__/client.test.ts b/packages/openapi-ts/src/plugins/@hey-api/client-fetch/__tests__/client.test.ts index b99f0823e..856996390 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/client-fetch/__tests__/client.test.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/client-fetch/__tests__/client.test.ts @@ -272,24 +272,28 @@ describe('serialized request body handling', () => { const scenarios = [ { + body: '', expectBodyValue: false, expectContentHeader: false, serializedBody: '', textValue: '', }, { + body: 0, expectBodyValue: true, expectContentHeader: true, serializedBody: 0, textValue: '0', }, { + body: false, expectBodyValue: true, expectContentHeader: true, serializedBody: false, textValue: 'false', }, { + body: {}, expectBodyValue: true, expectContentHeader: true, serializedBody: '{"key":"value"}', @@ -298,8 +302,9 @@ describe('serialized request body handling', () => { ]; it.each(scenarios)( - 'handles $serializedBody serializedBody', + 'handles $serializedBody serializedBody value', async ({ + body, expectBodyValue, expectContentHeader, serializedBody, @@ -315,7 +320,7 @@ describe('serialized request body handling', () => { const mockFetch: MockFetch = vi.fn().mockResolvedValueOnce(mockResponse); const result = await client.post({ - body: {}, + body, bodySerializer: () => serializedBody, fetch: mockFetch, headers: { diff --git a/packages/openapi-ts/src/plugins/@hey-api/client-fetch/bundle/client.ts b/packages/openapi-ts/src/plugins/@hey-api/client-fetch/bundle/client.ts index 397399cf1..7373139c9 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/client-fetch/bundle/client.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/client-fetch/bundle/client.ts @@ -58,7 +58,7 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } -- 2.51.2 From 7c3e725ff7b1d23ea8e64530c207ca7c5e3ff500 Mon Sep 17 00:00:00 2001 From: Fransis Young Date: Tue, 2 Sep 2025 07:55:45 -0400 Subject: [PATCH 10/46] fix(client-next): ensures valid serialized or unserialized body is sent with request refs: #2553 --- .../client-next/__tests__/client.test.ts | 113 +++++++++++++++--- .../@hey-api/client-next/bundle/client.ts | 31 ++++- 2 files changed, 120 insertions(+), 24 deletions(-) diff --git a/packages/openapi-ts/src/plugins/@hey-api/client-next/__tests__/client.test.ts b/packages/openapi-ts/src/plugins/@hey-api/client-next/__tests__/client.test.ts index 35723cee1..61eb654b2 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/client-next/__tests__/client.test.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/client-next/__tests__/client.test.ts @@ -54,29 +54,83 @@ describe('buildUrl', () => { }); }); -describe('request body handling', () => { +describe('unserialized request body handling', () => { + const client = createClient({ baseUrl: 'https://example.com' }); + + const scenarios = [ + { body: 0 }, + { body: false }, + { body: 'test string' }, + { body: '' }, + ]; + + it.each(scenarios)( + 'handles plain text body with $body value', + async ({ body }) => { + const mockResponse = new Response(JSON.stringify({ success: true }), { + headers: { + 'Content-Type': 'application/json', + }, + status: 200, + }); + + const mockFetch: MockFetch = vi.fn().mockResolvedValueOnce(mockResponse); + const headers = new Headers({ 'Content-Type': 'text/plain' }); + + await client.post({ + body, + bodySerializer: null, + fetch: mockFetch, + headers: { + 'Content-Type': 'text/plain', + }, + url: '/test', + }); + + expect(mockFetch).toHaveBeenCalledExactlyOnceWith( + expect.any(String), + expect.objectContaining({ + body, + headers, + }), + ); + }, + ); +}); + +describe('serialized request body handling', () => { const client = createClient({ baseUrl: 'https://example.com' }); const scenarios = [ { - body: 'test string', - bodySerializer: null, - contentType: 'text/plain', - expectedSerializedValue: undefined, - expectedValue: 'test string', + body: '', + expectBodyValue: false, + expectContentHeader: false, + serializedBody: '', }, { - body: { key: 'value' }, - bodySerializer: (body: object) => JSON.stringify(body), - contentType: 'application/json', - expectedSerializedValue: '{"key":"value"}', - expectedValue: '{"key":"value"}', + body: 0, + expectBodyValue: true, + expectContentHeader: true, + serializedBody: 0, + }, + { + body: false, + expectBodyValue: true, + expectContentHeader: true, + serializedBody: false, + }, + { + body: {}, + expectBodyValue: true, + expectContentHeader: true, + serializedBody: '{"key":"value"}', }, ]; it.each(scenarios)( - 'sends $contentType body', - async ({ body, bodySerializer, contentType, expectedValue }) => { + 'handles $serializedBody serializedBody value', + async ({ body, expectBodyValue, expectContentHeader, serializedBody }) => { const mockResponse = new Response(JSON.stringify({ success: true }), { headers: { 'Content-Type': 'application/json', @@ -85,25 +139,48 @@ describe('request body handling', () => { }); const mockFetch: MockFetch = vi.fn().mockResolvedValueOnce(mockResponse); - const headers = new Headers({ 'Content-Type': contentType }); + const headers = new Headers({ 'Content-Type': 'application/json' }); await client.post({ body, - bodySerializer, + bodySerializer: () => serializedBody, fetch: mockFetch, - headers, + headers: { + 'Content-Type': 'application/json', + }, url: '/test', }); expect(mockFetch).toHaveBeenCalledExactlyOnceWith( expect.any(String), expect.objectContaining({ - body: expectedValue, - headers, + body: expectBodyValue ? serializedBody : null, + headers: expectContentHeader ? headers : new Headers(), }), ); }, ); +}); + +describe('request interceptor', () => { + const client = createClient({ baseUrl: 'https://example.com' }); + + const scenarios = [ + { + body: 'test string', + bodySerializer: null, + contentType: 'text/plain', + expectedSerializedValue: undefined, + expectedValue: 'test string', + }, + { + body: { key: 'value' }, + bodySerializer: (body: object) => JSON.stringify(body), + contentType: 'application/json', + expectedSerializedValue: '{"key":"value"}', + expectedValue: '{"key":"value"}', + }, + ]; it.each(scenarios)( 'exposes $contentType serialized and raw body in interceptor', diff --git a/packages/openapi-ts/src/plugins/@hey-api/client-next/bundle/client.ts b/packages/openapi-ts/src/plugins/@hey-api/client-next/bundle/client.ts index a6322c6d1..18ec4bca8 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/client-next/bundle/client.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/client-next/bundle/client.ts @@ -57,12 +57,15 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.body === undefined || opts.body === '') { + if ( + opts.body === undefined || + (opts.serializedBody !== undefined && opts.serializedBody === '') + ) { opts.headers.delete('Content-Type'); } @@ -87,12 +90,9 @@ export const createClient = (config: Config = {}): Client => { const _fetch = opts.fetch!; const requestInit: ReqInit = { ...opts, + body: getValidRequestBody(opts), }; - if (opts.serializedBody) { - requestInit.body = opts.serializedBody; - } - let response = await _fetch(url, requestInit); for (const fn of interceptors.response._fns) { @@ -201,6 +201,25 @@ export const createClient = (config: Config = {}): Client => { }; }; + function getValidRequestBody(options: ResolvedRequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + return null; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); -- 2.51.2 From d353e4642af1ff38fe9b9e3248d11f64e829ec55 Mon Sep 17 00:00:00 2001 From: carson2222 Date: Mon, 1 Sep 2025 19:07:49 +0200 Subject: [PATCH 11/46] chore(schema): add functionality for handling $ref to /path This was added to @hey-api/json-schema-ref-parser 1.0.8 but I'm moving it directly to openapi-ts --- .../openapi-ts-tests/main/test/3.1.x.test.ts | 8 + .../__snapshots__/3.1.x/external/index.ts | 2 + .../__snapshots__/3.1.x/external/types.gen.ts | 80 ++ .../specs/3.1.x/external-shared.json | 26 + .../specs/3.1.x/external.yaml | 56 ++ .../src/openApi/2.0.x/parser/schema.ts | 17 + .../src/openApi/3.0.x/parser/schema.ts | 18 + .../src/openApi/3.1.x/parser/schema.ts | 18 + pnpm-lock.yaml | 729 +++++++++--------- 9 files changed, 585 insertions(+), 369 deletions(-) create mode 100644 packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/external/index.ts create mode 100644 packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/external/types.gen.ts create mode 100644 packages/openapi-ts-tests/specs/3.1.x/external.yaml diff --git a/packages/openapi-ts-tests/main/test/3.1.x.test.ts b/packages/openapi-ts-tests/main/test/3.1.x.test.ts index daaaa2c13..545886a05 100644 --- a/packages/openapi-ts-tests/main/test/3.1.x.test.ts +++ b/packages/openapi-ts-tests/main/test/3.1.x.test.ts @@ -44,6 +44,13 @@ describe(`OpenAPI ${version}`, () => { }; const scenarios = [ + { + config: createConfig({ + input: 'external.yaml', + output: 'external', + }), + description: 'handles external references', + }, { config: createConfig({ input: 'pattern-properties.json', @@ -924,6 +931,7 @@ describe(`OpenAPI ${version}`, () => { ]; it.each(scenarios)('$description', async ({ config }) => { + // it.each([scenarios[0]])('$description', async ({ config }) => { await createClient(config); const outputPath = diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/external/index.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/external/index.ts new file mode 100644 index 000000000..56bade120 --- /dev/null +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/external/index.ts @@ -0,0 +1,2 @@ +// This file is auto-generated by @hey-api/openapi-ts +export * from './types.gen'; \ No newline at end of file diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/external/types.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/external/types.gen.ts new file mode 100644 index 000000000..ac461a885 --- /dev/null +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/external/types.gen.ts @@ -0,0 +1,80 @@ +// This file is auto-generated by @hey-api/openapi-ts + +/** + * External schema (A) + */ +export type ExternalSchemaA = { + id: string; + name?: string; +}; + +/** + * External schema (B) + */ +export type ExternalSchemaB = ExternalSchemaA; + +/** + * External schema (C) + */ +export type ExternalSchemaC = ExternalSchemaA; + +/** + * External schema property (A) + */ +export type ExternalSchemaPropertyA = { + 0?: string; +}; + +/** + * External schema property (B) + */ +export type ExternalSchemaPropertyB = { + 0?: ; +}; + +/** + * External schema property from component (A.id) + */ +export type ExternalSchemaPropertyFromComponent = { + 0?: ; +}; + +/** + * External schema property with duplicate refs (D) + */ +export type ExternalSchemaPropertyD = { + 0?: ; + 1?: ; +}; + +/** + * External schema property via external property ref (id) + */ +export type ExternalSchemaExternalProp = { + 0?: ; +}; + +/** + * Alias to external property via component property ref + */ +export type ExternalSchemaExternalPropAlias = { + 0?: ; +}; + +/** + * External double nested prop via property ref + */ +export type ExternalDoubleNestedProp = { + 0?: string; +}; + +/** + * External double nested numeric properties + */ +export type ExternalDoubleNestedNumeric = { + 0?: string; +}; + +export type ClientOptions = { + baseUrl: `${string}://${string}` | (string & {}); +}; \ No newline at end of file diff --git a/packages/openapi-ts-tests/specs/3.1.x/external-shared.json b/packages/openapi-ts-tests/specs/3.1.x/external-shared.json index ed014d790..4f0914ca9 100644 --- a/packages/openapi-ts-tests/specs/3.1.x/external-shared.json +++ b/packages/openapi-ts-tests/specs/3.1.x/external-shared.json @@ -6,5 +6,31 @@ "name": { "type": "string" } }, "required": ["id"] + }, + "ExternalSharedModelWithUuid": { + "type": "string", + "format": "uuid" + }, + "ExternalNested": { + "type": "object", + "properties": { + "inner": { + "type": "object", + "properties": { + "deep": { "type": "string" } + } + } + } + }, + "ExternalNestedNumeric": { + "type": "object", + "properties": { + "0": { + "type": "object", + "properties": { + "1": { "type": "string" } + } + } + } } } diff --git a/packages/openapi-ts-tests/specs/3.1.x/external.yaml b/packages/openapi-ts-tests/specs/3.1.x/external.yaml new file mode 100644 index 000000000..1be6db44b --- /dev/null +++ b/packages/openapi-ts-tests/specs/3.1.x/external.yaml @@ -0,0 +1,56 @@ +openapi: 3.1.1 +info: + title: OpenAPI 3.1.1 external example + version: 1 +components: + schemas: + ExternalSchemaA: + description: External schema (A) + $ref: './external-shared.json#/ExternalSharedModel' + ExternalSchemaB: + description: External schema (B) + $ref: './external-shared.json#/ExternalSharedModel' + ExternalSchemaC: + description: External schema (C) + $ref: './external-shared.json#/ExternalSharedModel' + ExternalSchemaPropertyA: + description: External schema property (A) + type: object + properties: + - $ref: './external-shared.json#/ExternalSharedModelWithUuid' + ExternalSchemaPropertyB: + description: External schema property (B) + type: object + properties: + - $ref: './external-shared.json#/ExternalSharedModelWithUuid' + ExternalSchemaPropertyFromComponent: + description: External schema property from component (A.id) + type: object + properties: + - $ref: '#/components/schemas/ExternalSchemaA/properties/id' + ExternalSchemaPropertyD: + description: External schema property with duplicate refs (D) + type: object + properties: + - $ref: './external-shared.json#/ExternalSharedModelWithUuid' + - $ref: './external-shared.json#/ExternalSharedModelWithUuid' + ExternalSchemaExternalProp: + description: External schema property via external property ref (id) + type: object + properties: + - $ref: './external-shared.json#/ExternalSharedModel/properties/id' + ExternalSchemaExternalPropAlias: + description: Alias to external property via component property ref + type: object + properties: + - $ref: '#/components/schemas/ExternalSchemaExternalProp/properties/0' + ExternalDoubleNestedProp: + description: External double nested prop via property ref + type: object + properties: + - $ref: './external-shared.json#/ExternalNested/properties/inner/properties/deep' + ExternalDoubleNestedNumeric: + description: External double nested numeric properties + type: object + properties: + - $ref: './external-shared.json#/ExternalNestedNumeric/properties/0/properties/1' diff --git a/packages/openapi-ts/src/openApi/2.0.x/parser/schema.ts b/packages/openapi-ts/src/openApi/2.0.x/parser/schema.ts index 9c0b09ac8..82557cd73 100644 --- a/packages/openapi-ts/src/openApi/2.0.x/parser/schema.ts +++ b/packages/openapi-ts/src/openApi/2.0.x/parser/schema.ts @@ -588,6 +588,23 @@ const parseRef = ({ state: SchemaState; }): IR.SchemaObject => { const irSchema: IR.SchemaObject = {}; + // Inline non-component refs (e.g. #/paths/...) to avoid generating orphaned named types + const isComponentsRef = schema.$ref.startsWith('#/definitions/'); + if (!isComponentsRef) { + if (!state.circularReferenceTracker.has(schema.$ref)) { + const refSchema = context.resolveRef(schema.$ref); + return schemaToIrSchema({ + context, + schema: refSchema, + state: { + ...state, + $ref: schema.$ref, + isProperty: false, + }, + }); + } + // Fallback to preserving the ref if circular + } // refs using unicode characters become encoded, didn't investigate why // but the suspicion is this comes from `@hey-api/json-schema-ref-parser` diff --git a/packages/openapi-ts/src/openApi/3.0.x/parser/schema.ts b/packages/openapi-ts/src/openApi/3.0.x/parser/schema.ts index d39f5ed04..60af07a36 100644 --- a/packages/openapi-ts/src/openApi/3.0.x/parser/schema.ts +++ b/packages/openapi-ts/src/openApi/3.0.x/parser/schema.ts @@ -818,6 +818,24 @@ const parseRef = ({ schema: ReferenceObject; state: SchemaState; }): IR.SchemaObject => { + // Inline non-component refs (e.g. #/paths/...) to avoid generating orphaned named types + const isComponentsRef = schema.$ref.startsWith('#/components/'); + if (!isComponentsRef) { + if (!state.circularReferenceTracker.has(schema.$ref)) { + const refSchema = context.resolveRef(schema.$ref); + return schemaToIrSchema({ + context, + schema: refSchema, + state: { + ...state, + $ref: schema.$ref, + isProperty: false, + }, + }); + } + // Fallback to preserving the ref if circular + } + const irSchema: IR.SchemaObject = {}; // refs using unicode characters become encoded, didn't investigate why diff --git a/packages/openapi-ts/src/openApi/3.1.x/parser/schema.ts b/packages/openapi-ts/src/openApi/3.1.x/parser/schema.ts index 9199670ac..6ff5e7d2d 100644 --- a/packages/openapi-ts/src/openApi/3.1.x/parser/schema.ts +++ b/packages/openapi-ts/src/openApi/3.1.x/parser/schema.ts @@ -810,6 +810,24 @@ const parseRef = ({ schema: SchemaWithRequired; state: SchemaState; }): IR.SchemaObject => { + // Inline non-component refs (e.g. #/paths/...) to avoid generating orphaned named types + const isComponentsRef = schema.$ref.startsWith('#/components/'); + if (!isComponentsRef) { + if (!state.circularReferenceTracker.has(schema.$ref)) { + const refSchema = context.resolveRef(schema.$ref); + return schemaToIrSchema({ + context, + schema: refSchema, + state: { + ...state, + $ref: schema.$ref, + isProperty: false, + }, + }); + } + // Fallback to preserving the ref if circular + } + let irSchema = initIrSchema({ schema }); const irRefSchema: IR.SchemaObject = {}; diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index c439e493b..639af33cf 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -529,7 +529,7 @@ importers: version: link:../../packages/nuxt nuxt: specifier: 3.14.1592 - version: 3.14.1592(@netlify/blobs@9.1.2)(@parcel/watcher@2.5.1)(@types/node@22.10.5)(db0@0.3.2)(encoding@0.1.13)(eslint@9.17.0(jiti@2.5.1))(ioredis@5.7.0)(less@4.2.2)(magicast@0.3.5)(optionator@0.9.4)(rollup@4.49.0)(sass@1.85.0)(terser@5.43.1)(typescript@5.9.2)(vite@7.1.2(@types/node@22.10.5)(jiti@2.5.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.0)) + version: 3.14.1592(@netlify/blobs@9.1.2)(@parcel/watcher@2.5.1)(@types/node@22.10.5)(db0@0.3.2)(encoding@0.1.13)(eslint@9.17.0(jiti@2.5.1))(ioredis@5.7.0)(less@4.2.2)(magicast@0.3.5)(optionator@0.9.4)(rollup@4.50.0)(sass@1.85.0)(terser@5.43.1)(typescript@5.9.2)(vite@7.1.2(@types/node@22.10.5)(jiti@2.5.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.0)) vue: specifier: 3.5.13 version: 3.5.13(typescript@5.9.2) @@ -697,7 +697,7 @@ importers: version: 7.1.2(@types/node@22.10.5)(jiti@2.5.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.0) vite-plugin-vue-devtools: specifier: 7.7.0 - version: 7.7.0(rollup@4.49.0)(vite@7.1.2(@types/node@22.10.5)(jiti@2.5.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.0))(vue@3.5.13(typescript@5.8.3)) + version: 7.7.0(rollup@4.50.0)(vite@7.1.2(@types/node@22.10.5)(jiti@2.5.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.0))(vue@3.5.13(typescript@5.8.3)) vitest: specifier: 3.1.1 version: 3.1.1(@types/debug@4.1.12)(@types/node@22.10.5)(jiti@2.5.1)(jsdom@23.0.0)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.0) @@ -1086,7 +1086,7 @@ importers: version: 7.1.2(@types/node@22.10.5)(jiti@2.5.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.0) vite-plugin-vue-devtools: specifier: 7.7.0 - version: 7.7.0(rollup@4.49.0)(vite@7.1.2(@types/node@22.10.5)(jiti@2.5.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.0))(vue@3.5.13(typescript@5.8.3)) + version: 7.7.0(rollup@4.50.0)(vite@7.1.2(@types/node@22.10.5)(jiti@2.5.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.0))(vue@3.5.13(typescript@5.8.3)) vitest: specifier: 3.1.1 version: 3.1.1(@types/debug@4.1.12)(@types/node@22.10.5)(jiti@2.5.1)(jsdom@23.0.0)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.0) @@ -1260,7 +1260,7 @@ importers: version: 3.3.2 nuxt: specifier: 3.14.1592 - version: 3.14.1592(@netlify/blobs@9.1.2)(@parcel/watcher@2.5.1)(@types/node@22.10.5)(db0@0.3.2)(encoding@0.1.13)(eslint@9.17.0(jiti@2.5.1))(ioredis@5.7.0)(less@4.2.2)(magicast@0.3.5)(optionator@0.9.4)(rollup@4.49.0)(sass@1.85.0)(terser@5.43.1)(typescript@5.8.3)(vite@7.1.2(@types/node@22.10.5)(jiti@2.5.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.0)) + version: 3.14.1592(@netlify/blobs@9.1.2)(@parcel/watcher@2.5.1)(@types/node@22.10.5)(db0@0.3.2)(encoding@0.1.13)(eslint@9.17.0(jiti@2.5.1))(ioredis@5.7.0)(less@4.2.2)(magicast@0.3.5)(optionator@0.9.4)(rollup@4.50.0)(sass@1.85.0)(terser@5.43.1)(typescript@5.8.3)(vite@7.1.2(@types/node@22.10.5)(jiti@2.5.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.0)) prettier: specifier: 3.4.2 version: 3.4.2 @@ -1371,7 +1371,7 @@ importers: version: 3.3.2 nuxt: specifier: 3.14.1592 - version: 3.14.1592(@netlify/blobs@9.1.2)(@parcel/watcher@2.5.1)(@types/node@22.10.5)(db0@0.3.2)(encoding@0.1.13)(eslint@9.17.0(jiti@2.5.1))(ioredis@5.7.0)(less@4.2.2)(magicast@0.3.5)(optionator@0.9.4)(rollup@4.49.0)(sass@1.85.0)(terser@5.43.1)(typescript@5.8.3)(vite@7.1.2(@types/node@22.10.5)(jiti@2.5.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.0)) + version: 3.14.1592(@netlify/blobs@9.1.2)(@parcel/watcher@2.5.1)(@types/node@22.10.5)(db0@0.3.2)(encoding@0.1.13)(eslint@9.17.0(jiti@2.5.1))(ioredis@5.7.0)(less@4.2.2)(magicast@0.3.5)(optionator@0.9.4)(rollup@4.50.0)(sass@1.85.0)(terser@5.43.1)(typescript@5.8.3)(vite@7.1.2(@types/node@22.10.5)(jiti@2.5.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.0)) prettier: specifier: 3.4.2 version: 3.4.2 @@ -2557,14 +2557,14 @@ packages: '@docsearch/js@4.0.0-beta.8': resolution: {integrity: sha512-elgqPYpykRQr5MlfqoO8U2uC3BcPgjUQhzmHt/H4lSzP7khJ9Jpv/cCB4tiZreXb6GkdRgWr5csiItNq6jjnhg==} - '@emnapi/core@1.4.5': - resolution: {integrity: sha512-XsLw1dEOpkSX/WucdqUhPWP7hDxSvZiY+fsUC14h+FtQ2Ifni4znbBt8punRX+Uj2JG/uDb8nEHVKvrVlvdZ5Q==} + '@emnapi/core@1.5.0': + resolution: {integrity: sha512-sbP8GzB1WDzacS8fgNPpHlp6C9VZe+SJP3F90W9rLemaQj2PzIuTEl1qDOYQf58YIpyjViI24y9aPWCjEzY2cg==} - '@emnapi/runtime@1.4.5': - resolution: {integrity: sha512-++LApOtY0pEEz1zrd9vy1/zXVaVJJ/EbAF3u0fXIzPJEDtnITsBGbbK0EkM72amhl/R5b+5xx0Y/QhcVOpuulg==} + '@emnapi/runtime@1.5.0': + resolution: {integrity: sha512-97/BJ3iXHww3djw6hYIfErCZFee7qCtrneuLa20UXFCOTCfBM2cvQHjWJ2EG0s0MtdNwInarqCTz35i4wWXHsQ==} - '@emnapi/wasi-threads@1.0.4': - resolution: {integrity: sha512-PJR+bOmMOPH8AtcTGAyYNiuJ3/Fcoj2XN/gBEWzDIKh254XO+mM9XoXHk5GNEhodxeMznbg7BlRojVbKN+gC6g==} + '@emnapi/wasi-threads@1.1.0': + resolution: {integrity: sha512-WI0DdZ8xFSbgMjR1sFsKABJ/C5OnRrjT06JXbZKexJGrDuPTzZdDYfFlsgcCXCyf+suG5QU2e/y1Wo2V/OapLQ==} '@esbuild/aix-ppc64@0.19.12': resolution: {integrity: sha512-bmoCYyWdEL3wDQIVbcyzRyeKLgk2WtWLTWz1ZIAZF/EGbNOwSA6ew3PftJ1PqMiOOGu0OyFMzG53L0zqIpPeNA==} @@ -3697,8 +3697,8 @@ packages: resolution: {integrity: sha512-bV0Tgo9K4hfPCek+aMAn81RppFKv2ySDQeMoSZuvTASywNTnVJCArCZE2FWqpvIatKu7VMRLWlR1EazvVhDyhQ==} engines: {node: '>=18.18'} - '@iconify-json/simple-icons@1.2.49': - resolution: {integrity: sha512-nRLwrHzz+cTAQYBNQrcr4eWOmQIcHObTj/QSi7nj0SFwVh5MvBsgx8OhoDC/R8iGklNmMpmoE/NKU0cPXMlOZw==} + '@iconify-json/simple-icons@1.2.50': + resolution: {integrity: sha512-Z2ggRwKYEBB9eYAEi4NqEgIzyLhu0Buh4+KGzMPD6+xG7mk52wZJwLT/glDPtfslV503VtJbqzWqBUGkCMKOFA==} '@iconify/types@2.0.0': resolution: {integrity: sha512-+wluvCrRhXrhyOmRDJ3q8mux9JkKy5SJ/v8ol2tu4FVjyYvtEzkc/3pK15ET6RKg4b4w4BmTk1+gsCUhf21Ykg==} @@ -3951,8 +3951,8 @@ packages: '@types/node': optional: true - '@ioredis/commands@1.3.0': - resolution: {integrity: sha512-M/T6Zewn7sDaBQEqIZ8Rb+i9y8qfGmq+5SDFSf9sA2lUZTmdDLVdOiQaeDp+Q4wElZ9HG1GAX5KhDaidp6LQsQ==} + '@ioredis/commands@1.3.1': + resolution: {integrity: sha512-bYtU8avhGIcje3IhvF9aSjsa5URMZBHnwKtOvXsT4sfYy9gppW11gLPT/9oNqlJZD47yPKveQFTAFWpHjKvUoQ==} '@isaacs/balanced-match@4.0.1': resolution: {integrity: sha512-yzMTt9lEb8Gv7zRioUilSglI0c0smZ9k5D65677DLWLtWJaXIS3CqcGyUFByYKlnUj6TkjLVs54fBl6+TiGQDQ==} @@ -4383,8 +4383,8 @@ packages: resolution: {integrity: sha512-rCNLSB/JzNvot0SEyXqWZ7tX2B5dD2a1br2Dp0vSYVo5jh8Z0EZ7lS9TsZ1UtziddB1UfNUaMCc538/HztnJGA==} engines: {node: ^18.17.0 || >=20.5.0} - '@npmcli/promise-spawn@8.0.2': - resolution: {integrity: sha512-/bNJhjc+o6qL+Dwz/bqfTQClkEO5nTQ1ZEcdCkAQjhkZMHIh22LPG7fNh1enJP1NKWDqYiiABnjFCY7E0zHYtQ==} + '@npmcli/promise-spawn@8.0.3': + resolution: {integrity: sha512-Yb00SWaL4F8w+K8YGhQ55+xE4RUNdMHV43WZGsiTM92gS+lC0mGsn7I4hLug7pbao035S6bj3Y3w0cUNGLfmkg==} engines: {node: ^18.17.0 || >=20.5.0} '@npmcli/redact@3.2.2': @@ -5384,8 +5384,8 @@ packages: cpu: [arm] os: [android] - '@rollup/rollup-android-arm-eabi@4.49.0': - resolution: {integrity: sha512-rlKIeL854Ed0e09QGYFlmDNbka6I3EQFw7iZuugQjMb11KMpJCLPFL4ZPbMfaEhLADEL1yx0oujGkBQ7+qW3eA==} + '@rollup/rollup-android-arm-eabi@4.50.0': + resolution: {integrity: sha512-lVgpeQyy4fWN5QYebtW4buT/4kn4p4IJ+kDNB4uYNT5b8c8DLJDg6titg20NIg7E8RWwdWZORW6vUFfrLyG3KQ==} cpu: [arm] os: [android] @@ -5399,8 +5399,8 @@ packages: cpu: [arm64] os: [android] - '@rollup/rollup-android-arm64@4.49.0': - resolution: {integrity: sha512-cqPpZdKUSQYRtLLr6R4X3sD4jCBO1zUmeo3qrWBCqYIeH8Q3KRL4F3V7XJ2Rm8/RJOQBZuqzQGWPjjvFUcYa/w==} + '@rollup/rollup-android-arm64@4.50.0': + resolution: {integrity: sha512-2O73dR4Dc9bp+wSYhviP6sDziurB5/HCym7xILKifWdE9UsOe2FtNcM+I4xZjKrfLJnq5UR8k9riB87gauiQtw==} cpu: [arm64] os: [android] @@ -5414,8 +5414,8 @@ packages: cpu: [arm64] os: [darwin] - '@rollup/rollup-darwin-arm64@4.49.0': - resolution: {integrity: sha512-99kMMSMQT7got6iYX3yyIiJfFndpojBmkHfTc1rIje8VbjhmqBXE+nb7ZZP3A5skLyujvT0eIUCUsxAe6NjWbw==} + '@rollup/rollup-darwin-arm64@4.50.0': + resolution: {integrity: sha512-vwSXQN8T4sKf1RHr1F0s98Pf8UPz7pS6P3LG9NSmuw0TVh7EmaE+5Ny7hJOZ0M2yuTctEsHHRTMi2wuHkdS6Hg==} cpu: [arm64] os: [darwin] @@ -5429,8 +5429,8 @@ packages: cpu: [x64] os: [darwin] - '@rollup/rollup-darwin-x64@4.49.0': - resolution: {integrity: sha512-y8cXoD3wdWUDpjOLMKLx6l+NFz3NlkWKcBCBfttUn+VGSfgsQ5o/yDUGtzE9HvsodkP0+16N0P4Ty1VuhtRUGg==} + '@rollup/rollup-darwin-x64@4.50.0': + resolution: {integrity: sha512-cQp/WG8HE7BCGyFVuzUg0FNmupxC+EPZEwWu2FCGGw5WDT1o2/YlENbm5e9SMvfDFR6FRhVCBePLqj0o8MN7Vw==} cpu: [x64] os: [darwin] @@ -5444,8 +5444,8 @@ packages: cpu: [arm64] os: [freebsd] - '@rollup/rollup-freebsd-arm64@4.49.0': - resolution: {integrity: sha512-3mY5Pr7qv4GS4ZvWoSP8zha8YoiqrU+e0ViPvB549jvliBbdNLrg2ywPGkgLC3cmvN8ya3za+Q2xVyT6z+vZqA==} + '@rollup/rollup-freebsd-arm64@4.50.0': + resolution: {integrity: sha512-UR1uTJFU/p801DvvBbtDD7z9mQL8J80xB0bR7DqW7UGQHRm/OaKzp4is7sQSdbt2pjjSS72eAtRh43hNduTnnQ==} cpu: [arm64] os: [freebsd] @@ -5459,8 +5459,8 @@ packages: cpu: [x64] os: [freebsd] - '@rollup/rollup-freebsd-x64@4.49.0': - resolution: {integrity: sha512-C9KzzOAQU5gU4kG8DTk+tjdKjpWhVWd5uVkinCwwFub2m7cDYLOdtXoMrExfeBmeRy9kBQMkiyJ+HULyF1yj9w==} + '@rollup/rollup-freebsd-x64@4.50.0': + resolution: {integrity: sha512-G/DKyS6PK0dD0+VEzH/6n/hWDNPDZSMBmqsElWnCRGrYOb2jC0VSupp7UAHHQ4+QILwkxSMaYIbQ72dktp8pKA==} cpu: [x64] os: [freebsd] @@ -5474,8 +5474,8 @@ packages: cpu: [arm] os: [linux] - '@rollup/rollup-linux-arm-gnueabihf@4.49.0': - resolution: {integrity: sha512-OVSQgEZDVLnTbMq5NBs6xkmz3AADByCWI4RdKSFNlDsYXdFtlxS59J+w+LippJe8KcmeSSM3ba+GlsM9+WwC1w==} + '@rollup/rollup-linux-arm-gnueabihf@4.50.0': + resolution: {integrity: sha512-u72Mzc6jyJwKjJbZZcIYmd9bumJu7KNmHYdue43vT1rXPm2rITwmPWF0mmPzLm9/vJWxIRbao/jrQmxTO0Sm9w==} cpu: [arm] os: [linux] @@ -5489,8 +5489,8 @@ packages: cpu: [arm] os: [linux] - '@rollup/rollup-linux-arm-musleabihf@4.49.0': - resolution: {integrity: sha512-ZnfSFA7fDUHNa4P3VwAcfaBLakCbYaxCk0jUnS3dTou9P95kwoOLAMlT3WmEJDBCSrOEFFV0Y1HXiwfLYJuLlA==} + '@rollup/rollup-linux-arm-musleabihf@4.50.0': + resolution: {integrity: sha512-S4UefYdV0tnynDJV1mdkNawp0E5Qm2MtSs330IyHgaccOFrwqsvgigUD29uT+B/70PDY1eQ3t40+xf6wIvXJyg==} cpu: [arm] os: [linux] @@ -5504,8 +5504,8 @@ packages: cpu: [arm64] os: [linux] - '@rollup/rollup-linux-arm64-gnu@4.49.0': - resolution: {integrity: sha512-Z81u+gfrobVK2iV7GqZCBfEB1y6+I61AH466lNK+xy1jfqFLiQ9Qv716WUM5fxFrYxwC7ziVdZRU9qvGHkYIJg==} + '@rollup/rollup-linux-arm64-gnu@4.50.0': + resolution: {integrity: sha512-1EhkSvUQXJsIhk4msxP5nNAUWoB4MFDHhtc4gAYvnqoHlaL9V3F37pNHabndawsfy/Tp7BPiy/aSa6XBYbaD1g==} cpu: [arm64] os: [linux] @@ -5519,8 +5519,8 @@ packages: cpu: [arm64] os: [linux] - '@rollup/rollup-linux-arm64-musl@4.49.0': - resolution: {integrity: sha512-zoAwS0KCXSnTp9NH/h9aamBAIve0DXeYpll85shf9NJ0URjSTzzS+Z9evmolN+ICfD3v8skKUPyk2PO0uGdFqg==} + '@rollup/rollup-linux-arm64-musl@4.50.0': + resolution: {integrity: sha512-EtBDIZuDtVg75xIPIK1l5vCXNNCIRM0OBPUG+tbApDuJAy9mKago6QxX+tfMzbCI6tXEhMuZuN1+CU8iDW+0UQ==} cpu: [arm64] os: [linux] @@ -5534,8 +5534,8 @@ packages: cpu: [loong64] os: [linux] - '@rollup/rollup-linux-loongarch64-gnu@4.49.0': - resolution: {integrity: sha512-2QyUyQQ1ZtwZGiq0nvODL+vLJBtciItC3/5cYN8ncDQcv5avrt2MbKt1XU/vFAJlLta5KujqyHdYtdag4YEjYQ==} + '@rollup/rollup-linux-loongarch64-gnu@4.50.0': + resolution: {integrity: sha512-BGYSwJdMP0hT5CCmljuSNx7+k+0upweM2M4YGfFBjnFSZMHOLYR0gEEj/dxyYJ6Zc6AiSeaBY8dWOa11GF/ppQ==} cpu: [loong64] os: [linux] @@ -5549,8 +5549,8 @@ packages: cpu: [ppc64] os: [linux] - '@rollup/rollup-linux-ppc64-gnu@4.49.0': - resolution: {integrity: sha512-k9aEmOWt+mrMuD3skjVJSSxHckJp+SiFzFG+v8JLXbc/xi9hv2icSkR3U7uQzqy+/QbbYY7iNB9eDTwrELo14g==} + '@rollup/rollup-linux-ppc64-gnu@4.50.0': + resolution: {integrity: sha512-I1gSMzkVe1KzAxKAroCJL30hA4DqSi+wGc5gviD0y3IL/VkvcnAqwBf4RHXHyvH66YVHxpKO8ojrgc4SrWAnLg==} cpu: [ppc64] os: [linux] @@ -5564,13 +5564,13 @@ packages: cpu: [riscv64] os: [linux] - '@rollup/rollup-linux-riscv64-gnu@4.49.0': - resolution: {integrity: sha512-rDKRFFIWJ/zJn6uk2IdYLc09Z7zkE5IFIOWqpuU0o6ZpHcdniAyWkwSUWE/Z25N/wNDmFHHMzin84qW7Wzkjsw==} + '@rollup/rollup-linux-riscv64-gnu@4.50.0': + resolution: {integrity: sha512-bSbWlY3jZo7molh4tc5dKfeSxkqnf48UsLqYbUhnkdnfgZjgufLS/NTA8PcP/dnvct5CCdNkABJ56CbclMRYCA==} cpu: [riscv64] os: [linux] - '@rollup/rollup-linux-riscv64-musl@4.49.0': - resolution: {integrity: sha512-FkkhIY/hYFVnOzz1WeV3S9Bd1h0hda/gRqvZCMpHWDHdiIHn6pqsY3b5eSbvGccWHMQ1uUzgZTKS4oGpykf8Tw==} + '@rollup/rollup-linux-riscv64-musl@4.50.0': + resolution: {integrity: sha512-LSXSGumSURzEQLT2e4sFqFOv3LWZsEF8FK7AAv9zHZNDdMnUPYH3t8ZlaeYYZyTXnsob3htwTKeWtBIkPV27iQ==} cpu: [riscv64] os: [linux] @@ -5584,8 +5584,8 @@ packages: cpu: [s390x] os: [linux] - '@rollup/rollup-linux-s390x-gnu@4.49.0': - resolution: {integrity: sha512-gRf5c+A7QiOG3UwLyOOtyJMD31JJhMjBvpfhAitPAoqZFcOeK3Kc1Veg1z/trmt+2P6F/biT02fU19GGTS529A==} + '@rollup/rollup-linux-s390x-gnu@4.50.0': + resolution: {integrity: sha512-CxRKyakfDrsLXiCyucVfVWVoaPA4oFSpPpDwlMcDFQvrv3XY6KEzMtMZrA+e/goC8xxp2WSOxHQubP8fPmmjOQ==} cpu: [s390x] os: [linux] @@ -5604,8 +5604,8 @@ packages: cpu: [x64] os: [linux] - '@rollup/rollup-linux-x64-gnu@4.49.0': - resolution: {integrity: sha512-BR7+blScdLW1h/2hB/2oXM+dhTmpW3rQt1DeSiCP9mc2NMMkqVgjIN3DDsNpKmezffGC9R8XKVOLmBkRUcK/sA==} + '@rollup/rollup-linux-x64-gnu@4.50.0': + resolution: {integrity: sha512-8PrJJA7/VU8ToHVEPu14FzuSAqVKyo5gg/J8xUerMbyNkWkO9j2ExBho/68RnJsMGNJq4zH114iAttgm7BZVkA==} cpu: [x64] os: [linux] @@ -5619,11 +5619,16 @@ packages: cpu: [x64] os: [linux] - '@rollup/rollup-linux-x64-musl@4.49.0': - resolution: {integrity: sha512-hDMOAe+6nX3V5ei1I7Au3wcr9h3ktKzDvF2ne5ovX8RZiAHEtX1A5SNNk4zt1Qt77CmnbqT+upb/umzoPMWiPg==} + '@rollup/rollup-linux-x64-musl@4.50.0': + resolution: {integrity: sha512-SkE6YQp+CzpyOrbw7Oc4MgXFvTw2UIBElvAvLCo230pyxOLmYwRPwZ/L5lBe/VW/qT1ZgND9wJfOsdy0XptRvw==} cpu: [x64] os: [linux] + '@rollup/rollup-openharmony-arm64@4.50.0': + resolution: {integrity: sha512-PZkNLPfvXeIOgJWA804zjSFH7fARBBCpCXxgkGDRjjAhRLOR8o0IGS01ykh5GYfod4c2yiiREuDM8iZ+pVsT+Q==} + cpu: [arm64] + os: [openharmony] + '@rollup/rollup-win32-arm64-msvc@4.31.0': resolution: {integrity: sha512-JuhN2xdI/m8Hr+aVO3vspO7OQfUFO6bKLIRTAy0U15vmWjnZDLrEgCZ2s6+scAYaQVpYSh9tZtRijApw9IXyMw==} cpu: [arm64] @@ -5634,8 +5639,8 @@ packages: cpu: [arm64] os: [win32] - '@rollup/rollup-win32-arm64-msvc@4.49.0': - resolution: {integrity: sha512-wkNRzfiIGaElC9kXUT+HLx17z7D0jl+9tGYRKwd8r7cUqTL7GYAvgUY++U2hK6Ar7z5Z6IRRoWC8kQxpmM7TDA==} + '@rollup/rollup-win32-arm64-msvc@4.50.0': + resolution: {integrity: sha512-q7cIIdFvWQoaCbLDUyUc8YfR3Jh2xx3unO8Dn6/TTogKjfwrax9SyfmGGK6cQhKtjePI7jRfd7iRYcxYs93esg==} cpu: [arm64] os: [win32] @@ -5649,8 +5654,8 @@ packages: cpu: [ia32] os: [win32] - '@rollup/rollup-win32-ia32-msvc@4.49.0': - resolution: {integrity: sha512-gq5aW/SyNpjp71AAzroH37DtINDcX1Qw2iv9Chyz49ZgdOP3NV8QCyKZUrGsYX9Yyggj5soFiRCgsL3HwD8TdA==} + '@rollup/rollup-win32-ia32-msvc@4.50.0': + resolution: {integrity: sha512-XzNOVg/YnDOmFdDKcxxK410PrcbcqZkBmz+0FicpW5jtjKQxcW1BZJEQOF0NJa6JO7CZhett8GEtRN/wYLYJuw==} cpu: [ia32] os: [win32] @@ -5664,8 +5669,8 @@ packages: cpu: [x64] os: [win32] - '@rollup/rollup-win32-x64-msvc@4.49.0': - resolution: {integrity: sha512-gEtqFbzmZLFk2xKh7g0Rlo8xzho8KrEFEkzvHbfUGkrgXOpZ4XagQ6n+wIZFNh1nTb8UD16J4nFSFKXYgnbdBg==} + '@rollup/rollup-win32-x64-msvc@4.50.0': + resolution: {integrity: sha512-xMmiWRR8sp72Zqwjgtf3QbZfF1wdh8X2ABu3EaozvZcyHJeU0r+XAnXdKgs4cCAp6ORoYoCygipYP1mjmbjrsg==} cpu: [x64] os: [win32] @@ -5690,26 +5695,26 @@ packages: resolution: {integrity: sha512-OEd7RYlSwmq4zpaHPOnf+yyzWN6aON4RrA+Dd3PGo5JPBY8G5peofQpJZDwxdJJKPOvqU0C7aZ8LeL2CE2XTdA==} hasBin: true - '@shikijs/core@3.12.0': - resolution: {integrity: sha512-rPfCBd6gHIKBPpf2hKKWn2ISPSrmRKAFi+bYDjvZHpzs3zlksWvEwaF3Z4jnvW+xHxSRef7qDooIJkY0RpA9EA==} + '@shikijs/core@3.12.1': + resolution: {integrity: sha512-j9+UDQ6M50xvaSR/e9lg212H0Fqxy3lYd39Q6YITYQxfrb5VYNUKPLZp4PN9f+YmRcdpyNAm3obn/tIZ2WkUWg==} - '@shikijs/engine-javascript@3.12.0': - resolution: {integrity: sha512-Ni3nm4lnKxyKaDoXQQJYEayX052BL7D0ikU5laHp+ynxPpIF1WIwyhzrMU6WDN7AoAfggVR4Xqx3WN+JTS+BvA==} + '@shikijs/engine-javascript@3.12.1': + resolution: {integrity: sha512-mwif5T3rEBSMn/1m9dNi4WmB4dxH4VfYqreQMLpbFYov8MM3Gus98I549amFMjtEmYDAkTKGP7bmsv1n9t9I+A==} - '@shikijs/engine-oniguruma@3.12.0': - resolution: {integrity: sha512-IfDl3oXPbJ/Jr2K8mLeQVpnF+FxjAc7ZPDkgr38uEw/Bg3u638neSrpwqOTnTHXt1aU0Fk1/J+/RBdst1kVqLg==} + '@shikijs/engine-oniguruma@3.12.1': + resolution: {integrity: sha512-hbYq+XOc55CU7Irkhsgwh8WgQbx2W5IVzHV4l+wZ874olMLSNg5o3F73vo9m4SAhimFyqq/86xnx9h+T30HhhQ==} - '@shikijs/langs@3.12.0': - resolution: {integrity: sha512-HIca0daEySJ8zuy9bdrtcBPhcYBo8wR1dyHk1vKrOuwDsITtZuQeGhEkcEfWc6IDyTcom7LRFCH6P7ljGSCEiQ==} + '@shikijs/langs@3.12.1': + resolution: {integrity: sha512-Y1MbMfVO5baRz7Boo7EoD36TmzfUx/I5n8e+wZumx6SlUA81Zj1ZwNJL871iIuSHrdsheV4AxJtHQ9mlooklmg==} - '@shikijs/themes@3.12.0': - resolution: {integrity: sha512-/lxvQxSI5s4qZLV/AuFaA4Wt61t/0Oka/P9Lmpr1UV+HydNCczO3DMHOC/CsXCCpbv4Zq8sMD0cDa7mvaVoj0Q==} + '@shikijs/themes@3.12.1': + resolution: {integrity: sha512-9JrAm9cA5hqM/YXymA3oAAZdnCgQf1zyrNDtsnM105nNEoEpux4dyzdoOjc2KawEKj1iUs/WH2ota6Atp7GYkQ==} - '@shikijs/transformers@3.12.0': - resolution: {integrity: sha512-HcJwlvMAyZzOY+ayEAGE891BdJ7Vtio+qdWUTF9ki4d0LIkDb6DBz8ynOWGAEglHv6eQs/WcAWf/h6ina6IgCw==} + '@shikijs/transformers@3.12.1': + resolution: {integrity: sha512-crGh3cSZf6mwg3K2W8i79Ja+q4tVClRHdHLnUGi5arS58+cqdzsbkrEZBDMyevf9ehmjFUWDTEwCMEyp9I3z0g==} - '@shikijs/types@3.12.0': - resolution: {integrity: sha512-jsFzm8hCeTINC3OCmTZdhR9DOl/foJWplH2Px0bTi4m8z59fnsueLsweX82oGcjRQ7mfQAluQYKGoH2VzsWY4A==} + '@shikijs/types@3.12.1': + resolution: {integrity: sha512-Is/p+1vTss22LIsGCJTmGrxu7ZC1iBL9doJFYLaZ4aI8d0VDXb7Mn0kBzhkc7pdsRpmUbQLQ5HXwNpa3H6F8og==} '@shikijs/vscode-textmate@10.0.2': resolution: {integrity: sha512-83yeghZ2xxin3Nj8z1NMd/NCuca+gsYXswywDy5bHvwlWL8tpTQmzGeUuHd9FC3E/SBEMvzJRwWEOz5gGes9Qg==} @@ -6542,13 +6547,13 @@ packages: vue: optional: true - '@vueuse/core@13.8.0': - resolution: {integrity: sha512-rmBcgpEpxY0ZmyQQR94q1qkUcHREiLxQwNyWrtjMDipD0WTH/JBcAt0gdcn2PsH0SA76ec291cHFngmyaBhlxA==} + '@vueuse/core@13.9.0': + resolution: {integrity: sha512-ts3regBQyURfCE2BcytLqzm8+MmLlo5Ln/KLoxDVcsZ2gzIwVNnQpQOL/UKV8alUqjSZOlpFZcRNsLRqj+OzyA==} peerDependencies: vue: ^3.5.0 - '@vueuse/integrations@13.8.0': - resolution: {integrity: sha512-64mD5Q7heVkr8JsqBFDh9xnQJrPLmWJghy8Qtj9UeLosQL9n+JYTcS7d+eNsEVwuvZvxfF7hUSi87jABm/eYpw==} + '@vueuse/integrations@13.9.0': + resolution: {integrity: sha512-SDobKBbPIOe0cVL7QxMzGkuUGHvWTdihi9zOrrWaWUgFKe15cwEcwfWmgrcNzjT6kHnNmWuTajPHoIzUjYNYYQ==} peerDependencies: async-validator: ^4 axios: ^1 @@ -6589,11 +6594,11 @@ packages: universal-cookie: optional: true - '@vueuse/metadata@13.8.0': - resolution: {integrity: sha512-BYMp3Gp1kBUPv7AfQnJYP96mkX7g7cKdTIgwv/Jgd+pfQhz678naoZOAcknRtPLP4cFblDDW7rF4e3KFa+PfIA==} + '@vueuse/metadata@13.9.0': + resolution: {integrity: sha512-1AFRvuiGphfF7yWixZa0KwjYH8ulyjDCC0aFgrGRz8+P4kvDFSdXLVfTk5xAN9wEuD1J6z4/myMoYbnHoX07zg==} - '@vueuse/shared@13.8.0': - resolution: {integrity: sha512-x4nfM0ykW+RmNJ4/1IzZsuLuWWrNTxlTWUiehTGI54wnOxIgI9EDdu/O5S77ac6hvQ3hk2KpOVFHaM0M796Kbw==} + '@vueuse/shared@13.9.0': + resolution: {integrity: sha512-e89uuTLMh0U5cZ9iDpEI2senqPGfbPRTHM/0AaQkcxnpqjkZqDYP8rpfm7edOz8s+pOCOROEy1PIveSW8+fL5g==} peerDependencies: vue: ^3.5.0 @@ -7045,8 +7050,8 @@ packages: resolution: {integrity: sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==} engines: {node: '>=8'} - browserslist@4.25.3: - resolution: {integrity: sha512-cDGv1kkDI4/0e5yON9yM5G/0A5u8sf5TnmdX5C9qHzI9PPu++sQ9zjm1k9NiOrf3riY4OkK0zSGqfvJyJsgCBQ==} + browserslist@4.25.4: + resolution: {integrity: sha512-4jYpcjabC606xJ3kw2QwGEZKX0Aw7sgQdZCvIK9dhVSPh76BKo+C+btT1RRofH7B+8iNpEbgGNVWiLki5q93yg==} engines: {node: ^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7} hasBin: true @@ -7152,8 +7157,8 @@ packages: caniuse-api@3.0.0: resolution: {integrity: sha512-bsTwuIg/BZZK/vreVTYYbSWoe2F+71P7K5QGEX+pT250DZbfU1MQ5prOKpPR+LL6uWKK3KMwMCAS74QB3Um1uw==} - caniuse-lite@1.0.30001737: - resolution: {integrity: sha512-BiloLiXtQNrY5UyF0+1nSJLXUENuhka2pzy2Fx5pGxqavdrxSCW4U6Pn/PoG3Efspi2frRbHpBV2XsrPE6EDlw==} + caniuse-lite@1.0.30001739: + resolution: {integrity: sha512-y+j60d6ulelrNSwpPyrHdl+9mJnQzHBr08xm48Qno0nSk4h3Qojh+ziv2qE6rXf4k3tadF4o1J/1tAbVm1NtnA==} ccount@2.0.1: resolution: {integrity: sha512-eyrF0jiFpY+3drT6383f1qhkbGsLSifNAjA61IUjZjmLCWjItY6LB9ft9YhoDgwfmclB2zhu51Lc7+95b8NRAg==} @@ -7665,15 +7670,6 @@ packages: supports-color: optional: true - debug@4.3.4: - resolution: {integrity: sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==} - engines: {node: '>=6.0'} - peerDependencies: - supports-color: '*' - peerDependenciesMeta: - supports-color: - optional: true - debug@4.3.7: resolution: {integrity: sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ==} engines: {node: '>=6.0'} @@ -8404,8 +8400,8 @@ packages: engines: {node: '>= 10.17.0'} hasBin: true - fake-indexeddb@6.2.0: - resolution: {integrity: sha512-0DiWlcOgogaZktJ0ussOET5wNFZctM3oiJRvL5BcaZkukeg5s0nvvFbQrguOZtctrrH/kwqF3Gu9tQWTmsfpfg==} + fake-indexeddb@6.2.2: + resolution: {integrity: sha512-SGbf7fzjeHz3+12NO1dYigcYn4ivviaeULV5yY5rdGihBvvgwMds4r4UBbNIUMwkze57KTDm32rq3j1Az8mzEw==} engines: {node: '>=18'} fast-decode-uri-component@1.0.1: @@ -8659,8 +8655,8 @@ packages: resolution: {integrity: sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==} engines: {node: 6.* || 8.* || >= 10.*} - get-east-asian-width@1.3.0: - resolution: {integrity: sha512-vpeMIQKxczTD/0s2CdEWHcb0eeJe6TFjxb+J5xgX7hScxqrGuyjmv4c1D4A/gelKfyox0gJJwIHF+fLjeaM8kQ==} + get-east-asian-width@1.3.1: + resolution: {integrity: sha512-R1QfovbPsKmosqTnPoRFiJ7CF9MLRgb53ChvMZm+r4p76/+8yKDy17qLL2PKInORy2RkZZekuK0efYgmzTkXyQ==} engines: {node: '>=18'} get-intrinsic@1.3.0: @@ -9014,8 +9010,8 @@ packages: resolution: {integrity: sha512-TR3KfrTZTYLPB6jUjfx6MF9WcWrHL9su5TObK4ZkYgBdWKPOFoSoQIdEuTuR82pmtxH2spWG9h6etwfr1pLBqQ==} engines: {node: '>=6'} - import-meta-resolve@4.1.0: - resolution: {integrity: sha512-I6fiaX09Xivtk+THaMfAwnA3MVA5Big1WHF1Dfx9hFuvNIWpXnorlkzhcQf6ehrqQiiZECRt1poOAkPmer3ruw==} + import-meta-resolve@4.2.0: + resolution: {integrity: sha512-Iqv2fzaTQN28s/FwZAoFq0ZSs/7hMAHJVX+w8PZl3cY19Pxk6jFFalxQoIfW2826i/fDLXv8IiEZRIT0lDuWcg==} impound@0.2.2: resolution: {integrity: sha512-9CNg+Ly8QjH4FwCUoE9nl1zeqY1NPK1s1P6Btp4L8lJxn8oZLN/0p6RZhitnyEL0BnVWrcVPfbs0Q3x+O/ucHg==} @@ -9151,8 +9147,8 @@ packages: resolution: {integrity: sha512-O4L094N2/dZ7xqVdrXhh9r1KODPJpFms8B5sGdJLPy664AgvXsreZUyCQQNItZRDlYug4xStLjNp/sz3HvBowQ==} engines: {node: '>=12'} - is-fullwidth-code-point@5.0.0: - resolution: {integrity: sha512-OVa3u9kkBbw7b8Xw5F9P+D/T9X+Z4+JruYVNapTjPYZYUznQ5YfWeFkOj606XYYW8yugTfC8Pj0hYqvi4ryAhA==} + is-fullwidth-code-point@5.1.0: + resolution: {integrity: sha512-5XHYaSyiqADb4RnZ1Bdad6cPp8Toise4TzEjcOYDHZkTCbKgiUl7WTUCpNWHuxmDt91wnsZBc9xinNzopv3JMQ==} engines: {node: '>=18'} is-generator-function@1.1.0: @@ -10128,9 +10124,6 @@ packages: ms@2.0.0: resolution: {integrity: sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==} - ms@2.1.2: - resolution: {integrity: sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==} - ms@2.1.3: resolution: {integrity: sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==} @@ -11549,8 +11542,8 @@ packages: engines: {node: '>=18.0.0', npm: '>=8.0.0'} hasBin: true - rollup@4.49.0: - resolution: {integrity: sha512-3IVq0cGJ6H7fKXXEdVt+RcYvRCt8beYY9K1760wGQwSAHZcS9eot1zDG5axUbcp/kWRi5zKIIDX8MoKv/TzvZA==} + rollup@4.50.0: + resolution: {integrity: sha512-/Zl4D8zPifNmyGzJS+3kVoyXeDeT/GrsJM94sACNg9RtUE0hrHa1bNPtRSrfHTMH5HjRzce6K7rlTh3Khiw+pw==} engines: {node: '>=18.0.0', npm: '>=8.0.0'} hasBin: true @@ -11762,8 +11755,8 @@ packages: resolution: {integrity: sha512-ObmnIF4hXNg1BqhnHmgbDETF8dLPCggZWBjkQfhZpbszZnYur5DUljTcCHii5LC3J5E0yeO/1LIMyH+UvHQgyw==} engines: {node: '>= 0.4'} - shiki@3.12.0: - resolution: {integrity: sha512-E+ke51tciraTHpaXYXfqnPZFSViKHhSQ3fiugThlfs/om/EonlQ0hSldcqgzOWWqX6PcjkKKzFgrjIaiPAXoaA==} + shiki@3.12.1: + resolution: {integrity: sha512-eMlxVaXyuNQAQCaMtDKQjKv0eVm+kA6fsZtv9UqKgspP+7lWCVi7SoN+cJq1dawvIDQY7TI3SixamztotM6R6Q==} side-channel-list@1.0.0: resolution: {integrity: sha512-FCLHtRD/gnpCiCHEiJLOwdmFP+wzCmDEkc9y7NsYxeF4u7Btsn1ZuwgwJGxImImHicJArLP4R0yX4c2KCrMrTA==} @@ -12664,8 +12657,8 @@ packages: resolution: {integrity: sha512-2qzQo5LN2DmUZXkWDHvGKLF5BP0WN+KthD6aPnPJ8plRBIjv4lh5O07eYcSxgO2znNw9s4MNhEO1sB+JDllDbQ==} engines: {node: '>=18.12.0'} - unplugin@2.3.9: - resolution: {integrity: sha512-2dcbZq6aprwXTkzptq3k5qm5B8cvpjG9ynPd5fyM2wDJuuF7PeUK64Sxf0d+X1ZyDOeGydbNzMqBSIVlH8GIfA==} + unplugin@2.3.10: + resolution: {integrity: sha512-6NCPkv1ClwH+/BGE9QeoTIl09nuiAt0gS28nn1PvYXsGKRwM2TCbFA2QiilmehPDTXIe684k4rZI1yl3A1PCUw==} engines: {node: '>=18.12.0'} unrs-resolver@1.11.1: @@ -13680,7 +13673,7 @@ snapshots: ansi-colors: 4.1.3 autoprefixer: 10.4.20(postcss@8.5.2) babel-loader: 9.2.1(@babel/core@7.26.9)(webpack@5.98.0(esbuild@0.25.0)) - browserslist: 4.25.3 + browserslist: 4.25.4 copy-webpack-plugin: 12.0.2(webpack@5.98.0(esbuild@0.25.9)) css-loader: 7.1.2(webpack@5.98.0(esbuild@0.25.9)) esbuild-wasm: 0.25.0 @@ -13768,7 +13761,7 @@ snapshots: ansi-colors: 4.1.3 autoprefixer: 10.4.20(postcss@8.5.2) babel-loader: 9.2.1(@babel/core@7.26.9)(webpack@5.98.0(esbuild@0.25.0)) - browserslist: 4.25.3 + browserslist: 4.25.4 copy-webpack-plugin: 12.0.2(webpack@5.98.0(esbuild@0.25.9)) css-loader: 7.1.2(webpack@5.98.0(esbuild@0.25.9)) esbuild-wasm: 0.25.0 @@ -13856,7 +13849,7 @@ snapshots: ansi-colors: 4.1.3 autoprefixer: 10.4.20(postcss@8.5.2) babel-loader: 9.2.1(@babel/core@7.26.9)(webpack@5.98.0(esbuild@0.25.0)) - browserslist: 4.25.3 + browserslist: 4.25.4 copy-webpack-plugin: 12.0.2(webpack@5.98.0(esbuild@0.25.9)) css-loader: 7.1.2(webpack@5.98.0(esbuild@0.25.9)) esbuild-wasm: 0.25.0 @@ -13944,7 +13937,7 @@ snapshots: ansi-colors: 4.1.3 autoprefixer: 10.4.20(postcss@8.5.2) babel-loader: 9.2.1(@babel/core@7.26.10)(webpack@5.98.0(esbuild@0.25.9)) - browserslist: 4.25.3 + browserslist: 4.25.4 copy-webpack-plugin: 12.0.2(webpack@5.98.0(esbuild@0.25.9)) css-loader: 7.1.2(webpack@5.98.0(esbuild@0.25.9)) esbuild-wasm: 0.25.4 @@ -14105,7 +14098,7 @@ snapshots: '@inquirer/confirm': 5.1.6(@types/node@22.10.5) '@vitejs/plugin-basic-ssl': 1.2.0(vite@6.1.0(@types/node@22.10.5)(jiti@2.5.1)(less@4.2.2)(sass@1.85.0)(terser@5.39.0)(yaml@2.8.0)) beasties: 0.2.0 - browserslist: 4.25.3 + browserslist: 4.25.4 esbuild: 0.25.0 fast-glob: 3.3.3 https-proxy-agent: 7.0.6 @@ -14157,7 +14150,7 @@ snapshots: '@inquirer/confirm': 5.1.6(@types/node@22.10.5) '@vitejs/plugin-basic-ssl': 1.2.0(vite@6.1.0(@types/node@22.10.5)(jiti@2.5.1)(less@4.2.2)(sass@1.85.0)(terser@5.39.0)(yaml@2.8.0)) beasties: 0.2.0 - browserslist: 4.25.3 + browserslist: 4.25.4 esbuild: 0.25.0 fast-glob: 3.3.3 https-proxy-agent: 7.0.6 @@ -14209,7 +14202,7 @@ snapshots: '@inquirer/confirm': 5.1.6(@types/node@22.10.5) '@vitejs/plugin-basic-ssl': 1.2.0(vite@6.2.7(@types/node@22.10.5)(jiti@2.5.1)(less@4.2.2)(sass@1.85.0)(terser@5.39.0)(yaml@2.8.0)) beasties: 0.3.2 - browserslist: 4.25.3 + browserslist: 4.25.4 esbuild: 0.25.4 fast-glob: 3.3.3 https-proxy-agent: 7.0.6 @@ -14749,7 +14742,7 @@ snapshots: dependencies: '@babel/compat-data': 7.28.0 '@babel/helper-validator-option': 7.27.1 - browserslist: 4.25.3 + browserslist: 4.25.4 lru-cache: 5.1.1 semver: 6.3.1 @@ -16193,18 +16186,18 @@ snapshots: '@docsearch/js@4.0.0-beta.8': {} - '@emnapi/core@1.4.5': + '@emnapi/core@1.5.0': dependencies: - '@emnapi/wasi-threads': 1.0.4 + '@emnapi/wasi-threads': 1.1.0 tslib: 2.8.1 optional: true - '@emnapi/runtime@1.4.5': + '@emnapi/runtime@1.5.0': dependencies: tslib: 2.8.1 optional: true - '@emnapi/wasi-threads@1.0.4': + '@emnapi/wasi-threads@1.1.0': dependencies: tslib: 2.8.1 optional: true @@ -16830,7 +16823,7 @@ snapshots: '@humanwhocodes/retry@0.4.3': {} - '@iconify-json/simple-icons@1.2.49': + '@iconify-json/simple-icons@1.2.50': dependencies: '@iconify/types': 2.0.0 @@ -16902,7 +16895,7 @@ snapshots: '@img/sharp-wasm32@0.33.5': dependencies: - '@emnapi/runtime': 1.4.5 + '@emnapi/runtime': 1.5.0 optional: true '@img/sharp-win32-ia32@0.33.5': @@ -17045,7 +17038,7 @@ snapshots: optionalDependencies: '@types/node': 22.10.5 - '@ioredis/commands@1.3.0': {} + '@ioredis/commands@1.3.1': {} '@isaacs/balanced-match@4.0.1': {} @@ -17292,8 +17285,8 @@ snapshots: '@napi-rs/wasm-runtime@0.2.12': dependencies: - '@emnapi/core': 1.4.5 - '@emnapi/runtime': 1.4.5 + '@emnapi/core': 1.5.0 + '@emnapi/runtime': 1.5.0 '@tybys/wasm-util': 0.10.0 optional: true @@ -17320,12 +17313,12 @@ snapshots: uuid: 11.1.0 write-file-atomic: 6.0.0 - '@netlify/functions@3.1.10(encoding@0.1.13)(rollup@4.49.0)': + '@netlify/functions@3.1.10(encoding@0.1.13)(rollup@4.50.0)': dependencies: '@netlify/blobs': 9.1.2 '@netlify/dev-utils': 2.2.0 '@netlify/serverless-functions-api': 1.41.2 - '@netlify/zip-it-and-ship-it': 12.2.1(encoding@0.1.13)(rollup@4.49.0) + '@netlify/zip-it-and-ship-it': 12.2.1(encoding@0.1.13)(rollup@4.50.0) cron-parser: 4.9.0 decache: 4.6.2 extract-zip: 2.0.1 @@ -17347,13 +17340,13 @@ snapshots: '@netlify/serverless-functions-api@2.3.0': {} - '@netlify/zip-it-and-ship-it@12.2.1(encoding@0.1.13)(rollup@4.49.0)': + '@netlify/zip-it-and-ship-it@12.2.1(encoding@0.1.13)(rollup@4.50.0)': dependencies: '@babel/parser': 7.28.3 '@babel/types': 7.28.0 '@netlify/binary-info': 1.0.0 '@netlify/serverless-functions-api': 2.3.0 - '@vercel/nft': 0.29.4(encoding@0.1.13)(rollup@4.49.0) + '@vercel/nft': 0.29.4(encoding@0.1.13)(rollup@4.50.0) archiver: 7.0.1 common-path-prefix: 3.0.0 copy-file: 11.1.0 @@ -17465,7 +17458,7 @@ snapshots: '@npmcli/git@6.0.3': dependencies: - '@npmcli/promise-spawn': 8.0.2 + '@npmcli/promise-spawn': 8.0.3 ini: 5.0.0 lru-cache: 10.4.3 npm-pick-manifest: 10.0.0 @@ -17491,7 +17484,7 @@ snapshots: semver: 7.7.2 validate-npm-package-license: 3.0.4 - '@npmcli/promise-spawn@8.0.2': + '@npmcli/promise-spawn@8.0.3': dependencies: which: 5.0.0 @@ -17501,7 +17494,7 @@ snapshots: dependencies: '@npmcli/node-gyp': 4.0.0 '@npmcli/package-json': 6.2.0 - '@npmcli/promise-spawn': 8.0.2 + '@npmcli/promise-spawn': 8.0.3 node-gyp: 11.4.2 proc-log: 5.0.0 which: 5.0.0 @@ -17566,7 +17559,7 @@ snapshots: semver: 7.7.2 simple-git: 3.28.0 sirv: 3.0.1 - tinyglobby: 0.2.14 + tinyglobby: 0.2.10 unimport: 3.14.6(rollup@3.29.5) vite: 7.1.2(@types/node@22.10.5)(jiti@2.5.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.0) vite-plugin-inspect: 0.8.9(@nuxt/kit@3.15.4(magicast@0.3.5))(rollup@3.29.5)(vite@7.1.2(@types/node@22.10.5)(jiti@2.5.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.0)) @@ -17580,7 +17573,7 @@ snapshots: - utf-8-validate - vue - '@nuxt/devtools@1.7.0(rollup@4.49.0)(vite@7.1.2(@types/node@22.10.5)(jiti@2.5.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.0))(vue@3.5.13(typescript@5.8.3))': + '@nuxt/devtools@1.7.0(rollup@4.50.0)(vite@7.1.2(@types/node@22.10.5)(jiti@2.5.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.0))(vue@3.5.13(typescript@5.8.3))': dependencies: '@antfu/utils': 0.7.10 '@nuxt/devtools-kit': 1.7.0(magicast@0.3.5)(vite@7.1.2(@types/node@22.10.5)(jiti@2.5.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.0)) @@ -17613,10 +17606,10 @@ snapshots: semver: 7.7.2 simple-git: 3.28.0 sirv: 3.0.1 - tinyglobby: 0.2.14 - unimport: 3.14.6(rollup@4.49.0) + tinyglobby: 0.2.10 + unimport: 3.14.6(rollup@4.50.0) vite: 7.1.2(@types/node@22.10.5)(jiti@2.5.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.0) - vite-plugin-inspect: 0.8.9(@nuxt/kit@3.15.4(magicast@0.3.5))(rollup@4.49.0)(vite@7.1.2(@types/node@22.10.5)(jiti@2.5.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.0)) + vite-plugin-inspect: 0.8.9(@nuxt/kit@3.15.4(magicast@0.3.5))(rollup@4.50.0)(vite@7.1.2(@types/node@22.10.5)(jiti@2.5.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.0)) vite-plugin-vue-inspector: 5.3.2(vite@7.1.2(@types/node@22.10.5)(jiti@2.5.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.0)) which: 3.0.1 ws: 8.18.3 @@ -17627,7 +17620,7 @@ snapshots: - utf-8-validate - vue - '@nuxt/devtools@1.7.0(rollup@4.49.0)(vite@7.1.2(@types/node@22.10.5)(jiti@2.5.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.0))(vue@3.5.13(typescript@5.9.2))': + '@nuxt/devtools@1.7.0(rollup@4.50.0)(vite@7.1.2(@types/node@22.10.5)(jiti@2.5.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.0))(vue@3.5.13(typescript@5.9.2))': dependencies: '@antfu/utils': 0.7.10 '@nuxt/devtools-kit': 1.7.0(magicast@0.3.5)(vite@7.1.2(@types/node@22.10.5)(jiti@2.5.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.0)) @@ -17660,10 +17653,10 @@ snapshots: semver: 7.7.2 simple-git: 3.28.0 sirv: 3.0.1 - tinyglobby: 0.2.14 - unimport: 3.14.6(rollup@4.49.0) + tinyglobby: 0.2.10 + unimport: 3.14.6(rollup@4.50.0) vite: 7.1.2(@types/node@22.10.5)(jiti@2.5.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.0) - vite-plugin-inspect: 0.8.9(@nuxt/kit@3.15.4(magicast@0.3.5))(rollup@4.49.0)(vite@7.1.2(@types/node@22.10.5)(jiti@2.5.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.0)) + vite-plugin-inspect: 0.8.9(@nuxt/kit@3.15.4(magicast@0.3.5))(rollup@4.50.0)(vite@7.1.2(@types/node@22.10.5)(jiti@2.5.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.0)) vite-plugin-vue-inspector: 5.3.2(vite@7.1.2(@types/node@22.10.5)(jiti@2.5.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.0)) which: 3.0.1 ws: 8.18.3 @@ -17701,9 +17694,9 @@ snapshots: - rollup - supports-color - '@nuxt/kit@3.14.1592(magicast@0.3.5)(rollup@4.49.0)': + '@nuxt/kit@3.14.1592(magicast@0.3.5)(rollup@4.50.0)': dependencies: - '@nuxt/schema': 3.14.1592(magicast@0.3.5)(rollup@4.49.0) + '@nuxt/schema': 3.14.1592(magicast@0.3.5)(rollup@4.50.0) c12: 2.0.1(magicast@0.3.5) consola: 3.4.2 defu: 6.1.4 @@ -17721,7 +17714,7 @@ snapshots: semver: 7.7.2 ufo: 1.6.1 unctx: 2.4.1 - unimport: 3.14.6(rollup@4.49.0) + unimport: 3.14.6(rollup@4.50.0) untyped: 1.5.2 transitivePeerDependencies: - magicast @@ -17820,7 +17813,7 @@ snapshots: - rollup - supports-color - '@nuxt/schema@3.14.1592(magicast@0.3.5)(rollup@4.49.0)': + '@nuxt/schema@3.14.1592(magicast@0.3.5)(rollup@4.50.0)': dependencies: c12: 2.0.1(magicast@0.3.5) compatx: 0.1.8 @@ -17833,7 +17826,7 @@ snapshots: std-env: 3.9.0 ufo: 1.6.1 uncrypto: 0.1.3 - unimport: 3.14.6(rollup@4.49.0) + unimport: 3.14.6(rollup@4.50.0) untyped: 1.5.2 transitivePeerDependencies: - magicast @@ -17874,7 +17867,7 @@ snapshots: defu: 6.1.4 destr: 2.0.5 estree-walker: 3.0.3 - fake-indexeddb: 6.2.0 + fake-indexeddb: 6.2.2 get-port-please: 3.2.0 h3: 1.15.4 local-pkg: 1.1.2 @@ -17889,7 +17882,7 @@ snapshots: std-env: 3.9.0 tinyexec: 0.3.2 ufo: 1.6.1 - unplugin: 2.3.9 + unplugin: 2.3.10 vite: 6.3.5(@types/node@22.10.5)(jiti@2.5.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.0) vitest-environment-nuxt: 1.0.1(@types/node@22.10.5)(@vue/test-utils@2.4.6)(jiti@2.5.1)(jsdom@23.0.0)(less@4.2.2)(magicast@0.3.5)(sass@1.85.0)(terser@5.43.1)(typescript@5.8.3)(vitest@3.2.4(@types/debug@4.1.12)(@types/node@22.10.5)(jiti@2.5.1)(jsdom@23.0.0)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.0))(yaml@2.8.0) vue: 3.5.13(typescript@5.8.3) @@ -17972,10 +17965,10 @@ snapshots: - vti - vue-tsc - '@nuxt/vite-builder@3.14.1592(@types/node@22.10.5)(eslint@9.17.0(jiti@2.5.1))(less@4.2.2)(magicast@0.3.5)(optionator@0.9.4)(rollup@4.49.0)(sass@1.85.0)(terser@5.43.1)(typescript@5.8.3)(vue@3.5.13(typescript@5.8.3))': + '@nuxt/vite-builder@3.14.1592(@types/node@22.10.5)(eslint@9.17.0(jiti@2.5.1))(less@4.2.2)(magicast@0.3.5)(optionator@0.9.4)(rollup@4.50.0)(sass@1.85.0)(terser@5.43.1)(typescript@5.8.3)(vue@3.5.13(typescript@5.8.3))': dependencies: - '@nuxt/kit': 3.14.1592(magicast@0.3.5)(rollup@4.49.0) - '@rollup/plugin-replace': 6.0.2(rollup@4.49.0) + '@nuxt/kit': 3.14.1592(magicast@0.3.5)(rollup@4.50.0) + '@rollup/plugin-replace': 6.0.2(rollup@4.50.0) '@vitejs/plugin-vue': 5.2.1(vite@5.4.19(@types/node@22.10.5)(less@4.2.2)(sass@1.85.0)(terser@5.43.1))(vue@3.5.13(typescript@5.8.3)) '@vitejs/plugin-vue-jsx': 4.1.1(vite@5.4.19(@types/node@22.10.5)(less@4.2.2)(sass@1.85.0)(terser@5.43.1))(vue@3.5.13(typescript@5.8.3)) autoprefixer: 10.4.20(postcss@8.5.6) @@ -17998,7 +17991,7 @@ snapshots: perfect-debounce: 1.0.0 pkg-types: 1.3.1 postcss: 8.5.6 - rollup-plugin-visualizer: 5.14.0(rollup@4.49.0) + rollup-plugin-visualizer: 5.14.0(rollup@4.50.0) std-env: 3.9.0 strip-literal: 2.1.1 ufo: 1.6.1 @@ -18032,10 +18025,10 @@ snapshots: - vti - vue-tsc - '@nuxt/vite-builder@3.14.1592(@types/node@22.10.5)(eslint@9.17.0(jiti@2.5.1))(less@4.2.2)(magicast@0.3.5)(optionator@0.9.4)(rollup@4.49.0)(sass@1.85.0)(terser@5.43.1)(typescript@5.9.2)(vue@3.5.13(typescript@5.9.2))': + '@nuxt/vite-builder@3.14.1592(@types/node@22.10.5)(eslint@9.17.0(jiti@2.5.1))(less@4.2.2)(magicast@0.3.5)(optionator@0.9.4)(rollup@4.50.0)(sass@1.85.0)(terser@5.43.1)(typescript@5.9.2)(vue@3.5.13(typescript@5.9.2))': dependencies: - '@nuxt/kit': 3.14.1592(magicast@0.3.5)(rollup@4.49.0) - '@rollup/plugin-replace': 6.0.2(rollup@4.49.0) + '@nuxt/kit': 3.14.1592(magicast@0.3.5)(rollup@4.50.0) + '@rollup/plugin-replace': 6.0.2(rollup@4.50.0) '@vitejs/plugin-vue': 5.2.1(vite@5.4.19(@types/node@22.10.5)(less@4.2.2)(sass@1.85.0)(terser@5.43.1))(vue@3.5.13(typescript@5.9.2)) '@vitejs/plugin-vue-jsx': 4.1.1(vite@5.4.19(@types/node@22.10.5)(less@4.2.2)(sass@1.85.0)(terser@5.43.1))(vue@3.5.13(typescript@5.9.2)) autoprefixer: 10.4.20(postcss@8.5.6) @@ -18058,7 +18051,7 @@ snapshots: perfect-debounce: 1.0.0 pkg-types: 1.3.1 postcss: 8.5.6 - rollup-plugin-visualizer: 5.14.0(rollup@4.49.0) + rollup-plugin-visualizer: 5.14.0(rollup@4.50.0) std-env: 3.9.0 strip-literal: 2.1.1 ufo: 1.6.1 @@ -18897,9 +18890,9 @@ snapshots: optionalDependencies: rollup: 3.29.5 - '@rollup/plugin-alias@5.1.1(rollup@4.49.0)': + '@rollup/plugin-alias@5.1.1(rollup@4.50.0)': optionalDependencies: - rollup: 4.49.0 + rollup: 4.50.0 '@rollup/plugin-commonjs@25.0.8(rollup@3.29.5)': dependencies: @@ -18912,9 +18905,9 @@ snapshots: optionalDependencies: rollup: 3.29.5 - '@rollup/plugin-commonjs@28.0.6(rollup@4.49.0)': + '@rollup/plugin-commonjs@28.0.6(rollup@4.50.0)': dependencies: - '@rollup/pluginutils': 5.2.0(rollup@4.49.0) + '@rollup/pluginutils': 5.2.0(rollup@4.50.0) commondir: 1.0.1 estree-walker: 2.0.2 fdir: 6.5.0(picomatch@4.0.3) @@ -18922,15 +18915,15 @@ snapshots: magic-string: 0.30.18 picomatch: 4.0.3 optionalDependencies: - rollup: 4.49.0 + rollup: 4.50.0 - '@rollup/plugin-inject@5.0.5(rollup@4.49.0)': + '@rollup/plugin-inject@5.0.5(rollup@4.50.0)': dependencies: - '@rollup/pluginutils': 5.2.0(rollup@4.49.0) + '@rollup/pluginutils': 5.2.0(rollup@4.50.0) estree-walker: 2.0.2 magic-string: 0.30.18 optionalDependencies: - rollup: 4.49.0 + rollup: 4.50.0 '@rollup/plugin-json@6.1.0(rollup@3.29.5)': dependencies: @@ -18938,11 +18931,11 @@ snapshots: optionalDependencies: rollup: 3.29.5 - '@rollup/plugin-json@6.1.0(rollup@4.49.0)': + '@rollup/plugin-json@6.1.0(rollup@4.50.0)': dependencies: - '@rollup/pluginutils': 5.2.0(rollup@4.49.0) + '@rollup/pluginutils': 5.2.0(rollup@4.50.0) optionalDependencies: - rollup: 4.49.0 + rollup: 4.50.0 '@rollup/plugin-node-resolve@15.3.1(rollup@3.29.5)': dependencies: @@ -18954,15 +18947,15 @@ snapshots: optionalDependencies: rollup: 3.29.5 - '@rollup/plugin-node-resolve@16.0.1(rollup@4.49.0)': + '@rollup/plugin-node-resolve@16.0.1(rollup@4.50.0)': dependencies: - '@rollup/pluginutils': 5.2.0(rollup@4.49.0) + '@rollup/pluginutils': 5.2.0(rollup@4.50.0) '@types/resolve': 1.20.2 deepmerge: 4.3.1 is-module: 1.0.0 resolve: 1.22.10 optionalDependencies: - rollup: 4.49.0 + rollup: 4.50.0 '@rollup/plugin-replace@5.0.7(rollup@3.29.5)': dependencies: @@ -18978,20 +18971,20 @@ snapshots: optionalDependencies: rollup: 3.29.5 - '@rollup/plugin-replace@6.0.2(rollup@4.49.0)': + '@rollup/plugin-replace@6.0.2(rollup@4.50.0)': dependencies: - '@rollup/pluginutils': 5.2.0(rollup@4.49.0) + '@rollup/pluginutils': 5.2.0(rollup@4.50.0) magic-string: 0.30.18 optionalDependencies: - rollup: 4.49.0 + rollup: 4.50.0 - '@rollup/plugin-terser@0.4.4(rollup@4.49.0)': + '@rollup/plugin-terser@0.4.4(rollup@4.50.0)': dependencies: serialize-javascript: 6.0.2 smob: 1.5.0 terser: 5.43.1 optionalDependencies: - rollup: 4.49.0 + rollup: 4.50.0 '@rollup/pluginutils@5.2.0(rollup@3.29.5)': dependencies: @@ -19001,13 +18994,13 @@ snapshots: optionalDependencies: rollup: 3.29.5 - '@rollup/pluginutils@5.2.0(rollup@4.49.0)': + '@rollup/pluginutils@5.2.0(rollup@4.50.0)': dependencies: '@types/estree': 1.0.8 estree-walker: 2.0.2 picomatch: 4.0.3 optionalDependencies: - rollup: 4.49.0 + rollup: 4.50.0 '@rollup/rollup-android-arm-eabi@4.31.0': optional: true @@ -19015,7 +19008,7 @@ snapshots: '@rollup/rollup-android-arm-eabi@4.34.8': optional: true - '@rollup/rollup-android-arm-eabi@4.49.0': + '@rollup/rollup-android-arm-eabi@4.50.0': optional: true '@rollup/rollup-android-arm64@4.31.0': @@ -19024,7 +19017,7 @@ snapshots: '@rollup/rollup-android-arm64@4.34.8': optional: true - '@rollup/rollup-android-arm64@4.49.0': + '@rollup/rollup-android-arm64@4.50.0': optional: true '@rollup/rollup-darwin-arm64@4.31.0': @@ -19033,7 +19026,7 @@ snapshots: '@rollup/rollup-darwin-arm64@4.34.8': optional: true - '@rollup/rollup-darwin-arm64@4.49.0': + '@rollup/rollup-darwin-arm64@4.50.0': optional: true '@rollup/rollup-darwin-x64@4.31.0': @@ -19042,7 +19035,7 @@ snapshots: '@rollup/rollup-darwin-x64@4.34.8': optional: true - '@rollup/rollup-darwin-x64@4.49.0': + '@rollup/rollup-darwin-x64@4.50.0': optional: true '@rollup/rollup-freebsd-arm64@4.31.0': @@ -19051,7 +19044,7 @@ snapshots: '@rollup/rollup-freebsd-arm64@4.34.8': optional: true - '@rollup/rollup-freebsd-arm64@4.49.0': + '@rollup/rollup-freebsd-arm64@4.50.0': optional: true '@rollup/rollup-freebsd-x64@4.31.0': @@ -19060,7 +19053,7 @@ snapshots: '@rollup/rollup-freebsd-x64@4.34.8': optional: true - '@rollup/rollup-freebsd-x64@4.49.0': + '@rollup/rollup-freebsd-x64@4.50.0': optional: true '@rollup/rollup-linux-arm-gnueabihf@4.31.0': @@ -19069,7 +19062,7 @@ snapshots: '@rollup/rollup-linux-arm-gnueabihf@4.34.8': optional: true - '@rollup/rollup-linux-arm-gnueabihf@4.49.0': + '@rollup/rollup-linux-arm-gnueabihf@4.50.0': optional: true '@rollup/rollup-linux-arm-musleabihf@4.31.0': @@ -19078,7 +19071,7 @@ snapshots: '@rollup/rollup-linux-arm-musleabihf@4.34.8': optional: true - '@rollup/rollup-linux-arm-musleabihf@4.49.0': + '@rollup/rollup-linux-arm-musleabihf@4.50.0': optional: true '@rollup/rollup-linux-arm64-gnu@4.31.0': @@ -19087,7 +19080,7 @@ snapshots: '@rollup/rollup-linux-arm64-gnu@4.34.8': optional: true - '@rollup/rollup-linux-arm64-gnu@4.49.0': + '@rollup/rollup-linux-arm64-gnu@4.50.0': optional: true '@rollup/rollup-linux-arm64-musl@4.31.0': @@ -19096,7 +19089,7 @@ snapshots: '@rollup/rollup-linux-arm64-musl@4.34.8': optional: true - '@rollup/rollup-linux-arm64-musl@4.49.0': + '@rollup/rollup-linux-arm64-musl@4.50.0': optional: true '@rollup/rollup-linux-loongarch64-gnu@4.31.0': @@ -19105,7 +19098,7 @@ snapshots: '@rollup/rollup-linux-loongarch64-gnu@4.34.8': optional: true - '@rollup/rollup-linux-loongarch64-gnu@4.49.0': + '@rollup/rollup-linux-loongarch64-gnu@4.50.0': optional: true '@rollup/rollup-linux-powerpc64le-gnu@4.31.0': @@ -19114,7 +19107,7 @@ snapshots: '@rollup/rollup-linux-powerpc64le-gnu@4.34.8': optional: true - '@rollup/rollup-linux-ppc64-gnu@4.49.0': + '@rollup/rollup-linux-ppc64-gnu@4.50.0': optional: true '@rollup/rollup-linux-riscv64-gnu@4.31.0': @@ -19123,10 +19116,10 @@ snapshots: '@rollup/rollup-linux-riscv64-gnu@4.34.8': optional: true - '@rollup/rollup-linux-riscv64-gnu@4.49.0': + '@rollup/rollup-linux-riscv64-gnu@4.50.0': optional: true - '@rollup/rollup-linux-riscv64-musl@4.49.0': + '@rollup/rollup-linux-riscv64-musl@4.50.0': optional: true '@rollup/rollup-linux-s390x-gnu@4.31.0': @@ -19135,7 +19128,7 @@ snapshots: '@rollup/rollup-linux-s390x-gnu@4.34.8': optional: true - '@rollup/rollup-linux-s390x-gnu@4.49.0': + '@rollup/rollup-linux-s390x-gnu@4.50.0': optional: true '@rollup/rollup-linux-x64-gnu@4.31.0': @@ -19147,7 +19140,7 @@ snapshots: '@rollup/rollup-linux-x64-gnu@4.44.0': optional: true - '@rollup/rollup-linux-x64-gnu@4.49.0': + '@rollup/rollup-linux-x64-gnu@4.50.0': optional: true '@rollup/rollup-linux-x64-musl@4.31.0': @@ -19156,7 +19149,10 @@ snapshots: '@rollup/rollup-linux-x64-musl@4.34.8': optional: true - '@rollup/rollup-linux-x64-musl@4.49.0': + '@rollup/rollup-linux-x64-musl@4.50.0': + optional: true + + '@rollup/rollup-openharmony-arm64@4.50.0': optional: true '@rollup/rollup-win32-arm64-msvc@4.31.0': @@ -19165,7 +19161,7 @@ snapshots: '@rollup/rollup-win32-arm64-msvc@4.34.8': optional: true - '@rollup/rollup-win32-arm64-msvc@4.49.0': + '@rollup/rollup-win32-arm64-msvc@4.50.0': optional: true '@rollup/rollup-win32-ia32-msvc@4.31.0': @@ -19174,7 +19170,7 @@ snapshots: '@rollup/rollup-win32-ia32-msvc@4.34.8': optional: true - '@rollup/rollup-win32-ia32-msvc@4.49.0': + '@rollup/rollup-win32-ia32-msvc@4.50.0': optional: true '@rollup/rollup-win32-x64-msvc@4.31.0': @@ -19183,7 +19179,7 @@ snapshots: '@rollup/rollup-win32-x64-msvc@4.34.8': optional: true - '@rollup/rollup-win32-x64-msvc@4.49.0': + '@rollup/rollup-win32-x64-msvc@4.50.0': optional: true '@rtsao/scc@1.1.0': {} @@ -19215,38 +19211,38 @@ snapshots: ajv-formats: 3.0.1(ajv@8.17.1) js-yaml: 4.1.0 - '@shikijs/core@3.12.0': + '@shikijs/core@3.12.1': dependencies: - '@shikijs/types': 3.12.0 + '@shikijs/types': 3.12.1 '@shikijs/vscode-textmate': 10.0.2 '@types/hast': 3.0.4 hast-util-to-html: 9.0.5 - '@shikijs/engine-javascript@3.12.0': + '@shikijs/engine-javascript@3.12.1': dependencies: - '@shikijs/types': 3.12.0 + '@shikijs/types': 3.12.1 '@shikijs/vscode-textmate': 10.0.2 oniguruma-to-es: 4.3.3 - '@shikijs/engine-oniguruma@3.12.0': + '@shikijs/engine-oniguruma@3.12.1': dependencies: - '@shikijs/types': 3.12.0 + '@shikijs/types': 3.12.1 '@shikijs/vscode-textmate': 10.0.2 - '@shikijs/langs@3.12.0': + '@shikijs/langs@3.12.1': dependencies: - '@shikijs/types': 3.12.0 + '@shikijs/types': 3.12.1 - '@shikijs/themes@3.12.0': + '@shikijs/themes@3.12.1': dependencies: - '@shikijs/types': 3.12.0 + '@shikijs/types': 3.12.1 - '@shikijs/transformers@3.12.0': + '@shikijs/transformers@3.12.1': dependencies: - '@shikijs/core': 3.12.0 - '@shikijs/types': 3.12.0 + '@shikijs/core': 3.12.1 + '@shikijs/types': 3.12.1 - '@shikijs/types@3.12.0': + '@shikijs/types@3.12.1': dependencies: '@shikijs/vscode-textmate': 10.0.2 '@types/hast': 3.0.4 @@ -19302,7 +19298,7 @@ snapshots: '@sveltejs/adapter-auto@4.0.0(@sveltejs/kit@2.17.1(@sveltejs/vite-plugin-svelte@5.0.3(svelte@5.19.9)(vite@7.1.2(@types/node@22.10.5)(jiti@2.5.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.0)))(svelte@5.19.9)(vite@7.1.2(@types/node@22.10.5)(jiti@2.5.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.0)))': dependencies: '@sveltejs/kit': 2.17.1(@sveltejs/vite-plugin-svelte@5.0.3(svelte@5.19.9)(vite@7.1.2(@types/node@22.10.5)(jiti@2.5.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.0)))(svelte@5.19.9)(vite@7.1.2(@types/node@22.10.5)(jiti@2.5.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.0)) - import-meta-resolve: 4.1.0 + import-meta-resolve: 4.2.0 '@sveltejs/kit@2.17.1(@sveltejs/vite-plugin-svelte@5.0.3(svelte@5.19.9)(vite@7.1.2(@types/node@22.10.5)(jiti@2.5.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.0)))(svelte@5.19.9)(vite@7.1.2(@types/node@22.10.5)(jiti@2.5.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.0))': dependencies: @@ -19311,7 +19307,7 @@ snapshots: cookie: 0.6.0 devalue: 5.3.2 esm-env: 1.2.2 - import-meta-resolve: 4.1.0 + import-meta-resolve: 4.2.0 kleur: 4.1.5 magic-string: 0.30.18 mrmime: 2.0.1 @@ -19898,12 +19894,12 @@ snapshots: '@unrs/resolver-binding-win32-x64-msvc@1.11.1': optional: true - '@vercel/nft@0.29.4(encoding@0.1.13)(rollup@4.49.0)': + '@vercel/nft@0.29.4(encoding@0.1.13)(rollup@4.50.0)': dependencies: '@mapbox/node-pre-gyp': 2.0.0(encoding@0.1.13) - '@rollup/pluginutils': 5.2.0(rollup@4.49.0) - acorn: 8.15.0 - acorn-import-attributes: 1.9.5(acorn@8.15.0) + '@rollup/pluginutils': 5.2.0(rollup@4.50.0) + acorn: 8.14.0 + acorn-import-attributes: 1.9.5(acorn@8.14.0) async-sema: 3.1.1 bindings: 1.5.0 estree-walker: 2.0.2 @@ -20231,7 +20227,7 @@ snapshots: '@vue/devtools-core@7.6.8(vite@7.1.2(@types/node@22.10.5)(jiti@2.5.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.0))(vue@3.5.13(typescript@5.8.3))': dependencies: - '@vue/devtools-kit': 7.7.7 + '@vue/devtools-kit': 7.6.8 '@vue/devtools-shared': 7.7.7 mitt: 3.0.1 nanoid: 5.1.5 @@ -20243,7 +20239,7 @@ snapshots: '@vue/devtools-core@7.6.8(vite@7.1.2(@types/node@22.10.5)(jiti@2.5.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.0))(vue@3.5.13(typescript@5.9.2))': dependencies: - '@vue/devtools-kit': 7.7.7 + '@vue/devtools-kit': 7.6.8 '@vue/devtools-shared': 7.7.7 mitt: 3.0.1 nanoid: 5.1.5 @@ -20401,26 +20397,26 @@ snapshots: typescript: 5.8.3 vue: 3.5.13(typescript@5.8.3) - '@vueuse/core@13.8.0(vue@3.5.20(typescript@5.9.2))': + '@vueuse/core@13.9.0(vue@3.5.20(typescript@5.9.2))': dependencies: '@types/web-bluetooth': 0.0.21 - '@vueuse/metadata': 13.8.0 - '@vueuse/shared': 13.8.0(vue@3.5.20(typescript@5.9.2)) + '@vueuse/metadata': 13.9.0 + '@vueuse/shared': 13.9.0(vue@3.5.20(typescript@5.9.2)) vue: 3.5.20(typescript@5.9.2) - '@vueuse/integrations@13.8.0(axios@1.8.2)(focus-trap@7.6.5)(jwt-decode@4.0.0)(vue@3.5.20(typescript@5.9.2))': + '@vueuse/integrations@13.9.0(axios@1.8.2)(focus-trap@7.6.5)(jwt-decode@4.0.0)(vue@3.5.20(typescript@5.9.2))': dependencies: - '@vueuse/core': 13.8.0(vue@3.5.20(typescript@5.9.2)) - '@vueuse/shared': 13.8.0(vue@3.5.20(typescript@5.9.2)) + '@vueuse/core': 13.9.0(vue@3.5.20(typescript@5.9.2)) + '@vueuse/shared': 13.9.0(vue@3.5.20(typescript@5.9.2)) vue: 3.5.20(typescript@5.9.2) optionalDependencies: axios: 1.8.2 focus-trap: 7.6.5 jwt-decode: 4.0.0 - '@vueuse/metadata@13.8.0': {} + '@vueuse/metadata@13.9.0': {} - '@vueuse/shared@13.8.0(vue@3.5.20(typescript@5.9.2))': + '@vueuse/shared@13.9.0(vue@3.5.20(typescript@5.9.2))': dependencies: vue: 3.5.20(typescript@5.9.2) @@ -20549,9 +20545,9 @@ snapshots: mime-types: 2.1.35 negotiator: 0.6.3 - acorn-import-attributes@1.9.5(acorn@8.15.0): + acorn-import-attributes@1.9.5(acorn@8.14.0): dependencies: - acorn: 8.15.0 + acorn: 8.14.0 acorn-jsx@5.3.2(acorn@7.4.1): dependencies: @@ -20779,8 +20775,8 @@ snapshots: autoprefixer@10.4.19(postcss@8.4.41): dependencies: - browserslist: 4.25.3 - caniuse-lite: 1.0.30001737 + browserslist: 4.25.4 + caniuse-lite: 1.0.30001739 fraction.js: 4.3.7 normalize-range: 0.1.2 picocolors: 1.1.1 @@ -20789,8 +20785,8 @@ snapshots: autoprefixer@10.4.20(postcss@8.4.41): dependencies: - browserslist: 4.25.3 - caniuse-lite: 1.0.30001737 + browserslist: 4.25.4 + caniuse-lite: 1.0.30001739 fraction.js: 4.3.7 normalize-range: 0.1.2 picocolors: 1.1.1 @@ -20799,8 +20795,8 @@ snapshots: autoprefixer@10.4.20(postcss@8.5.2): dependencies: - browserslist: 4.25.3 - caniuse-lite: 1.0.30001737 + browserslist: 4.25.4 + caniuse-lite: 1.0.30001739 fraction.js: 4.3.7 normalize-range: 0.1.2 picocolors: 1.1.1 @@ -20809,8 +20805,8 @@ snapshots: autoprefixer@10.4.20(postcss@8.5.6): dependencies: - browserslist: 4.25.3 - caniuse-lite: 1.0.30001737 + browserslist: 4.25.4 + caniuse-lite: 1.0.30001739 fraction.js: 4.3.7 normalize-range: 0.1.2 picocolors: 1.1.1 @@ -21004,12 +21000,12 @@ snapshots: dependencies: fill-range: 7.1.1 - browserslist@4.25.3: + browserslist@4.25.4: dependencies: - caniuse-lite: 1.0.30001737 + caniuse-lite: 1.0.30001739 electron-to-chromium: 1.5.211 node-releases: 2.0.19 - update-browserslist-db: 1.1.3(browserslist@4.25.3) + update-browserslist-db: 1.1.3(browserslist@4.25.4) buffer-crc32@0.2.13: {} @@ -21127,12 +21123,12 @@ snapshots: caniuse-api@3.0.0: dependencies: - browserslist: 4.25.3 - caniuse-lite: 1.0.30001737 + browserslist: 4.25.4 + caniuse-lite: 1.0.30001739 lodash.memoize: 4.1.2 lodash.uniq: 4.5.0 - caniuse-lite@1.0.30001737: {} + caniuse-lite@1.0.30001739: {} ccount@2.0.1: {} @@ -21428,7 +21424,7 @@ snapshots: core-js-compat@3.45.1: dependencies: - browserslist: 4.25.3 + browserslist: 4.25.4 core-util-is@1.0.3: {} @@ -21526,7 +21522,7 @@ snapshots: cssnano-preset-default@7.0.9(postcss@8.5.6): dependencies: - browserslist: 4.25.3 + browserslist: 4.25.4 css-declaration-sorter: 7.2.0(postcss@8.5.6) cssnano-utils: 5.0.1(postcss@8.5.6) postcss: 8.5.6 @@ -21623,10 +21619,6 @@ snapshots: dependencies: ms: 2.1.3 - debug@4.3.4: - dependencies: - ms: 2.1.2 - debug@4.3.7: dependencies: ms: 2.1.3 @@ -22716,7 +22708,7 @@ snapshots: extract-zip@2.0.1: dependencies: - debug: 4.3.4 + debug: 4.4.1 get-stream: 5.2.0 yauzl: 2.10.0 optionalDependencies: @@ -22724,7 +22716,7 @@ snapshots: transitivePeerDependencies: - supports-color - fake-indexeddb@6.2.0: {} + fake-indexeddb@6.2.2: {} fast-decode-uri-component@1.0.1: {} @@ -23006,7 +22998,7 @@ snapshots: get-caller-file@2.0.5: {} - get-east-asian-width@1.3.0: {} + get-east-asian-width@1.3.1: {} get-intrinsic@1.3.0: dependencies: @@ -23431,7 +23423,7 @@ snapshots: parent-module: 1.0.1 resolve-from: 4.0.0 - import-meta-resolve@4.1.0: {} + import-meta-resolve@4.2.0: {} impound@0.2.2(rollup@3.29.5): dependencies: @@ -23439,17 +23431,17 @@ snapshots: mlly: 1.7.4 mocked-exports: 0.1.1 pathe: 2.0.3 - unplugin: 2.3.9 + unplugin: 2.3.10 transitivePeerDependencies: - rollup - impound@0.2.2(rollup@4.49.0): + impound@0.2.2(rollup@4.50.0): dependencies: - '@rollup/pluginutils': 5.2.0(rollup@4.49.0) + '@rollup/pluginutils': 5.2.0(rollup@4.50.0) mlly: 1.7.4 mocked-exports: 0.1.1 pathe: 2.0.3 - unplugin: 2.3.9 + unplugin: 2.3.10 transitivePeerDependencies: - rollup @@ -23480,7 +23472,7 @@ snapshots: ioredis@5.7.0: dependencies: - '@ioredis/commands': 1.3.0 + '@ioredis/commands': 1.3.1 cluster-key-slot: 1.1.2 debug: 4.4.1 denque: 2.1.0 @@ -23572,9 +23564,9 @@ snapshots: is-fullwidth-code-point@4.0.0: {} - is-fullwidth-code-point@5.0.0: + is-fullwidth-code-point@5.1.0: dependencies: - get-east-asian-width: 1.3.0 + get-east-asian-width: 1.3.1 is-generator-function@1.1.0: dependencies: @@ -24718,8 +24710,6 @@ snapshots: ms@2.0.0: {} - ms@2.1.2: {} - ms@2.1.3: {} msgpackr-extract@3.0.3: @@ -24797,7 +24787,7 @@ snapshots: '@swc/counter': 0.1.3 '@swc/helpers': 0.5.15 busboy: 1.6.0 - caniuse-lite: 1.0.30001737 + caniuse-lite: 1.0.30001739 postcss: 8.4.31 react: 19.0.0 react-dom: 19.0.0(react@19.0.0) @@ -24820,15 +24810,15 @@ snapshots: nitropack@2.12.4(@netlify/blobs@9.1.2)(encoding@0.1.13): dependencies: '@cloudflare/kv-asset-handler': 0.4.0 - '@netlify/functions': 3.1.10(encoding@0.1.13)(rollup@4.49.0) - '@rollup/plugin-alias': 5.1.1(rollup@4.49.0) - '@rollup/plugin-commonjs': 28.0.6(rollup@4.49.0) - '@rollup/plugin-inject': 5.0.5(rollup@4.49.0) - '@rollup/plugin-json': 6.1.0(rollup@4.49.0) - '@rollup/plugin-node-resolve': 16.0.1(rollup@4.49.0) - '@rollup/plugin-replace': 6.0.2(rollup@4.49.0) - '@rollup/plugin-terser': 0.4.4(rollup@4.49.0) - '@vercel/nft': 0.29.4(encoding@0.1.13)(rollup@4.49.0) + '@netlify/functions': 3.1.10(encoding@0.1.13)(rollup@4.50.0) + '@rollup/plugin-alias': 5.1.1(rollup@4.50.0) + '@rollup/plugin-commonjs': 28.0.6(rollup@4.50.0) + '@rollup/plugin-inject': 5.0.5(rollup@4.50.0) + '@rollup/plugin-json': 6.1.0(rollup@4.50.0) + '@rollup/plugin-node-resolve': 16.0.1(rollup@4.50.0) + '@rollup/plugin-replace': 6.0.2(rollup@4.50.0) + '@rollup/plugin-terser': 0.4.4(rollup@4.50.0) + '@vercel/nft': 0.29.4(encoding@0.1.13)(rollup@4.50.0) archiver: 7.0.1 c12: 3.2.0(magicast@0.3.5) chokidar: 4.0.3 @@ -24870,8 +24860,8 @@ snapshots: pkg-types: 2.3.0 pretty-bytes: 6.1.1 radix3: 1.1.2 - rollup: 4.49.0 - rollup-plugin-visualizer: 6.0.3(rollup@4.49.0) + rollup: 4.50.0 + rollup-plugin-visualizer: 6.0.3(rollup@4.50.0) scule: 1.3.0 semver: 7.7.2 serve-placeholder: 2.0.2 @@ -25193,14 +25183,14 @@ snapshots: - vue-tsc - xml2js - nuxt@3.14.1592(@netlify/blobs@9.1.2)(@parcel/watcher@2.5.1)(@types/node@22.10.5)(db0@0.3.2)(encoding@0.1.13)(eslint@9.17.0(jiti@2.5.1))(ioredis@5.7.0)(less@4.2.2)(magicast@0.3.5)(optionator@0.9.4)(rollup@4.49.0)(sass@1.85.0)(terser@5.43.1)(typescript@5.8.3)(vite@7.1.2(@types/node@22.10.5)(jiti@2.5.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.0)): + nuxt@3.14.1592(@netlify/blobs@9.1.2)(@parcel/watcher@2.5.1)(@types/node@22.10.5)(db0@0.3.2)(encoding@0.1.13)(eslint@9.17.0(jiti@2.5.1))(ioredis@5.7.0)(less@4.2.2)(magicast@0.3.5)(optionator@0.9.4)(rollup@4.50.0)(sass@1.85.0)(terser@5.43.1)(typescript@5.8.3)(vite@7.1.2(@types/node@22.10.5)(jiti@2.5.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.0)): dependencies: '@nuxt/devalue': 2.0.2 - '@nuxt/devtools': 1.7.0(rollup@4.49.0)(vite@7.1.2(@types/node@22.10.5)(jiti@2.5.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.0))(vue@3.5.13(typescript@5.8.3)) - '@nuxt/kit': 3.14.1592(magicast@0.3.5)(rollup@4.49.0) - '@nuxt/schema': 3.14.1592(magicast@0.3.5)(rollup@4.49.0) + '@nuxt/devtools': 1.7.0(rollup@4.50.0)(vite@7.1.2(@types/node@22.10.5)(jiti@2.5.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.0))(vue@3.5.13(typescript@5.8.3)) + '@nuxt/kit': 3.14.1592(magicast@0.3.5)(rollup@4.50.0) + '@nuxt/schema': 3.14.1592(magicast@0.3.5)(rollup@4.50.0) '@nuxt/telemetry': 2.6.6(magicast@0.3.5) - '@nuxt/vite-builder': 3.14.1592(@types/node@22.10.5)(eslint@9.17.0(jiti@2.5.1))(less@4.2.2)(magicast@0.3.5)(optionator@0.9.4)(rollup@4.49.0)(sass@1.85.0)(terser@5.43.1)(typescript@5.8.3)(vue@3.5.13(typescript@5.8.3)) + '@nuxt/vite-builder': 3.14.1592(@types/node@22.10.5)(eslint@9.17.0(jiti@2.5.1))(less@4.2.2)(magicast@0.3.5)(optionator@0.9.4)(rollup@4.50.0)(sass@1.85.0)(terser@5.43.1)(typescript@5.8.3)(vue@3.5.13(typescript@5.8.3)) '@unhead/dom': 1.11.20 '@unhead/shared': 1.11.20 '@unhead/ssr': 1.11.20 @@ -25223,7 +25213,7 @@ snapshots: h3: 1.15.4 hookable: 5.5.3 ignore: 6.0.2 - impound: 0.2.2(rollup@4.49.0) + impound: 0.2.2(rollup@4.50.0) jiti: 2.5.1 klona: 2.0.6 knitwork: 1.2.0 @@ -25250,9 +25240,9 @@ snapshots: unctx: 2.4.1 unenv: 1.10.0 unhead: 1.11.20 - unimport: 3.14.6(rollup@4.49.0) + unimport: 3.14.6(rollup@4.50.0) unplugin: 1.16.1 - unplugin-vue-router: 0.10.9(rollup@4.49.0)(vue-router@4.5.0(vue@3.5.13(typescript@5.8.3)))(vue@3.5.13(typescript@5.8.3)) + unplugin-vue-router: 0.10.9(rollup@4.50.0)(vue-router@4.5.0(vue@3.5.13(typescript@5.8.3)))(vue@3.5.13(typescript@5.8.3)) unstorage: 1.17.0(@netlify/blobs@9.1.2)(db0@0.3.2)(ioredis@5.7.0) untyped: 1.5.2 vue: 3.5.13(typescript@5.8.3) @@ -25314,14 +25304,14 @@ snapshots: - vue-tsc - xml2js - nuxt@3.14.1592(@netlify/blobs@9.1.2)(@parcel/watcher@2.5.1)(@types/node@22.10.5)(db0@0.3.2)(encoding@0.1.13)(eslint@9.17.0(jiti@2.5.1))(ioredis@5.7.0)(less@4.2.2)(magicast@0.3.5)(optionator@0.9.4)(rollup@4.49.0)(sass@1.85.0)(terser@5.43.1)(typescript@5.9.2)(vite@7.1.2(@types/node@22.10.5)(jiti@2.5.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.0)): + nuxt@3.14.1592(@netlify/blobs@9.1.2)(@parcel/watcher@2.5.1)(@types/node@22.10.5)(db0@0.3.2)(encoding@0.1.13)(eslint@9.17.0(jiti@2.5.1))(ioredis@5.7.0)(less@4.2.2)(magicast@0.3.5)(optionator@0.9.4)(rollup@4.50.0)(sass@1.85.0)(terser@5.43.1)(typescript@5.9.2)(vite@7.1.2(@types/node@22.10.5)(jiti@2.5.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.0)): dependencies: '@nuxt/devalue': 2.0.2 - '@nuxt/devtools': 1.7.0(rollup@4.49.0)(vite@7.1.2(@types/node@22.10.5)(jiti@2.5.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.0))(vue@3.5.13(typescript@5.9.2)) - '@nuxt/kit': 3.14.1592(magicast@0.3.5)(rollup@4.49.0) - '@nuxt/schema': 3.14.1592(magicast@0.3.5)(rollup@4.49.0) + '@nuxt/devtools': 1.7.0(rollup@4.50.0)(vite@7.1.2(@types/node@22.10.5)(jiti@2.5.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.0))(vue@3.5.13(typescript@5.9.2)) + '@nuxt/kit': 3.14.1592(magicast@0.3.5)(rollup@4.50.0) + '@nuxt/schema': 3.14.1592(magicast@0.3.5)(rollup@4.50.0) '@nuxt/telemetry': 2.6.6(magicast@0.3.5) - '@nuxt/vite-builder': 3.14.1592(@types/node@22.10.5)(eslint@9.17.0(jiti@2.5.1))(less@4.2.2)(magicast@0.3.5)(optionator@0.9.4)(rollup@4.49.0)(sass@1.85.0)(terser@5.43.1)(typescript@5.9.2)(vue@3.5.13(typescript@5.9.2)) + '@nuxt/vite-builder': 3.14.1592(@types/node@22.10.5)(eslint@9.17.0(jiti@2.5.1))(less@4.2.2)(magicast@0.3.5)(optionator@0.9.4)(rollup@4.50.0)(sass@1.85.0)(terser@5.43.1)(typescript@5.9.2)(vue@3.5.13(typescript@5.9.2)) '@unhead/dom': 1.11.20 '@unhead/shared': 1.11.20 '@unhead/ssr': 1.11.20 @@ -25344,7 +25334,7 @@ snapshots: h3: 1.15.4 hookable: 5.5.3 ignore: 6.0.2 - impound: 0.2.2(rollup@4.49.0) + impound: 0.2.2(rollup@4.50.0) jiti: 2.5.1 klona: 2.0.6 knitwork: 1.2.0 @@ -25371,9 +25361,9 @@ snapshots: unctx: 2.4.1 unenv: 1.10.0 unhead: 1.11.20 - unimport: 3.14.6(rollup@4.49.0) + unimport: 3.14.6(rollup@4.50.0) unplugin: 1.16.1 - unplugin-vue-router: 0.10.9(rollup@4.49.0)(vue-router@4.5.0(vue@3.5.13(typescript@5.9.2)))(vue@3.5.13(typescript@5.9.2)) + unplugin-vue-router: 0.10.9(rollup@4.50.0)(vue-router@4.5.0(vue@3.5.13(typescript@5.9.2)))(vue@3.5.13(typescript@5.9.2)) unstorage: 1.17.0(@netlify/blobs@9.1.2)(db0@0.3.2)(ioredis@5.7.0) untyped: 1.5.2 vue: 3.5.13(typescript@5.9.2) @@ -25692,7 +25682,7 @@ snapshots: '@npmcli/git': 6.0.3 '@npmcli/installed-package-contents': 3.0.0 '@npmcli/package-json': 6.2.0 - '@npmcli/promise-spawn': 8.0.2 + '@npmcli/promise-spawn': 8.0.3 '@npmcli/run-script': 9.1.0 cacache: 19.0.1 fs-minipass: 3.0.3 @@ -25880,7 +25870,7 @@ snapshots: postcss-colormin@7.0.4(postcss@8.5.6): dependencies: - browserslist: 4.25.3 + browserslist: 4.25.4 caniuse-api: 3.0.0 colord: 2.9.3 postcss: 8.5.6 @@ -25888,7 +25878,7 @@ snapshots: postcss-convert-values@7.0.7(postcss@8.5.6): dependencies: - browserslist: 4.25.3 + browserslist: 4.25.4 postcss: 8.5.6 postcss-value-parser: 4.2.0 @@ -25966,7 +25956,7 @@ snapshots: postcss-merge-rules@7.0.6(postcss@8.5.6): dependencies: - browserslist: 4.25.3 + browserslist: 4.25.4 caniuse-api: 3.0.0 cssnano-utils: 5.0.1(postcss@8.5.6) postcss: 8.5.6 @@ -25986,7 +25976,7 @@ snapshots: postcss-minify-params@7.0.4(postcss@8.5.6): dependencies: - browserslist: 4.25.3 + browserslist: 4.25.4 cssnano-utils: 5.0.1(postcss@8.5.6) postcss: 8.5.6 postcss-value-parser: 4.2.0 @@ -26059,7 +26049,7 @@ snapshots: postcss-normalize-unicode@7.0.4(postcss@8.5.6): dependencies: - browserslist: 4.25.3 + browserslist: 4.25.4 postcss: 8.5.6 postcss-value-parser: 4.2.0 @@ -26081,7 +26071,7 @@ snapshots: postcss-reduce-initial@7.0.4(postcss@8.5.6): dependencies: - browserslist: 4.25.3 + browserslist: 4.25.4 caniuse-api: 3.0.0 postcss: 8.5.6 @@ -26583,23 +26573,23 @@ snapshots: optionalDependencies: rollup: 3.29.5 - rollup-plugin-visualizer@5.14.0(rollup@4.49.0): + rollup-plugin-visualizer@5.14.0(rollup@4.50.0): dependencies: open: 8.4.2 picomatch: 4.0.3 source-map: 0.7.6 yargs: 17.7.2 optionalDependencies: - rollup: 4.49.0 + rollup: 4.50.0 - rollup-plugin-visualizer@6.0.3(rollup@4.49.0): + rollup-plugin-visualizer@6.0.3(rollup@4.50.0): dependencies: open: 8.4.2 picomatch: 4.0.3 source-map: 0.7.6 yargs: 17.7.2 optionalDependencies: - rollup: 4.49.0 + rollup: 4.50.0 rollup@3.29.5: optionalDependencies: @@ -26655,30 +26645,31 @@ snapshots: '@rollup/rollup-win32-x64-msvc': 4.34.8 fsevents: 2.3.3 - rollup@4.49.0: + rollup@4.50.0: dependencies: '@types/estree': 1.0.8 optionalDependencies: - '@rollup/rollup-android-arm-eabi': 4.49.0 - '@rollup/rollup-android-arm64': 4.49.0 - '@rollup/rollup-darwin-arm64': 4.49.0 - '@rollup/rollup-darwin-x64': 4.49.0 - '@rollup/rollup-freebsd-arm64': 4.49.0 - '@rollup/rollup-freebsd-x64': 4.49.0 - '@rollup/rollup-linux-arm-gnueabihf': 4.49.0 - '@rollup/rollup-linux-arm-musleabihf': 4.49.0 - '@rollup/rollup-linux-arm64-gnu': 4.49.0 - '@rollup/rollup-linux-arm64-musl': 4.49.0 - '@rollup/rollup-linux-loongarch64-gnu': 4.49.0 - '@rollup/rollup-linux-ppc64-gnu': 4.49.0 - '@rollup/rollup-linux-riscv64-gnu': 4.49.0 - '@rollup/rollup-linux-riscv64-musl': 4.49.0 - '@rollup/rollup-linux-s390x-gnu': 4.49.0 - '@rollup/rollup-linux-x64-gnu': 4.49.0 - '@rollup/rollup-linux-x64-musl': 4.49.0 - '@rollup/rollup-win32-arm64-msvc': 4.49.0 - '@rollup/rollup-win32-ia32-msvc': 4.49.0 - '@rollup/rollup-win32-x64-msvc': 4.49.0 + '@rollup/rollup-android-arm-eabi': 4.50.0 + '@rollup/rollup-android-arm64': 4.50.0 + '@rollup/rollup-darwin-arm64': 4.50.0 + '@rollup/rollup-darwin-x64': 4.50.0 + '@rollup/rollup-freebsd-arm64': 4.50.0 + '@rollup/rollup-freebsd-x64': 4.50.0 + '@rollup/rollup-linux-arm-gnueabihf': 4.50.0 + '@rollup/rollup-linux-arm-musleabihf': 4.50.0 + '@rollup/rollup-linux-arm64-gnu': 4.50.0 + '@rollup/rollup-linux-arm64-musl': 4.50.0 + '@rollup/rollup-linux-loongarch64-gnu': 4.50.0 + '@rollup/rollup-linux-ppc64-gnu': 4.50.0 + '@rollup/rollup-linux-riscv64-gnu': 4.50.0 + '@rollup/rollup-linux-riscv64-musl': 4.50.0 + '@rollup/rollup-linux-s390x-gnu': 4.50.0 + '@rollup/rollup-linux-x64-gnu': 4.50.0 + '@rollup/rollup-linux-x64-musl': 4.50.0 + '@rollup/rollup-openharmony-arm64': 4.50.0 + '@rollup/rollup-win32-arm64-msvc': 4.50.0 + '@rollup/rollup-win32-ia32-msvc': 4.50.0 + '@rollup/rollup-win32-x64-msvc': 4.50.0 fsevents: 2.3.3 rrweb-cssom@0.6.0: {} @@ -26937,14 +26928,14 @@ snapshots: shell-quote@1.8.3: {} - shiki@3.12.0: + shiki@3.12.1: dependencies: - '@shikijs/core': 3.12.0 - '@shikijs/engine-javascript': 3.12.0 - '@shikijs/engine-oniguruma': 3.12.0 - '@shikijs/langs': 3.12.0 - '@shikijs/themes': 3.12.0 - '@shikijs/types': 3.12.0 + '@shikijs/core': 3.12.1 + '@shikijs/engine-javascript': 3.12.1 + '@shikijs/engine-oniguruma': 3.12.1 + '@shikijs/langs': 3.12.1 + '@shikijs/themes': 3.12.1 + '@shikijs/types': 3.12.1 '@shikijs/vscode-textmate': 10.0.2 '@types/hast': 3.0.4 @@ -27031,7 +27022,7 @@ snapshots: slice-ansi@7.1.0: dependencies: ansi-styles: 6.2.1 - is-fullwidth-code-point: 5.0.0 + is-fullwidth-code-point: 5.1.0 smart-buffer@4.2.0: {} @@ -27076,7 +27067,7 @@ snapshots: socks-proxy-agent@8.0.5: dependencies: agent-base: 7.1.4 - debug: 4.3.4 + debug: 4.4.1 socks: 2.8.7 transitivePeerDependencies: - supports-color @@ -27231,7 +27222,7 @@ snapshots: string-width@7.2.0: dependencies: emoji-regex: 10.5.0 - get-east-asian-width: 1.3.0 + get-east-asian-width: 1.3.1 strip-ansi: 7.1.0 string.prototype.includes@2.0.1: @@ -27330,7 +27321,7 @@ snapshots: stylehacks@7.0.6(postcss@8.5.6): dependencies: - browserslist: 4.25.3 + browserslist: 4.25.4 postcss: 8.5.6 postcss-selector-parser: 7.1.0 @@ -27513,7 +27504,7 @@ snapshots: terser@5.43.1: dependencies: '@jridgewell/source-map': 0.3.11 - acorn: 8.15.0 + acorn: 8.14.0 commander: 2.20.3 source-map-support: 0.5.21 @@ -27681,7 +27672,7 @@ snapshots: picocolors: 1.1.1 postcss-load-config: 6.0.1(jiti@2.5.1)(postcss@8.5.6)(yaml@2.8.0) resolve-from: 5.0.0 - rollup: 4.49.0 + rollup: 4.50.0 source-map: 0.8.0-beta.0 sucrase: 3.35.0 tinyexec: 0.3.2 @@ -27859,10 +27850,10 @@ snapshots: unctx@2.4.1: dependencies: - acorn: 8.14.0 + acorn: 8.15.0 estree-walker: 3.0.3 magic-string: 0.30.18 - unplugin: 2.3.9 + unplugin: 2.3.10 undici-types@6.20.0: {} @@ -27919,7 +27910,7 @@ snapshots: unimport@3.14.6(rollup@3.29.5): dependencies: '@rollup/pluginutils': 5.2.0(rollup@3.29.5) - acorn: 8.15.0 + acorn: 8.14.0 escape-string-regexp: 5.0.0 estree-walker: 3.0.3 fast-glob: 3.3.3 @@ -27935,10 +27926,10 @@ snapshots: transitivePeerDependencies: - rollup - unimport@3.14.6(rollup@4.49.0): + unimport@3.14.6(rollup@4.50.0): dependencies: - '@rollup/pluginutils': 5.2.0(rollup@4.49.0) - acorn: 8.15.0 + '@rollup/pluginutils': 5.2.0(rollup@4.50.0) + acorn: 8.14.0 escape-string-regexp: 5.0.0 estree-walker: 3.0.3 fast-glob: 3.3.3 @@ -27968,7 +27959,7 @@ snapshots: scule: 1.3.0 strip-literal: 3.0.0 tinyglobby: 0.2.14 - unplugin: 2.3.9 + unplugin: 2.3.10 unplugin-utils: 0.2.5 unimport@5.2.0: @@ -27985,7 +27976,7 @@ snapshots: scule: 1.3.0 strip-literal: 3.0.0 tinyglobby: 0.2.14 - unplugin: 2.3.9 + unplugin: 2.3.10 unplugin-utils: 0.2.5 unique-filename@4.0.0: @@ -28064,10 +28055,10 @@ snapshots: - rollup - vue - unplugin-vue-router@0.10.9(rollup@4.49.0)(vue-router@4.5.0(vue@3.5.13(typescript@5.8.3)))(vue@3.5.13(typescript@5.8.3)): + unplugin-vue-router@0.10.9(rollup@4.50.0)(vue-router@4.5.0(vue@3.5.13(typescript@5.8.3)))(vue@3.5.13(typescript@5.8.3)): dependencies: '@babel/types': 7.28.2 - '@rollup/pluginutils': 5.2.0(rollup@4.49.0) + '@rollup/pluginutils': 5.2.0(rollup@4.50.0) '@vue-macros/common': 1.16.1(vue@3.5.13(typescript@5.8.3)) ast-walker-scope: 0.6.2 chokidar: 3.6.0 @@ -28086,10 +28077,10 @@ snapshots: - rollup - vue - unplugin-vue-router@0.10.9(rollup@4.49.0)(vue-router@4.5.0(vue@3.5.13(typescript@5.9.2)))(vue@3.5.13(typescript@5.9.2)): + unplugin-vue-router@0.10.9(rollup@4.50.0)(vue-router@4.5.0(vue@3.5.13(typescript@5.9.2)))(vue@3.5.13(typescript@5.9.2)): dependencies: '@babel/types': 7.28.2 - '@rollup/pluginutils': 5.2.0(rollup@4.49.0) + '@rollup/pluginutils': 5.2.0(rollup@4.50.0) '@vue-macros/common': 1.16.1(vue@3.5.13(typescript@5.9.2)) ast-walker-scope: 0.6.2 chokidar: 3.6.0 @@ -28115,10 +28106,10 @@ snapshots: unplugin@2.0.0-beta.1: dependencies: - acorn: 8.15.0 + acorn: 8.14.0 webpack-virtual-modules: 0.6.2 - unplugin@2.3.9: + unplugin@2.3.10: dependencies: '@jridgewell/remapping': 2.3.5 acorn: 8.15.0 @@ -28198,11 +28189,11 @@ snapshots: mlly: 1.7.4 pathe: 2.0.3 pkg-types: 2.3.0 - unplugin: 2.3.9 + unplugin: 2.3.10 - update-browserslist-db@1.1.3(browserslist@4.25.3): + update-browserslist-db@1.1.3(browserslist@4.25.4): dependencies: - browserslist: 4.25.3 + browserslist: 4.25.4 escalade: 3.2.0 picocolors: 1.1.1 @@ -28405,10 +28396,10 @@ snapshots: - rollup - supports-color - vite-plugin-inspect@0.8.9(@nuxt/kit@3.15.4(magicast@0.3.5))(rollup@4.49.0)(vite@7.1.2(@types/node@22.10.5)(jiti@2.5.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.0)): + vite-plugin-inspect@0.8.9(@nuxt/kit@3.15.4(magicast@0.3.5))(rollup@4.50.0)(vite@7.1.2(@types/node@22.10.5)(jiti@2.5.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.0)): dependencies: '@antfu/utils': 0.7.10 - '@rollup/pluginutils': 5.2.0(rollup@4.49.0) + '@rollup/pluginutils': 5.2.0(rollup@4.50.0) debug: 4.4.1 error-stack-parser-es: 0.1.5 fs-extra: 11.3.1 @@ -28423,7 +28414,7 @@ snapshots: - rollup - supports-color - vite-plugin-vue-devtools@7.7.0(rollup@4.49.0)(vite@7.1.2(@types/node@22.10.5)(jiti@2.5.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.0))(vue@3.5.13(typescript@5.8.3)): + vite-plugin-vue-devtools@7.7.0(rollup@4.50.0)(vite@7.1.2(@types/node@22.10.5)(jiti@2.5.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.0))(vue@3.5.13(typescript@5.8.3)): dependencies: '@vue/devtools-core': 7.7.7(vite@7.1.2(@types/node@22.10.5)(jiti@2.5.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.0))(vue@3.5.13(typescript@5.8.3)) '@vue/devtools-kit': 7.7.7 @@ -28431,7 +28422,7 @@ snapshots: execa: 9.6.0 sirv: 3.0.1 vite: 7.1.2(@types/node@22.10.5)(jiti@2.5.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.0) - vite-plugin-inspect: 0.8.9(@nuxt/kit@3.15.4(magicast@0.3.5))(rollup@4.49.0)(vite@7.1.2(@types/node@22.10.5)(jiti@2.5.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.0)) + vite-plugin-inspect: 0.8.9(@nuxt/kit@3.15.4(magicast@0.3.5))(rollup@4.50.0)(vite@7.1.2(@types/node@22.10.5)(jiti@2.5.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.0)) vite-plugin-vue-inspector: 5.3.2(vite@7.1.2(@types/node@22.10.5)(jiti@2.5.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.0)) transitivePeerDependencies: - '@nuxt/kit' @@ -28500,7 +28491,7 @@ snapshots: fdir: 6.5.0(picomatch@4.0.3) picomatch: 4.0.3 postcss: 8.5.6 - rollup: 4.49.0 + rollup: 4.50.0 tinyglobby: 0.2.14 optionalDependencies: '@types/node': 22.10.5 @@ -28517,7 +28508,7 @@ snapshots: fdir: 6.5.0(picomatch@4.0.3) picomatch: 4.0.3 postcss: 8.5.6 - rollup: 4.49.0 + rollup: 4.50.0 tinyglobby: 0.2.14 optionalDependencies: '@types/node': 22.10.5 @@ -28534,7 +28525,7 @@ snapshots: fdir: 6.5.0(picomatch@4.0.3) picomatch: 4.0.3 postcss: 8.5.6 - rollup: 4.49.0 + rollup: 4.50.0 tinyglobby: 0.2.14 optionalDependencies: '@types/node': 22.10.5 @@ -28572,20 +28563,20 @@ snapshots: dependencies: '@docsearch/css': 4.0.0-beta.8 '@docsearch/js': 4.0.0-beta.8 - '@iconify-json/simple-icons': 1.2.49 - '@shikijs/core': 3.12.0 - '@shikijs/transformers': 3.12.0 - '@shikijs/types': 3.12.0 + '@iconify-json/simple-icons': 1.2.50 + '@shikijs/core': 3.12.1 + '@shikijs/transformers': 3.12.1 + '@shikijs/types': 3.12.1 '@types/markdown-it': 14.1.2 '@vitejs/plugin-vue': 6.0.1(vite@7.1.2(@types/node@22.10.5)(jiti@2.5.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.0))(vue@3.5.20(typescript@5.9.2)) '@vue/devtools-api': 8.0.1 '@vue/shared': 3.5.20 - '@vueuse/core': 13.8.0(vue@3.5.20(typescript@5.9.2)) - '@vueuse/integrations': 13.8.0(axios@1.8.2)(focus-trap@7.6.5)(jwt-decode@4.0.0)(vue@3.5.20(typescript@5.9.2)) + '@vueuse/core': 13.9.0(vue@3.5.20(typescript@5.9.2)) + '@vueuse/integrations': 13.9.0(axios@1.8.2)(focus-trap@7.6.5)(jwt-decode@4.0.0)(vue@3.5.20(typescript@5.9.2)) focus-trap: 7.6.5 mark.js: 8.11.1 minisearch: 7.1.2 - shiki: 3.12.0 + shiki: 3.12.1 vite: 7.1.2(@types/node@22.10.5)(jiti@2.5.1)(less@4.2.2)(sass@1.85.0)(terser@5.43.1)(yaml@2.8.0) vue: 3.5.20(typescript@5.9.2) optionalDependencies: @@ -28970,7 +28961,7 @@ snapshots: '@webassemblyjs/wasm-edit': 1.14.1 '@webassemblyjs/wasm-parser': 1.14.1 acorn: 8.15.0 - browserslist: 4.25.3 + browserslist: 4.25.4 chrome-trace-event: 1.0.4 enhanced-resolve: 5.18.3 es-module-lexer: 1.7.0 @@ -29000,7 +28991,7 @@ snapshots: '@webassemblyjs/wasm-edit': 1.14.1 '@webassemblyjs/wasm-parser': 1.14.1 acorn: 8.15.0 - browserslist: 4.25.3 + browserslist: 4.25.4 chrome-trace-event: 1.0.4 enhanced-resolve: 5.18.3 es-module-lexer: 1.7.0 -- 2.51.2 From 9eface873de22d6cdac8a6c584421356744bf1e3 Mon Sep 17 00:00:00 2001 From: carson2222 Date: Tue, 2 Sep 2025 20:17:35 +0200 Subject: [PATCH 12/46] chore: update and add new test cases for the next @hey-api/json-schema-ref-parser 1.0.9 update --- .../openapi-ts-tests/main/test/2.0.x.test.ts | 7 + .../openapi-ts-tests/main/test/3.0.x.test.ts | 7 + .../openapi-ts-tests/main/test/3.1.x.test.ts | 1 - .../__snapshots__/2.0.x/external/index.ts | 2 + .../__snapshots__/2.0.x/external/types.gen.ts | 394 ++++++++++++++++ .../@hey-api/schemas/default/schemas.gen.ts | 26 +- .../plugins/@hey-api/sdk/default/types.gen.ts | 15 +- .../@hey-api/sdk/throwOnError/types.gen.ts | 15 +- .../plugins/@pinia/colada/fetch/types.gen.ts | 15 +- .../@pinia/colada/group-by-tag/types.gen.ts | 15 +- .../axios/types.gen.ts | 15 +- .../fetch/types.gen.ts | 15 +- .../@tanstack/react-query/axios/types.gen.ts | 15 +- .../@tanstack/react-query/fetch/types.gen.ts | 15 +- .../@tanstack/solid-query/axios/types.gen.ts | 15 +- .../@tanstack/solid-query/fetch/types.gen.ts | 15 +- .../@tanstack/svelte-query/axios/types.gen.ts | 15 +- .../@tanstack/svelte-query/fetch/types.gen.ts | 15 +- .../@tanstack/vue-query/axios/types.gen.ts | 15 +- .../@tanstack/vue-query/fetch/types.gen.ts | 15 +- .../plugins/fastify/default/types.gen.ts | 15 +- .../plugins/valibot/default/valibot.gen.ts | 9 +- .../__snapshots__/3.0.x/external/index.ts | 2 + .../__snapshots__/3.0.x/external/types.gen.ts | 436 ++++++++++++++++++ .../@hey-api/schemas/default/schemas.gen.ts | 26 +- .../plugins/@hey-api/sdk/default/types.gen.ts | 15 +- .../@hey-api/sdk/throwOnError/types.gen.ts | 15 +- .../plugins/@pinia/colada/fetch/types.gen.ts | 15 +- .../@pinia/colada/group-by-tag/types.gen.ts | 15 +- .../axios/types.gen.ts | 15 +- .../fetch/types.gen.ts | 15 +- .../@tanstack/react-query/axios/types.gen.ts | 15 +- .../@tanstack/react-query/fetch/types.gen.ts | 15 +- .../@tanstack/solid-query/axios/types.gen.ts | 15 +- .../@tanstack/solid-query/fetch/types.gen.ts | 15 +- .../@tanstack/svelte-query/axios/types.gen.ts | 15 +- .../@tanstack/svelte-query/fetch/types.gen.ts | 15 +- .../@tanstack/vue-query/axios/types.gen.ts | 15 +- .../@tanstack/vue-query/fetch/types.gen.ts | 15 +- .../plugins/fastify/default/types.gen.ts | 15 +- .../plugins/valibot/default/valibot.gen.ts | 9 +- .../client-axios/base-url-false/types.gen.ts | 12 +- .../client-axios/base-url-number/types.gen.ts | 12 +- .../client-axios/base-url-strict/types.gen.ts | 12 +- .../client-axios/base-url-string/types.gen.ts | 12 +- .../client-axios/clean-false/types.gen.ts | 12 +- .../client-axios/default/types.gen.ts | 12 +- .../sdk-client-optional/types.gen.ts | 12 +- .../sdk-client-required/types.gen.ts | 12 +- .../tsconfig-nodenext-sdk/types.gen.ts | 12 +- .../client-fetch/base-url-false/types.gen.ts | 12 +- .../client-fetch/base-url-number/types.gen.ts | 12 +- .../client-fetch/base-url-strict/types.gen.ts | 12 +- .../client-fetch/base-url-string/types.gen.ts | 12 +- .../client-fetch/clean-false/types.gen.ts | 12 +- .../client-fetch/default/types.gen.ts | 12 +- .../sdk-client-optional/types.gen.ts | 12 +- .../sdk-client-required/types.gen.ts | 12 +- .../tsconfig-nodenext-sdk/types.gen.ts | 12 +- .../client-next/base-url-false/types.gen.ts | 12 +- .../client-next/base-url-number/types.gen.ts | 12 +- .../client-next/base-url-strict/types.gen.ts | 12 +- .../client-next/base-url-string/types.gen.ts | 12 +- .../client-next/clean-false/types.gen.ts | 12 +- .../@hey-api/client-next/default/types.gen.ts | 12 +- .../sdk-client-optional/types.gen.ts | 12 +- .../sdk-client-required/types.gen.ts | 12 +- .../tsconfig-nodenext-sdk/types.gen.ts | 12 +- .../client-nuxt/base-url-false/types.gen.ts | 12 +- .../client-nuxt/base-url-number/types.gen.ts | 12 +- .../client-nuxt/base-url-strict/types.gen.ts | 12 +- .../client-nuxt/base-url-string/types.gen.ts | 12 +- .../client-nuxt/clean-false/types.gen.ts | 12 +- .../@hey-api/client-nuxt/default/types.gen.ts | 12 +- .../sdk-client-optional/types.gen.ts | 12 +- .../sdk-client-required/types.gen.ts | 12 +- .../tsconfig-nodenext-sdk/types.gen.ts | 12 +- .../client-custom/base-url-false/types.gen.ts | 12 +- .../base-url-number/types.gen.ts | 12 +- .../base-url-strict/types.gen.ts | 12 +- .../base-url-string/types.gen.ts | 12 +- .../clients/client-custom/bundle/types.gen.ts | 12 +- .../client-custom/default/types.gen.ts | 12 +- .../sdk-client-optional/types.gen.ts | 12 +- .../sdk-client-required/types.gen.ts | 12 +- .../my-client/base-url-false/types.gen.ts | 12 +- .../my-client/base-url-number/types.gen.ts | 12 +- .../my-client/base-url-strict/types.gen.ts | 12 +- .../my-client/base-url-string/types.gen.ts | 12 +- .../clients/my-client/bundle/types.gen.ts | 12 +- .../clients/my-client/default/types.gen.ts | 12 +- .../sdk-client-optional/types.gen.ts | 12 +- .../sdk-client-required/types.gen.ts | 12 +- .../__snapshots__/3.1.x/external/types.gen.ts | 432 ++++++++++++++++- .../@hey-api/schemas/default/schemas.gen.ts | 26 +- .../plugins/@hey-api/sdk/default/types.gen.ts | 12 +- .../@hey-api/sdk/throwOnError/types.gen.ts | 12 +- .../plugins/@pinia/colada/fetch/types.gen.ts | 12 +- .../@pinia/colada/group-by-tag/types.gen.ts | 12 +- .../axios/types.gen.ts | 12 +- .../fetch/types.gen.ts | 12 +- .../@tanstack/react-query/axios/types.gen.ts | 12 +- .../@tanstack/react-query/fetch/types.gen.ts | 12 +- .../@tanstack/solid-query/axios/types.gen.ts | 12 +- .../@tanstack/solid-query/fetch/types.gen.ts | 12 +- .../@tanstack/svelte-query/axios/types.gen.ts | 12 +- .../@tanstack/svelte-query/fetch/types.gen.ts | 12 +- .../@tanstack/vue-query/axios/types.gen.ts | 12 +- .../@tanstack/vue-query/fetch/types.gen.ts | 12 +- .../plugins/fastify/default/types.gen.ts | 12 +- .../plugins/valibot/default/valibot.gen.ts | 12 +- .../specs/2.0.x/external-shared.json | 40 +- .../specs/2.0.x/external.yaml | 405 ++++++++++++++++ .../openapi-ts-tests/specs/2.0.x/full.yaml | 4 +- .../specs/3.0.x/external-shared.json | 44 +- .../specs/3.0.x/external.yaml | 433 +++++++++++++++++ .../openapi-ts-tests/specs/3.0.x/full.yaml | 4 +- .../specs/3.1.x/external-shared.json | 54 ++- .../specs/3.1.x/external.yaml | 411 ++++++++++++++++- .../openapi-ts-tests/specs/3.1.x/full.yaml | 4 +- .../2.0.x/mini/default/zod.gen.ts | 9 +- .../__snapshots__/2.0.x/v3/default/zod.gen.ts | 9 +- .../__snapshots__/2.0.x/v4/default/zod.gen.ts | 9 +- .../3.0.x/mini/default/zod.gen.ts | 9 +- .../__snapshots__/3.0.x/v3/default/zod.gen.ts | 9 +- .../__snapshots__/3.0.x/v4/default/zod.gen.ts | 9 +- .../3.1.x/mini/default/zod.gen.ts | 12 +- .../__snapshots__/3.1.x/v3/default/zod.gen.ts | 12 +- .../__snapshots__/3.1.x/v4/default/zod.gen.ts | 12 +- .../2.0.x/mini/default/zod.gen.ts | 9 +- .../__snapshots__/2.0.x/v3/default/zod.gen.ts | 9 +- .../__snapshots__/2.0.x/v4/default/zod.gen.ts | 9 +- .../3.0.x/mini/default/zod.gen.ts | 9 +- .../__snapshots__/3.0.x/v3/default/zod.gen.ts | 9 +- .../__snapshots__/3.0.x/v4/default/zod.gen.ts | 9 +- .../3.1.x/mini/default/zod.gen.ts | 12 +- .../__snapshots__/3.1.x/v3/default/zod.gen.ts | 12 +- .../__snapshots__/3.1.x/v4/default/zod.gen.ts | 12 +- packages/openapi-ts/package.json | 2 +- 139 files changed, 3428 insertions(+), 796 deletions(-) create mode 100644 packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/external/index.ts create mode 100644 packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/external/types.gen.ts create mode 100644 packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/external/index.ts create mode 100644 packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/external/types.gen.ts create mode 100644 packages/openapi-ts-tests/specs/2.0.x/external.yaml create mode 100644 packages/openapi-ts-tests/specs/3.0.x/external.yaml diff --git a/packages/openapi-ts-tests/main/test/2.0.x.test.ts b/packages/openapi-ts-tests/main/test/2.0.x.test.ts index 1b532c27b..4be3857bd 100644 --- a/packages/openapi-ts-tests/main/test/2.0.x.test.ts +++ b/packages/openapi-ts-tests/main/test/2.0.x.test.ts @@ -44,6 +44,13 @@ describe(`OpenAPI ${version}`, () => { }; const scenarios = [ + { + config: createConfig({ + input: 'external.yaml', + output: 'external', + }), + description: 'handles external references', + }, { config: createConfig({ input: 'additional-properties-false.json', diff --git a/packages/openapi-ts-tests/main/test/3.0.x.test.ts b/packages/openapi-ts-tests/main/test/3.0.x.test.ts index f97150644..e54398c80 100644 --- a/packages/openapi-ts-tests/main/test/3.0.x.test.ts +++ b/packages/openapi-ts-tests/main/test/3.0.x.test.ts @@ -44,6 +44,13 @@ describe(`OpenAPI ${version}`, () => { }; const scenarios = [ + { + config: createConfig({ + input: 'external.yaml', + output: 'external', + }), + description: 'handles external references', + }, { config: createConfig({ input: 'additional-properties-false.json', diff --git a/packages/openapi-ts-tests/main/test/3.1.x.test.ts b/packages/openapi-ts-tests/main/test/3.1.x.test.ts index 545886a05..b9c467e48 100644 --- a/packages/openapi-ts-tests/main/test/3.1.x.test.ts +++ b/packages/openapi-ts-tests/main/test/3.1.x.test.ts @@ -931,7 +931,6 @@ describe(`OpenAPI ${version}`, () => { ]; it.each(scenarios)('$description', async ({ config }) => { - // it.each([scenarios[0]])('$description', async ({ config }) => { await createClient(config); const outputPath = diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/external/index.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/external/index.ts new file mode 100644 index 000000000..56bade120 --- /dev/null +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/external/index.ts @@ -0,0 +1,2 @@ +// This file is auto-generated by @hey-api/openapi-ts +export * from './types.gen'; \ No newline at end of file diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/external/types.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/external/types.gen.ts new file mode 100644 index 000000000..64b3aee0f --- /dev/null +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/external/types.gen.ts @@ -0,0 +1,394 @@ +// This file is auto-generated by @hey-api/openapi-ts + +export type ExternalSchemaA = ExternalSharedExternalSharedModel; + +export type ExternalSchemaB = ExternalSharedExternalSharedModel; + +export type ExternalSchemaC = ExternalSharedExternalSharedModel; + +export type ExternalSchemaPathA = ExternalSharedExternalSharedModel; + +export type ExternalSchemaPathB = ExternalSharedExternalSharedModel; + +/** + * External schema property (A) + */ +export type ExternalSchemaPropertyA = { + uuid1?: ExternalSharedExternalSharedModelWithUuid; +}; + +/** + * External schema property (B) - second use of UUID + */ +export type ExternalSchemaPropertyB = { + uuid2?: ExternalSharedExternalSharedModelWithUuid; +}; + +/** + * External schema property (C) - third use of UUID + */ +export type ExternalSchemaPropertyC = { + uuid3?: ExternalSharedExternalSharedModelWithUuid; +}; + +/** + * External schema property with duplicate refs (D) + */ +export type ExternalSchemaPropertyD = { + uuid4?: ExternalSharedExternalSharedModelWithUuid; + uuid5?: ExternalSharedExternalSharedModelWithUuid; +}; + +/** + * External schema property via external property ref (id) + */ +export type ExternalSchemaExternalProp = { + id3?: ExternalSharedId; + id4?: ExternalSharedId; +}; + +/** + * Alias to external property via component property ref + */ +export type ExternalSchemaExternalPropAlias = { + id5?: ExternalSharedId; + id6?: ExternalSharedId; +}; + +/** + * External double nested prop via property ref + */ +export type ExternalDoubleNestedProp = { + deep1?: ExternalSharedDeep; + deep2?: ExternalSharedDeep; +}; + +/** + * External double nested numeric properties + */ +export type ExternalDoubleNestedNumeric = { + numeric1?: ExternalShared1; + numeric2?: ExternalShared1; +}; + +export type ExternalNestedObjectA = ExternalSharedExternalNested; + +export type ExternalNestedObjectB = ExternalSharedExternalNested; + +export type ExternalNestedNumericObjectA = ExternalSharedExternalNestedNumeric; + +export type ExternalNestedNumericObjectB = ExternalSharedExternalNestedNumeric; + +/** + * Mixed external property references + */ +export type ExternalMixedProperties = { + id7?: ExternalSharedId; + name1?: ExternalSharedName; + uuid6?: ExternalSharedExternalSharedModelWithUuid; + deep3?: ExternalSharedDeep; + numeric3?: ExternalShared1; +}; + +/** + * Array containing external references + */ +export type ExternalArraySchema = { + items?: Array; + uuidItems?: Array; +}; + +/** + * Union type with external references + */ +export type ExternalUnionSchema = unknown; + +/** + * AllOf with external references + */ +export type ExternalAllOfSchema = ExternalSharedExternalSharedModel & { + additional?: ExternalSharedExternalSharedModelWithUuid; +}; + +/** + * AnyOf with external references + */ +export type ExternalAnyOfSchema = unknown; + +export type ExternalSharedExternalSharedModel = { + id: string; + name?: string; +}; + +export type ExternalSharedExternalSharedModelWithUuid = string; + +export type ExternalSharedExternalNested = { + inner?: { + deep?: string; + }; +}; + +export type ExternalSharedExternalNestedNumeric = { + 0?: { + 1?: string; + }; +}; + +export type ExternalSharedId = string; + +export type ExternalSharedName = string; + +export type ExternalSharedDeep = string; + +export type ExternalShared1 = string; + +export type GetExternalModelData = { + body?: never; + path: { + id: unknown; + }; + query?: { + uuid?: unknown; + }; + url: '/external-model'; +}; + +export type GetExternalModelErrors = { + /** + * Response using external UUID + */ + 400: ExternalSharedExternalSharedModelWithUuid; +}; + +export type GetExternalModelError = GetExternalModelErrors[keyof GetExternalModelErrors]; + +export type GetExternalModelResponses = { + /** + * Response using external model + */ + 200: ExternalSharedExternalSharedModel; +}; + +export type GetExternalModelResponse = GetExternalModelResponses[keyof GetExternalModelResponses]; + +export type PostExternalModelData = { + body?: never; + path?: never; + query?: never; + url: '/external-model'; +}; + +export type PostExternalModelErrors = { + /** + * Response with union of external types + */ + 422: unknown; +}; + +export type PostExternalModelResponses = { + /** + * Response using external model + */ + 201: ExternalSharedExternalSharedModel; +}; + +export type PostExternalModelResponse = PostExternalModelResponses[keyof PostExternalModelResponses]; + +export type GetExternalUuidData = { + body?: never; + path?: never; + query?: { + uuid?: unknown; + }; + url: '/external-uuid'; +}; + +export type GetExternalUuidResponses = { + /** + * Response using external UUID + */ + 200: ExternalSharedExternalSharedModelWithUuid; +}; + +export type GetExternalUuidResponse = GetExternalUuidResponses[keyof GetExternalUuidResponses]; + +export type PutExternalUuidData = { + body?: never; + path?: never; + query?: never; + url: '/external-uuid'; +}; + +export type PutExternalUuidResponses = { + /** + * Response using external UUID + */ + 200: ExternalSharedExternalSharedModelWithUuid; +}; + +export type PutExternalUuidResponse = PutExternalUuidResponses[keyof PutExternalUuidResponses]; + +export type GetExternalNestedData = { + body?: never; + headers?: { + deep?: unknown; + }; + path?: never; + query?: never; + url: '/external-nested'; +}; + +export type GetExternalNestedResponses = { + /** + * Response using external nested object + */ + 200: ExternalSharedExternalNested; +}; + +export type GetExternalNestedResponse = GetExternalNestedResponses[keyof GetExternalNestedResponses]; + +export type PostExternalNestedData = { + body?: never; + path?: never; + query?: never; + url: '/external-nested'; +}; + +export type PostExternalNestedResponses = { + /** + * Response using external nested object + */ + 201: ExternalSharedExternalNested; +}; + +export type PostExternalNestedResponse = PostExternalNestedResponses[keyof PostExternalNestedResponses]; + +export type GetExternalMixedData = { + body?: never; + headers?: { + deep?: unknown; + }; + path: { + id: unknown; + }; + query?: { + uuid?: unknown; + numeric?: unknown; + }; + url: '/external-mixed'; +}; + +export type GetExternalMixedResponses = { + /** + * Response with array of external models + */ + 200: Array; +}; + +export type GetExternalMixedResponse = GetExternalMixedResponses[keyof GetExternalMixedResponses]; + +export type PostExternalMixedData = { + body?: never; + path?: never; + query?: never; + url: '/external-mixed'; +}; + +export type PostExternalMixedResponses = { + /** + * Response using external model + */ + 201: ExternalSharedExternalSharedModel; +}; + +export type PostExternalMixedResponse = PostExternalMixedResponses[keyof PostExternalMixedResponses]; + +export type GetExternalArrayData = { + body?: never; + path?: never; + query?: never; + url: '/external-array'; +}; + +export type GetExternalArrayResponses = { + /** + * Response with array of external models + */ + 200: Array; +}; + +export type GetExternalArrayResponse = GetExternalArrayResponses[keyof GetExternalArrayResponses]; + +export type PostExternalArrayData = { + body?: never; + path?: never; + query?: never; + url: '/external-array'; +}; + +export type PostExternalArrayResponses = { + /** + * Response with array of external models + */ + 201: Array; +}; + +export type PostExternalArrayResponse = PostExternalArrayResponses[keyof PostExternalArrayResponses]; + +export type GetExternalUnionData = { + body?: never; + path?: never; + query?: never; + url: '/external-union'; +}; + +export type GetExternalUnionResponses = { + /** + * Response with union of external types + */ + 200: unknown; +}; + +export type PostExternalUnionData = { + body?: never; + path?: never; + query?: never; + url: '/external-union'; +}; + +export type PostExternalUnionResponses = { + /** + * Response with union of external types + */ + 201: unknown; +}; + +export type GetExternalPropertiesByIdData = { + body?: never; + headers?: { + deep?: unknown; + }; + path: { + id: unknown; + }; + query?: { + uuid?: unknown; + }; + url: '/external-properties/{id}'; +}; + +export type GetExternalPropertiesByIdResponses = { + 200: { + id?: ExternalSharedId; + name?: ExternalSharedName; + uuid?: ExternalSharedExternalSharedModelWithUuid; + deep?: ExternalSharedDeep; + numeric?: ExternalShared1; + }; +}; + +export type GetExternalPropertiesByIdResponse = GetExternalPropertiesByIdResponses[keyof GetExternalPropertiesByIdResponses]; + +export type ClientOptions = { + baseUrl: string; +}; \ No newline at end of file diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/schemas/default/schemas.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/schemas/default/schemas.gen.ts index 466f10c45..76747df49 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/schemas/default/schemas.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/schemas/default/schemas.gen.ts @@ -2,21 +2,12 @@ export const ExternalRefASchema = { description: 'External ref to shared model (A)', - type: 'object', - properties: { - id: { - type: 'string' - }, - name: { - type: 'string' - } - }, - required: ['id'] + '$ref': '#/definitions/external-shared_ExternalSharedModel' } as const; export const ExternalRefBSchema = { description: 'External ref to shared model (B)', - '$ref': '#/definitions/ExternalRefA' + '$ref': '#/definitions/external-shared_ExternalSharedModel' } as const; export const CommentWithBreaksSchema = { @@ -689,6 +680,19 @@ export const failure_FailureSchema = { } } as const; +export const external_shared_ExternalSharedModelSchema = { + type: 'object', + properties: { + id: { + type: 'string' + }, + name: { + type: 'string' + } + }, + required: ['id'] +} as const; + export const ModelWithPropertiesWritableSchema = { description: 'This is a model with one nested property', type: 'object', diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/sdk/default/types.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/sdk/default/types.gen.ts index 1fade89b2..684ac1a41 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/sdk/default/types.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/sdk/default/types.gen.ts @@ -1,14 +1,8 @@ // This file is auto-generated by @hey-api/openapi-ts -/** - * External ref to shared model (A) - */ -export type ExternalRefA = { - id: string; - name?: string; -}; +export type ExternalRefA = ExternalSharedExternalSharedModel; -export type ExternalRefB = ExternalRefA; +export type ExternalRefB = ExternalSharedExternalSharedModel; /** * Testing multiline comments in string: First line @@ -416,6 +410,11 @@ export type FailureFailure = { reference_code?: string; }; +export type ExternalSharedExternalSharedModel = { + id: string; + name?: string; +}; + /** * This is a model with one nested property */ diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/sdk/throwOnError/types.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/sdk/throwOnError/types.gen.ts index 1fade89b2..684ac1a41 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/sdk/throwOnError/types.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/sdk/throwOnError/types.gen.ts @@ -1,14 +1,8 @@ // This file is auto-generated by @hey-api/openapi-ts -/** - * External ref to shared model (A) - */ -export type ExternalRefA = { - id: string; - name?: string; -}; +export type ExternalRefA = ExternalSharedExternalSharedModel; -export type ExternalRefB = ExternalRefA; +export type ExternalRefB = ExternalSharedExternalSharedModel; /** * Testing multiline comments in string: First line @@ -416,6 +410,11 @@ export type FailureFailure = { reference_code?: string; }; +export type ExternalSharedExternalSharedModel = { + id: string; + name?: string; +}; + /** * This is a model with one nested property */ diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@pinia/colada/fetch/types.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@pinia/colada/fetch/types.gen.ts index 1fade89b2..684ac1a41 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@pinia/colada/fetch/types.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@pinia/colada/fetch/types.gen.ts @@ -1,14 +1,8 @@ // This file is auto-generated by @hey-api/openapi-ts -/** - * External ref to shared model (A) - */ -export type ExternalRefA = { - id: string; - name?: string; -}; +export type ExternalRefA = ExternalSharedExternalSharedModel; -export type ExternalRefB = ExternalRefA; +export type ExternalRefB = ExternalSharedExternalSharedModel; /** * Testing multiline comments in string: First line @@ -416,6 +410,11 @@ export type FailureFailure = { reference_code?: string; }; +export type ExternalSharedExternalSharedModel = { + id: string; + name?: string; +}; + /** * This is a model with one nested property */ diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@pinia/colada/group-by-tag/types.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@pinia/colada/group-by-tag/types.gen.ts index 1fade89b2..684ac1a41 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@pinia/colada/group-by-tag/types.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@pinia/colada/group-by-tag/types.gen.ts @@ -1,14 +1,8 @@ // This file is auto-generated by @hey-api/openapi-ts -/** - * External ref to shared model (A) - */ -export type ExternalRefA = { - id: string; - name?: string; -}; +export type ExternalRefA = ExternalSharedExternalSharedModel; -export type ExternalRefB = ExternalRefA; +export type ExternalRefB = ExternalSharedExternalSharedModel; /** * Testing multiline comments in string: First line @@ -416,6 +410,11 @@ export type FailureFailure = { reference_code?: string; }; +export type ExternalSharedExternalSharedModel = { + id: string; + name?: string; +}; + /** * This is a model with one nested property */ diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/axios/types.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/axios/types.gen.ts index 4a1834d8b..46ba1097d 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/axios/types.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/axios/types.gen.ts @@ -1,14 +1,8 @@ // This file is auto-generated by @hey-api/openapi-ts -/** - * External ref to shared model (A) - */ -export type ExternalRefA = { - id: string; - name?: string; -}; +export type ExternalRefA = ExternalSharedExternalSharedModel; -export type ExternalRefB = ExternalRefA; +export type ExternalRefB = ExternalSharedExternalSharedModel; /** * Testing multiline comments in string: First line @@ -416,6 +410,11 @@ export type FailureFailure = { reference_code?: string; }; +export type ExternalSharedExternalSharedModel = { + id: string; + name?: string; +}; + /** * This is a model with one nested property */ diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/fetch/types.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/fetch/types.gen.ts index 1fade89b2..684ac1a41 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/fetch/types.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/fetch/types.gen.ts @@ -1,14 +1,8 @@ // This file is auto-generated by @hey-api/openapi-ts -/** - * External ref to shared model (A) - */ -export type ExternalRefA = { - id: string; - name?: string; -}; +export type ExternalRefA = ExternalSharedExternalSharedModel; -export type ExternalRefB = ExternalRefA; +export type ExternalRefB = ExternalSharedExternalSharedModel; /** * Testing multiline comments in string: First line @@ -416,6 +410,11 @@ export type FailureFailure = { reference_code?: string; }; +export type ExternalSharedExternalSharedModel = { + id: string; + name?: string; +}; + /** * This is a model with one nested property */ diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/react-query/axios/types.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/react-query/axios/types.gen.ts index 4a1834d8b..46ba1097d 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/react-query/axios/types.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/react-query/axios/types.gen.ts @@ -1,14 +1,8 @@ // This file is auto-generated by @hey-api/openapi-ts -/** - * External ref to shared model (A) - */ -export type ExternalRefA = { - id: string; - name?: string; -}; +export type ExternalRefA = ExternalSharedExternalSharedModel; -export type ExternalRefB = ExternalRefA; +export type ExternalRefB = ExternalSharedExternalSharedModel; /** * Testing multiline comments in string: First line @@ -416,6 +410,11 @@ export type FailureFailure = { reference_code?: string; }; +export type ExternalSharedExternalSharedModel = { + id: string; + name?: string; +}; + /** * This is a model with one nested property */ diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/react-query/fetch/types.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/react-query/fetch/types.gen.ts index 1fade89b2..684ac1a41 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/react-query/fetch/types.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/react-query/fetch/types.gen.ts @@ -1,14 +1,8 @@ // This file is auto-generated by @hey-api/openapi-ts -/** - * External ref to shared model (A) - */ -export type ExternalRefA = { - id: string; - name?: string; -}; +export type ExternalRefA = ExternalSharedExternalSharedModel; -export type ExternalRefB = ExternalRefA; +export type ExternalRefB = ExternalSharedExternalSharedModel; /** * Testing multiline comments in string: First line @@ -416,6 +410,11 @@ export type FailureFailure = { reference_code?: string; }; +export type ExternalSharedExternalSharedModel = { + id: string; + name?: string; +}; + /** * This is a model with one nested property */ diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/solid-query/axios/types.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/solid-query/axios/types.gen.ts index 4a1834d8b..46ba1097d 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/solid-query/axios/types.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/solid-query/axios/types.gen.ts @@ -1,14 +1,8 @@ // This file is auto-generated by @hey-api/openapi-ts -/** - * External ref to shared model (A) - */ -export type ExternalRefA = { - id: string; - name?: string; -}; +export type ExternalRefA = ExternalSharedExternalSharedModel; -export type ExternalRefB = ExternalRefA; +export type ExternalRefB = ExternalSharedExternalSharedModel; /** * Testing multiline comments in string: First line @@ -416,6 +410,11 @@ export type FailureFailure = { reference_code?: string; }; +export type ExternalSharedExternalSharedModel = { + id: string; + name?: string; +}; + /** * This is a model with one nested property */ diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/solid-query/fetch/types.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/solid-query/fetch/types.gen.ts index 1fade89b2..684ac1a41 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/solid-query/fetch/types.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/solid-query/fetch/types.gen.ts @@ -1,14 +1,8 @@ // This file is auto-generated by @hey-api/openapi-ts -/** - * External ref to shared model (A) - */ -export type ExternalRefA = { - id: string; - name?: string; -}; +export type ExternalRefA = ExternalSharedExternalSharedModel; -export type ExternalRefB = ExternalRefA; +export type ExternalRefB = ExternalSharedExternalSharedModel; /** * Testing multiline comments in string: First line @@ -416,6 +410,11 @@ export type FailureFailure = { reference_code?: string; }; +export type ExternalSharedExternalSharedModel = { + id: string; + name?: string; +}; + /** * This is a model with one nested property */ diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/svelte-query/axios/types.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/svelte-query/axios/types.gen.ts index 4a1834d8b..46ba1097d 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/svelte-query/axios/types.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/svelte-query/axios/types.gen.ts @@ -1,14 +1,8 @@ // This file is auto-generated by @hey-api/openapi-ts -/** - * External ref to shared model (A) - */ -export type ExternalRefA = { - id: string; - name?: string; -}; +export type ExternalRefA = ExternalSharedExternalSharedModel; -export type ExternalRefB = ExternalRefA; +export type ExternalRefB = ExternalSharedExternalSharedModel; /** * Testing multiline comments in string: First line @@ -416,6 +410,11 @@ export type FailureFailure = { reference_code?: string; }; +export type ExternalSharedExternalSharedModel = { + id: string; + name?: string; +}; + /** * This is a model with one nested property */ diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/svelte-query/fetch/types.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/svelte-query/fetch/types.gen.ts index 1fade89b2..684ac1a41 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/svelte-query/fetch/types.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/svelte-query/fetch/types.gen.ts @@ -1,14 +1,8 @@ // This file is auto-generated by @hey-api/openapi-ts -/** - * External ref to shared model (A) - */ -export type ExternalRefA = { - id: string; - name?: string; -}; +export type ExternalRefA = ExternalSharedExternalSharedModel; -export type ExternalRefB = ExternalRefA; +export type ExternalRefB = ExternalSharedExternalSharedModel; /** * Testing multiline comments in string: First line @@ -416,6 +410,11 @@ export type FailureFailure = { reference_code?: string; }; +export type ExternalSharedExternalSharedModel = { + id: string; + name?: string; +}; + /** * This is a model with one nested property */ diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/vue-query/axios/types.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/vue-query/axios/types.gen.ts index 4a1834d8b..46ba1097d 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/vue-query/axios/types.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/vue-query/axios/types.gen.ts @@ -1,14 +1,8 @@ // This file is auto-generated by @hey-api/openapi-ts -/** - * External ref to shared model (A) - */ -export type ExternalRefA = { - id: string; - name?: string; -}; +export type ExternalRefA = ExternalSharedExternalSharedModel; -export type ExternalRefB = ExternalRefA; +export type ExternalRefB = ExternalSharedExternalSharedModel; /** * Testing multiline comments in string: First line @@ -416,6 +410,11 @@ export type FailureFailure = { reference_code?: string; }; +export type ExternalSharedExternalSharedModel = { + id: string; + name?: string; +}; + /** * This is a model with one nested property */ diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/vue-query/fetch/types.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/vue-query/fetch/types.gen.ts index 1fade89b2..684ac1a41 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/vue-query/fetch/types.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/vue-query/fetch/types.gen.ts @@ -1,14 +1,8 @@ // This file is auto-generated by @hey-api/openapi-ts -/** - * External ref to shared model (A) - */ -export type ExternalRefA = { - id: string; - name?: string; -}; +export type ExternalRefA = ExternalSharedExternalSharedModel; -export type ExternalRefB = ExternalRefA; +export type ExternalRefB = ExternalSharedExternalSharedModel; /** * Testing multiline comments in string: First line @@ -416,6 +410,11 @@ export type FailureFailure = { reference_code?: string; }; +export type ExternalSharedExternalSharedModel = { + id: string; + name?: string; +}; + /** * This is a model with one nested property */ diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/fastify/default/types.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/fastify/default/types.gen.ts index 1fade89b2..684ac1a41 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/fastify/default/types.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/fastify/default/types.gen.ts @@ -1,14 +1,8 @@ // This file is auto-generated by @hey-api/openapi-ts -/** - * External ref to shared model (A) - */ -export type ExternalRefA = { - id: string; - name?: string; -}; +export type ExternalRefA = ExternalSharedExternalSharedModel; -export type ExternalRefB = ExternalRefA; +export type ExternalRefB = ExternalSharedExternalSharedModel; /** * Testing multiline comments in string: First line @@ -416,6 +410,11 @@ export type FailureFailure = { reference_code?: string; }; +export type ExternalSharedExternalSharedModel = { + id: string; + name?: string; +}; + /** * This is a model with one nested property */ diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/valibot/default/valibot.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/valibot/default/valibot.gen.ts index b9012d647..12d1659a1 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/valibot/default/valibot.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/valibot/default/valibot.gen.ts @@ -2,15 +2,14 @@ import * as v from 'valibot'; -/** - * External ref to shared model (A) - */ -export const vExternalRefA = v.object({ +export const vExternalSharedExternalSharedModel = v.object({ id: v.string(), name: v.optional(v.string()) }); -export const vExternalRefB = vExternalRefA; +export const vExternalRefA = vExternalSharedExternalSharedModel; + +export const vExternalRefB = vExternalSharedExternalSharedModel; /** * Testing multiline comments in string: First line diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/external/index.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/external/index.ts new file mode 100644 index 000000000..56bade120 --- /dev/null +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/external/index.ts @@ -0,0 +1,2 @@ +// This file is auto-generated by @hey-api/openapi-ts +export * from './types.gen'; \ No newline at end of file diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/external/types.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/external/types.gen.ts new file mode 100644 index 000000000..1e31fd7d4 --- /dev/null +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/external/types.gen.ts @@ -0,0 +1,436 @@ +// This file is auto-generated by @hey-api/openapi-ts + +export type ExternalSchemaA = ExternalSharedExternalSharedModel; + +export type ExternalSchemaB = ExternalSharedExternalSharedModel; + +export type ExternalSchemaC = ExternalSharedExternalSharedModel; + +export type ExternalSchemaPathA = ExternalSharedExternalSharedModel; + +export type ExternalSchemaPathB = ExternalSharedExternalSharedModel; + +/** + * External schema property (A) + */ +export type ExternalSchemaPropertyA = { + uuid1?: ExternalSharedExternalSharedModelWithUuid; +}; + +/** + * External schema property (B) - second use of UUID + */ +export type ExternalSchemaPropertyB = { + uuid2?: ExternalSharedExternalSharedModelWithUuid; +}; + +/** + * External schema property (C) - third use of UUID + */ +export type ExternalSchemaPropertyC = { + uuid3?: ExternalSharedExternalSharedModelWithUuid; +}; + +/** + * External schema property with duplicate refs (D) + */ +export type ExternalSchemaPropertyD = { + uuid4?: ExternalSharedExternalSharedModelWithUuid; + uuid5?: ExternalSharedExternalSharedModelWithUuid; +}; + +/** + * External schema property via external property ref (id) + */ +export type ExternalSchemaExternalProp = { + id3?: ExternalSharedId; + id4?: ExternalSharedId; +}; + +/** + * Alias to external property via component property ref + */ +export type ExternalSchemaExternalPropAlias = { + id5?: ExternalSharedId; + id6?: ExternalSharedId; +}; + +/** + * External double nested prop via property ref + */ +export type ExternalDoubleNestedProp = { + deep1?: ExternalSharedDeep; + deep2?: ExternalSharedDeep; +}; + +/** + * External double nested numeric properties + */ +export type ExternalDoubleNestedNumeric = { + numeric1?: ExternalShared1; + numeric2?: ExternalShared1; +}; + +export type ExternalNestedObjectA = ExternalSharedExternalNested; + +export type ExternalNestedObjectB = ExternalSharedExternalNested; + +export type ExternalNestedNumericObjectA = ExternalSharedExternalNestedNumeric; + +export type ExternalNestedNumericObjectB = ExternalSharedExternalNestedNumeric; + +/** + * Mixed external property references + */ +export type ExternalMixedProperties = { + id7?: ExternalSharedId; + name1?: ExternalSharedName; + uuid6?: ExternalSharedExternalSharedModelWithUuid; + deep3?: ExternalSharedDeep; + numeric3?: ExternalShared1; +}; + +/** + * Array containing external references + */ +export type ExternalArraySchema = { + items?: Array; + uuidItems?: Array; +}; + +/** + * Union type with external references + */ +export type ExternalUnionSchema = ExternalSharedExternalSharedModel | ExternalSharedExternalSharedModelWithUuid; + +/** + * AllOf with external references + */ +export type ExternalAllOfSchema = ExternalSharedExternalSharedModel & { + additional?: ExternalSharedExternalSharedModelWithUuid; +}; + +/** + * AnyOf with external references + */ +export type ExternalAnyOfSchema = ExternalSharedExternalNested | ExternalSharedExternalNestedNumeric; + +export type ExternalSharedExternalSharedModelWithUuid = string; + +export type ExternalSharedExternalSharedModel = { + id: string; + name?: string; +}; + +export type ExternalSharedId = string; + +export type ExternalSharedExternalNested = { + inner?: { + deep?: string; + }; +}; + +export type ExternalSharedDeep = string; + +export type ExternalShared1 = string; + +export type ExternalSharedName = string; + +export type ExternalSharedExternalNestedNumeric = { + 0?: { + 1?: string; + }; +}; + +export type ExternalIdParam = ExternalSharedId; + +export type ExternalUuidParam = ExternalSharedExternalSharedModelWithUuid; + +export type ExternalDeepParam = ExternalSharedDeep; + +export type ExternalNumericParam = ExternalShared1; + +export type ExternalModelBody = ExternalSharedExternalSharedModel; + +export type ExternalUuidBody = ExternalSharedExternalSharedModelWithUuid; + +export type ExternalNestedBody = ExternalSharedExternalNested; + +/** + * Request body with mixed external properties + */ +export type ExternalMixedBody = { + id?: ExternalSharedId; + name?: ExternalSharedName; + uuid?: ExternalSharedExternalSharedModelWithUuid; + deep?: ExternalSharedDeep; +}; + +export type GetExternalModelData = { + body?: never; + path: { + id: ExternalSharedId; + }; + query?: { + uuid?: ExternalSharedExternalSharedModelWithUuid; + }; + url: '/external-model'; +}; + +export type GetExternalModelErrors = { + /** + * Response using external UUID + */ + 400: ExternalSharedExternalSharedModelWithUuid; +}; + +export type GetExternalModelError = GetExternalModelErrors[keyof GetExternalModelErrors]; + +export type GetExternalModelResponses = { + /** + * Response using external model + */ + 200: ExternalSharedExternalSharedModel; +}; + +export type GetExternalModelResponse = GetExternalModelResponses[keyof GetExternalModelResponses]; + +export type PostExternalModelData = { + /** + * Request body using external model + */ + body: ExternalModelBody; + path?: never; + query?: never; + url: '/external-model'; +}; + +export type PostExternalModelErrors = { + /** + * Response with union of external types + */ + 422: ExternalSharedExternalSharedModel | ExternalSharedExternalSharedModelWithUuid | ExternalSharedExternalNested; +}; + +export type PostExternalModelError = PostExternalModelErrors[keyof PostExternalModelErrors]; + +export type PostExternalModelResponses = { + /** + * Response using external model + */ + 201: ExternalSharedExternalSharedModel; +}; + +export type PostExternalModelResponse = PostExternalModelResponses[keyof PostExternalModelResponses]; + +export type GetExternalUuidData = { + body?: never; + path?: never; + query?: { + uuid?: ExternalSharedExternalSharedModelWithUuid; + }; + url: '/external-uuid'; +}; + +export type GetExternalUuidResponses = { + /** + * Response using external UUID + */ + 200: ExternalSharedExternalSharedModelWithUuid; +}; + +export type GetExternalUuidResponse = GetExternalUuidResponses[keyof GetExternalUuidResponses]; + +export type PutExternalUuidData = { + /** + * Request body using external UUID + */ + body?: ExternalUuidBody; + path?: never; + query?: never; + url: '/external-uuid'; +}; + +export type PutExternalUuidResponses = { + /** + * Response using external UUID + */ + 200: ExternalSharedExternalSharedModelWithUuid; +}; + +export type PutExternalUuidResponse = PutExternalUuidResponses[keyof PutExternalUuidResponses]; + +export type GetExternalNestedData = { + body?: never; + headers?: { + deep?: ExternalSharedDeep; + }; + path?: never; + query?: never; + url: '/external-nested'; +}; + +export type GetExternalNestedResponses = { + /** + * Response using external nested object + */ + 200: ExternalSharedExternalNested; +}; + +export type GetExternalNestedResponse = GetExternalNestedResponses[keyof GetExternalNestedResponses]; + +export type PostExternalNestedData = { + /** + * Request body using external nested object + */ + body?: ExternalNestedBody; + path?: never; + query?: never; + url: '/external-nested'; +}; + +export type PostExternalNestedResponses = { + /** + * Response using external nested object + */ + 201: ExternalSharedExternalNested; +}; + +export type PostExternalNestedResponse = PostExternalNestedResponses[keyof PostExternalNestedResponses]; + +export type GetExternalMixedData = { + body?: never; + headers?: { + deep?: ExternalSharedDeep; + }; + path: { + id: ExternalSharedId; + }; + query?: { + uuid?: ExternalSharedExternalSharedModelWithUuid; + numeric?: ExternalShared1; + }; + url: '/external-mixed'; +}; + +export type GetExternalMixedResponses = { + /** + * Response with array of external models + */ + 200: Array; +}; + +export type GetExternalMixedResponse = GetExternalMixedResponses[keyof GetExternalMixedResponses]; + +export type PostExternalMixedData = { + /** + * Request body with mixed external properties + */ + body?: ExternalMixedBody; + path?: never; + query?: never; + url: '/external-mixed'; +}; + +export type PostExternalMixedResponses = { + /** + * Response using external model + */ + 201: ExternalSharedExternalSharedModel; +}; + +export type PostExternalMixedResponse = PostExternalMixedResponses[keyof PostExternalMixedResponses]; + +export type GetExternalArrayData = { + body?: never; + path?: never; + query?: never; + url: '/external-array'; +}; + +export type GetExternalArrayResponses = { + /** + * Response with array of external models + */ + 200: Array; +}; + +export type GetExternalArrayResponse = GetExternalArrayResponses[keyof GetExternalArrayResponses]; + +export type PostExternalArrayData = { + body: Array; + path?: never; + query?: never; + url: '/external-array'; +}; + +export type PostExternalArrayResponses = { + /** + * Response with array of external models + */ + 201: Array; +}; + +export type PostExternalArrayResponse = PostExternalArrayResponses[keyof PostExternalArrayResponses]; + +export type GetExternalUnionData = { + body?: never; + path?: never; + query?: never; + url: '/external-union'; +}; + +export type GetExternalUnionResponses = { + /** + * Response with union of external types + */ + 200: ExternalSharedExternalSharedModel | ExternalSharedExternalSharedModelWithUuid | ExternalSharedExternalNested; +}; + +export type GetExternalUnionResponse = GetExternalUnionResponses[keyof GetExternalUnionResponses]; + +export type PostExternalUnionData = { + body: ExternalSharedExternalSharedModel | ExternalSharedExternalSharedModelWithUuid | ExternalSharedExternalNested; + path?: never; + query?: never; + url: '/external-union'; +}; + +export type PostExternalUnionResponses = { + /** + * Response with union of external types + */ + 201: ExternalSharedExternalSharedModel | ExternalSharedExternalSharedModelWithUuid | ExternalSharedExternalNested; +}; + +export type PostExternalUnionResponse = PostExternalUnionResponses[keyof PostExternalUnionResponses]; + +export type GetExternalPropertiesByIdData = { + body?: never; + headers?: { + deep?: ExternalSharedDeep; + }; + path: { + id: ExternalSharedId; + }; + query?: { + uuid?: ExternalSharedExternalSharedModelWithUuid; + }; + url: '/external-properties/{id}'; +}; + +export type GetExternalPropertiesByIdResponses = { + 200: { + id?: ExternalSharedId; + name?: ExternalSharedName; + uuid?: ExternalSharedExternalSharedModelWithUuid; + deep?: ExternalSharedDeep; + numeric?: ExternalShared1; + }; +}; + +export type GetExternalPropertiesByIdResponse = GetExternalPropertiesByIdResponses[keyof GetExternalPropertiesByIdResponses]; + +export type ClientOptions = { + baseUrl: `${string}://${string}` | (string & {}); +}; \ No newline at end of file diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/schemas/default/schemas.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/schemas/default/schemas.gen.ts index f2b3eaf05..5df1a0451 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/schemas/default/schemas.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/schemas/default/schemas.gen.ts @@ -7,21 +7,12 @@ export const _400Schema = { export const ExternalRefASchema = { description: 'External ref to shared model (A)', - type: 'object', - properties: { - id: { - type: 'string' - }, - name: { - type: 'string' - } - }, - required: ['id'] + '$ref': '#/components/schemas/external-shared_ExternalSharedModel' } as const; export const ExternalRefBSchema = { description: 'External ref to shared model (B)', - '$ref': '#/components/schemas/ExternalRefA' + '$ref': '#/components/schemas/external-shared_ExternalSharedModel' } as const; export const camelCaseCommentWithBreaksSchema = { @@ -1999,6 +1990,19 @@ export const Generic_Schema_Duplicate_Issue_1_System_String_Schema = { additionalProperties: false } as const; +export const external_shared_ExternalSharedModelSchema = { + type: 'object', + properties: { + id: { + type: 'string' + }, + name: { + type: 'string' + } + }, + required: ['id'] +} as const; + export const ModelWithPropertiesWritableSchema = { description: 'This is a model with one nested property', type: 'object', diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/sdk/default/types.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/sdk/default/types.gen.ts index 39d454abb..904b69fed 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/sdk/default/types.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/sdk/default/types.gen.ts @@ -5,15 +5,9 @@ */ export type _400 = string; -/** - * External ref to shared model (A) - */ -export type ExternalRefA = { - id: string; - name?: string; -}; +export type ExternalRefA = ExternalSharedExternalSharedModel; -export type ExternalRefB = ExternalRefA; +export type ExternalRefB = ExternalSharedExternalSharedModel; /** * Testing multiline comments in string: First line @@ -964,6 +958,11 @@ export type GenericSchemaDuplicateIssue1SystemString = { readonly hasError?: boolean; }; +export type ExternalSharedExternalSharedModel = { + id: string; + name?: string; +}; + /** * This is a model with one nested property */ diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/sdk/throwOnError/types.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/sdk/throwOnError/types.gen.ts index 39d454abb..904b69fed 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/sdk/throwOnError/types.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/sdk/throwOnError/types.gen.ts @@ -5,15 +5,9 @@ */ export type _400 = string; -/** - * External ref to shared model (A) - */ -export type ExternalRefA = { - id: string; - name?: string; -}; +export type ExternalRefA = ExternalSharedExternalSharedModel; -export type ExternalRefB = ExternalRefA; +export type ExternalRefB = ExternalSharedExternalSharedModel; /** * Testing multiline comments in string: First line @@ -964,6 +958,11 @@ export type GenericSchemaDuplicateIssue1SystemString = { readonly hasError?: boolean; }; +export type ExternalSharedExternalSharedModel = { + id: string; + name?: string; +}; + /** * This is a model with one nested property */ diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@pinia/colada/fetch/types.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@pinia/colada/fetch/types.gen.ts index 39d454abb..904b69fed 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@pinia/colada/fetch/types.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@pinia/colada/fetch/types.gen.ts @@ -5,15 +5,9 @@ */ export type _400 = string; -/** - * External ref to shared model (A) - */ -export type ExternalRefA = { - id: string; - name?: string; -}; +export type ExternalRefA = ExternalSharedExternalSharedModel; -export type ExternalRefB = ExternalRefA; +export type ExternalRefB = ExternalSharedExternalSharedModel; /** * Testing multiline comments in string: First line @@ -964,6 +958,11 @@ export type GenericSchemaDuplicateIssue1SystemString = { readonly hasError?: boolean; }; +export type ExternalSharedExternalSharedModel = { + id: string; + name?: string; +}; + /** * This is a model with one nested property */ diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@pinia/colada/group-by-tag/types.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@pinia/colada/group-by-tag/types.gen.ts index 39d454abb..904b69fed 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@pinia/colada/group-by-tag/types.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@pinia/colada/group-by-tag/types.gen.ts @@ -5,15 +5,9 @@ */ export type _400 = string; -/** - * External ref to shared model (A) - */ -export type ExternalRefA = { - id: string; - name?: string; -}; +export type ExternalRefA = ExternalSharedExternalSharedModel; -export type ExternalRefB = ExternalRefA; +export type ExternalRefB = ExternalSharedExternalSharedModel; /** * Testing multiline comments in string: First line @@ -964,6 +958,11 @@ export type GenericSchemaDuplicateIssue1SystemString = { readonly hasError?: boolean; }; +export type ExternalSharedExternalSharedModel = { + id: string; + name?: string; +}; + /** * This is a model with one nested property */ diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/angular-query-experimental/axios/types.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/angular-query-experimental/axios/types.gen.ts index 6ea52c4b7..4c6990e2b 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/angular-query-experimental/axios/types.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/angular-query-experimental/axios/types.gen.ts @@ -5,15 +5,9 @@ */ export type _400 = string; -/** - * External ref to shared model (A) - */ -export type ExternalRefA = { - id: string; - name?: string; -}; +export type ExternalRefA = ExternalSharedExternalSharedModel; -export type ExternalRefB = ExternalRefA; +export type ExternalRefB = ExternalSharedExternalSharedModel; /** * Testing multiline comments in string: First line @@ -964,6 +958,11 @@ export type GenericSchemaDuplicateIssue1SystemString = { readonly hasError?: boolean; }; +export type ExternalSharedExternalSharedModel = { + id: string; + name?: string; +}; + /** * This is a model with one nested property */ diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/angular-query-experimental/fetch/types.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/angular-query-experimental/fetch/types.gen.ts index 39d454abb..904b69fed 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/angular-query-experimental/fetch/types.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/angular-query-experimental/fetch/types.gen.ts @@ -5,15 +5,9 @@ */ export type _400 = string; -/** - * External ref to shared model (A) - */ -export type ExternalRefA = { - id: string; - name?: string; -}; +export type ExternalRefA = ExternalSharedExternalSharedModel; -export type ExternalRefB = ExternalRefA; +export type ExternalRefB = ExternalSharedExternalSharedModel; /** * Testing multiline comments in string: First line @@ -964,6 +958,11 @@ export type GenericSchemaDuplicateIssue1SystemString = { readonly hasError?: boolean; }; +export type ExternalSharedExternalSharedModel = { + id: string; + name?: string; +}; + /** * This is a model with one nested property */ diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/react-query/axios/types.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/react-query/axios/types.gen.ts index 6ea52c4b7..4c6990e2b 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/react-query/axios/types.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/react-query/axios/types.gen.ts @@ -5,15 +5,9 @@ */ export type _400 = string; -/** - * External ref to shared model (A) - */ -export type ExternalRefA = { - id: string; - name?: string; -}; +export type ExternalRefA = ExternalSharedExternalSharedModel; -export type ExternalRefB = ExternalRefA; +export type ExternalRefB = ExternalSharedExternalSharedModel; /** * Testing multiline comments in string: First line @@ -964,6 +958,11 @@ export type GenericSchemaDuplicateIssue1SystemString = { readonly hasError?: boolean; }; +export type ExternalSharedExternalSharedModel = { + id: string; + name?: string; +}; + /** * This is a model with one nested property */ diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/react-query/fetch/types.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/react-query/fetch/types.gen.ts index 39d454abb..904b69fed 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/react-query/fetch/types.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/react-query/fetch/types.gen.ts @@ -5,15 +5,9 @@ */ export type _400 = string; -/** - * External ref to shared model (A) - */ -export type ExternalRefA = { - id: string; - name?: string; -}; +export type ExternalRefA = ExternalSharedExternalSharedModel; -export type ExternalRefB = ExternalRefA; +export type ExternalRefB = ExternalSharedExternalSharedModel; /** * Testing multiline comments in string: First line @@ -964,6 +958,11 @@ export type GenericSchemaDuplicateIssue1SystemString = { readonly hasError?: boolean; }; +export type ExternalSharedExternalSharedModel = { + id: string; + name?: string; +}; + /** * This is a model with one nested property */ diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/solid-query/axios/types.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/solid-query/axios/types.gen.ts index 6ea52c4b7..4c6990e2b 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/solid-query/axios/types.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/solid-query/axios/types.gen.ts @@ -5,15 +5,9 @@ */ export type _400 = string; -/** - * External ref to shared model (A) - */ -export type ExternalRefA = { - id: string; - name?: string; -}; +export type ExternalRefA = ExternalSharedExternalSharedModel; -export type ExternalRefB = ExternalRefA; +export type ExternalRefB = ExternalSharedExternalSharedModel; /** * Testing multiline comments in string: First line @@ -964,6 +958,11 @@ export type GenericSchemaDuplicateIssue1SystemString = { readonly hasError?: boolean; }; +export type ExternalSharedExternalSharedModel = { + id: string; + name?: string; +}; + /** * This is a model with one nested property */ diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/solid-query/fetch/types.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/solid-query/fetch/types.gen.ts index 39d454abb..904b69fed 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/solid-query/fetch/types.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/solid-query/fetch/types.gen.ts @@ -5,15 +5,9 @@ */ export type _400 = string; -/** - * External ref to shared model (A) - */ -export type ExternalRefA = { - id: string; - name?: string; -}; +export type ExternalRefA = ExternalSharedExternalSharedModel; -export type ExternalRefB = ExternalRefA; +export type ExternalRefB = ExternalSharedExternalSharedModel; /** * Testing multiline comments in string: First line @@ -964,6 +958,11 @@ export type GenericSchemaDuplicateIssue1SystemString = { readonly hasError?: boolean; }; +export type ExternalSharedExternalSharedModel = { + id: string; + name?: string; +}; + /** * This is a model with one nested property */ diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/svelte-query/axios/types.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/svelte-query/axios/types.gen.ts index 6ea52c4b7..4c6990e2b 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/svelte-query/axios/types.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/svelte-query/axios/types.gen.ts @@ -5,15 +5,9 @@ */ export type _400 = string; -/** - * External ref to shared model (A) - */ -export type ExternalRefA = { - id: string; - name?: string; -}; +export type ExternalRefA = ExternalSharedExternalSharedModel; -export type ExternalRefB = ExternalRefA; +export type ExternalRefB = ExternalSharedExternalSharedModel; /** * Testing multiline comments in string: First line @@ -964,6 +958,11 @@ export type GenericSchemaDuplicateIssue1SystemString = { readonly hasError?: boolean; }; +export type ExternalSharedExternalSharedModel = { + id: string; + name?: string; +}; + /** * This is a model with one nested property */ diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/svelte-query/fetch/types.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/svelte-query/fetch/types.gen.ts index 39d454abb..904b69fed 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/svelte-query/fetch/types.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/svelte-query/fetch/types.gen.ts @@ -5,15 +5,9 @@ */ export type _400 = string; -/** - * External ref to shared model (A) - */ -export type ExternalRefA = { - id: string; - name?: string; -}; +export type ExternalRefA = ExternalSharedExternalSharedModel; -export type ExternalRefB = ExternalRefA; +export type ExternalRefB = ExternalSharedExternalSharedModel; /** * Testing multiline comments in string: First line @@ -964,6 +958,11 @@ export type GenericSchemaDuplicateIssue1SystemString = { readonly hasError?: boolean; }; +export type ExternalSharedExternalSharedModel = { + id: string; + name?: string; +}; + /** * This is a model with one nested property */ diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/vue-query/axios/types.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/vue-query/axios/types.gen.ts index 6ea52c4b7..4c6990e2b 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/vue-query/axios/types.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/vue-query/axios/types.gen.ts @@ -5,15 +5,9 @@ */ export type _400 = string; -/** - * External ref to shared model (A) - */ -export type ExternalRefA = { - id: string; - name?: string; -}; +export type ExternalRefA = ExternalSharedExternalSharedModel; -export type ExternalRefB = ExternalRefA; +export type ExternalRefB = ExternalSharedExternalSharedModel; /** * Testing multiline comments in string: First line @@ -964,6 +958,11 @@ export type GenericSchemaDuplicateIssue1SystemString = { readonly hasError?: boolean; }; +export type ExternalSharedExternalSharedModel = { + id: string; + name?: string; +}; + /** * This is a model with one nested property */ diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/vue-query/fetch/types.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/vue-query/fetch/types.gen.ts index 39d454abb..904b69fed 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/vue-query/fetch/types.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/vue-query/fetch/types.gen.ts @@ -5,15 +5,9 @@ */ export type _400 = string; -/** - * External ref to shared model (A) - */ -export type ExternalRefA = { - id: string; - name?: string; -}; +export type ExternalRefA = ExternalSharedExternalSharedModel; -export type ExternalRefB = ExternalRefA; +export type ExternalRefB = ExternalSharedExternalSharedModel; /** * Testing multiline comments in string: First line @@ -964,6 +958,11 @@ export type GenericSchemaDuplicateIssue1SystemString = { readonly hasError?: boolean; }; +export type ExternalSharedExternalSharedModel = { + id: string; + name?: string; +}; + /** * This is a model with one nested property */ diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/fastify/default/types.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/fastify/default/types.gen.ts index 39d454abb..904b69fed 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/fastify/default/types.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/fastify/default/types.gen.ts @@ -5,15 +5,9 @@ */ export type _400 = string; -/** - * External ref to shared model (A) - */ -export type ExternalRefA = { - id: string; - name?: string; -}; +export type ExternalRefA = ExternalSharedExternalSharedModel; -export type ExternalRefB = ExternalRefA; +export type ExternalRefB = ExternalSharedExternalSharedModel; /** * Testing multiline comments in string: First line @@ -964,6 +958,11 @@ export type GenericSchemaDuplicateIssue1SystemString = { readonly hasError?: boolean; }; +export type ExternalSharedExternalSharedModel = { + id: string; + name?: string; +}; + /** * This is a model with one nested property */ diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/valibot/default/valibot.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/valibot/default/valibot.gen.ts index 26915de12..63ae37c0e 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/valibot/default/valibot.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/valibot/default/valibot.gen.ts @@ -7,15 +7,14 @@ import * as v from 'valibot'; */ export const v400 = v.string(); -/** - * External ref to shared model (A) - */ -export const vExternalRefA = v.object({ +export const vExternalSharedExternalSharedModel = v.object({ id: v.string(), name: v.optional(v.string()) }); -export const vExternalRefB = vExternalRefA; +export const vExternalRefA = vExternalSharedExternalSharedModel; + +export const vExternalRefB = vExternalSharedExternalSharedModel; /** * Testing multiline comments in string: First line diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/base-url-false/types.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/base-url-false/types.gen.ts index 99c884c5a..b60ef01dd 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/base-url-false/types.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/base-url-false/types.gen.ts @@ -8,15 +8,12 @@ export type _400 = string; /** * External ref to shared model (A) */ -export type ExternalRefA = { - id: string; - name?: string; -}; +export type ExternalRefA = ExternalSharedExternalSharedModel; /** * External ref to shared model (B) */ -export type ExternalRefB = ExternalRefA; +export type ExternalRefB = ExternalSharedExternalSharedModel; /** * Testing multiline comments in string: First line @@ -974,6 +971,11 @@ export type GenericSchemaDuplicateIssue1SystemString = { readonly hasError?: boolean; }; +export type ExternalSharedExternalSharedModel = { + id: string; + name?: string; +}; + /** * This is a model with one nested property */ diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/base-url-number/types.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/base-url-number/types.gen.ts index 99c884c5a..b60ef01dd 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/base-url-number/types.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/base-url-number/types.gen.ts @@ -8,15 +8,12 @@ export type _400 = string; /** * External ref to shared model (A) */ -export type ExternalRefA = { - id: string; - name?: string; -}; +export type ExternalRefA = ExternalSharedExternalSharedModel; /** * External ref to shared model (B) */ -export type ExternalRefB = ExternalRefA; +export type ExternalRefB = ExternalSharedExternalSharedModel; /** * Testing multiline comments in string: First line @@ -974,6 +971,11 @@ export type GenericSchemaDuplicateIssue1SystemString = { readonly hasError?: boolean; }; +export type ExternalSharedExternalSharedModel = { + id: string; + name?: string; +}; + /** * This is a model with one nested property */ diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/base-url-strict/types.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/base-url-strict/types.gen.ts index 3b42909a3..98bbb29ab 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/base-url-strict/types.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/base-url-strict/types.gen.ts @@ -8,15 +8,12 @@ export type _400 = string; /** * External ref to shared model (A) */ -export type ExternalRefA = { - id: string; - name?: string; -}; +export type ExternalRefA = ExternalSharedExternalSharedModel; /** * External ref to shared model (B) */ -export type ExternalRefB = ExternalRefA; +export type ExternalRefB = ExternalSharedExternalSharedModel; /** * Testing multiline comments in string: First line @@ -974,6 +971,11 @@ export type GenericSchemaDuplicateIssue1SystemString = { readonly hasError?: boolean; }; +export type ExternalSharedExternalSharedModel = { + id: string; + name?: string; +}; + /** * This is a model with one nested property */ diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/base-url-string/types.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/base-url-string/types.gen.ts index 99c884c5a..b60ef01dd 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/base-url-string/types.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/base-url-string/types.gen.ts @@ -8,15 +8,12 @@ export type _400 = string; /** * External ref to shared model (A) */ -export type ExternalRefA = { - id: string; - name?: string; -}; +export type ExternalRefA = ExternalSharedExternalSharedModel; /** * External ref to shared model (B) */ -export type ExternalRefB = ExternalRefA; +export type ExternalRefB = ExternalSharedExternalSharedModel; /** * Testing multiline comments in string: First line @@ -974,6 +971,11 @@ export type GenericSchemaDuplicateIssue1SystemString = { readonly hasError?: boolean; }; +export type ExternalSharedExternalSharedModel = { + id: string; + name?: string; +}; + /** * This is a model with one nested property */ diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/clean-false/types.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/clean-false/types.gen.ts index 99c884c5a..b60ef01dd 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/clean-false/types.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/clean-false/types.gen.ts @@ -8,15 +8,12 @@ export type _400 = string; /** * External ref to shared model (A) */ -export type ExternalRefA = { - id: string; - name?: string; -}; +export type ExternalRefA = ExternalSharedExternalSharedModel; /** * External ref to shared model (B) */ -export type ExternalRefB = ExternalRefA; +export type ExternalRefB = ExternalSharedExternalSharedModel; /** * Testing multiline comments in string: First line @@ -974,6 +971,11 @@ export type GenericSchemaDuplicateIssue1SystemString = { readonly hasError?: boolean; }; +export type ExternalSharedExternalSharedModel = { + id: string; + name?: string; +}; + /** * This is a model with one nested property */ diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/default/types.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/default/types.gen.ts index 99c884c5a..b60ef01dd 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/default/types.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/default/types.gen.ts @@ -8,15 +8,12 @@ export type _400 = string; /** * External ref to shared model (A) */ -export type ExternalRefA = { - id: string; - name?: string; -}; +export type ExternalRefA = ExternalSharedExternalSharedModel; /** * External ref to shared model (B) */ -export type ExternalRefB = ExternalRefA; +export type ExternalRefB = ExternalSharedExternalSharedModel; /** * Testing multiline comments in string: First line @@ -974,6 +971,11 @@ export type GenericSchemaDuplicateIssue1SystemString = { readonly hasError?: boolean; }; +export type ExternalSharedExternalSharedModel = { + id: string; + name?: string; +}; + /** * This is a model with one nested property */ diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/sdk-client-optional/types.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/sdk-client-optional/types.gen.ts index 99c884c5a..b60ef01dd 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/sdk-client-optional/types.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/sdk-client-optional/types.gen.ts @@ -8,15 +8,12 @@ export type _400 = string; /** * External ref to shared model (A) */ -export type ExternalRefA = { - id: string; - name?: string; -}; +export type ExternalRefA = ExternalSharedExternalSharedModel; /** * External ref to shared model (B) */ -export type ExternalRefB = ExternalRefA; +export type ExternalRefB = ExternalSharedExternalSharedModel; /** * Testing multiline comments in string: First line @@ -974,6 +971,11 @@ export type GenericSchemaDuplicateIssue1SystemString = { readonly hasError?: boolean; }; +export type ExternalSharedExternalSharedModel = { + id: string; + name?: string; +}; + /** * This is a model with one nested property */ diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/sdk-client-required/types.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/sdk-client-required/types.gen.ts index 99c884c5a..b60ef01dd 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/sdk-client-required/types.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/sdk-client-required/types.gen.ts @@ -8,15 +8,12 @@ export type _400 = string; /** * External ref to shared model (A) */ -export type ExternalRefA = { - id: string; - name?: string; -}; +export type ExternalRefA = ExternalSharedExternalSharedModel; /** * External ref to shared model (B) */ -export type ExternalRefB = ExternalRefA; +export type ExternalRefB = ExternalSharedExternalSharedModel; /** * Testing multiline comments in string: First line @@ -974,6 +971,11 @@ export type GenericSchemaDuplicateIssue1SystemString = { readonly hasError?: boolean; }; +export type ExternalSharedExternalSharedModel = { + id: string; + name?: string; +}; + /** * This is a model with one nested property */ diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/tsconfig-nodenext-sdk/types.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/tsconfig-nodenext-sdk/types.gen.ts index 99c884c5a..b60ef01dd 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/tsconfig-nodenext-sdk/types.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/tsconfig-nodenext-sdk/types.gen.ts @@ -8,15 +8,12 @@ export type _400 = string; /** * External ref to shared model (A) */ -export type ExternalRefA = { - id: string; - name?: string; -}; +export type ExternalRefA = ExternalSharedExternalSharedModel; /** * External ref to shared model (B) */ -export type ExternalRefB = ExternalRefA; +export type ExternalRefB = ExternalSharedExternalSharedModel; /** * Testing multiline comments in string: First line @@ -974,6 +971,11 @@ export type GenericSchemaDuplicateIssue1SystemString = { readonly hasError?: boolean; }; +export type ExternalSharedExternalSharedModel = { + id: string; + name?: string; +}; + /** * This is a model with one nested property */ diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-false/types.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-false/types.gen.ts index a6ae7c816..f66f6a1f2 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-false/types.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-false/types.gen.ts @@ -8,15 +8,12 @@ export type _400 = string; /** * External ref to shared model (A) */ -export type ExternalRefA = { - id: string; - name?: string; -}; +export type ExternalRefA = ExternalSharedExternalSharedModel; /** * External ref to shared model (B) */ -export type ExternalRefB = ExternalRefA; +export type ExternalRefB = ExternalSharedExternalSharedModel; /** * Testing multiline comments in string: First line @@ -974,6 +971,11 @@ export type GenericSchemaDuplicateIssue1SystemString = { readonly hasError?: boolean; }; +export type ExternalSharedExternalSharedModel = { + id: string; + name?: string; +}; + /** * This is a model with one nested property */ diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-number/types.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-number/types.gen.ts index a6ae7c816..f66f6a1f2 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-number/types.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-number/types.gen.ts @@ -8,15 +8,12 @@ export type _400 = string; /** * External ref to shared model (A) */ -export type ExternalRefA = { - id: string; - name?: string; -}; +export type ExternalRefA = ExternalSharedExternalSharedModel; /** * External ref to shared model (B) */ -export type ExternalRefB = ExternalRefA; +export type ExternalRefB = ExternalSharedExternalSharedModel; /** * Testing multiline comments in string: First line @@ -974,6 +971,11 @@ export type GenericSchemaDuplicateIssue1SystemString = { readonly hasError?: boolean; }; +export type ExternalSharedExternalSharedModel = { + id: string; + name?: string; +}; + /** * This is a model with one nested property */ diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-strict/types.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-strict/types.gen.ts index 6dab9f3e0..dbf7777fa 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-strict/types.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-strict/types.gen.ts @@ -8,15 +8,12 @@ export type _400 = string; /** * External ref to shared model (A) */ -export type ExternalRefA = { - id: string; - name?: string; -}; +export type ExternalRefA = ExternalSharedExternalSharedModel; /** * External ref to shared model (B) */ -export type ExternalRefB = ExternalRefA; +export type ExternalRefB = ExternalSharedExternalSharedModel; /** * Testing multiline comments in string: First line @@ -974,6 +971,11 @@ export type GenericSchemaDuplicateIssue1SystemString = { readonly hasError?: boolean; }; +export type ExternalSharedExternalSharedModel = { + id: string; + name?: string; +}; + /** * This is a model with one nested property */ diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-string/types.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-string/types.gen.ts index a6ae7c816..f66f6a1f2 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-string/types.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-string/types.gen.ts @@ -8,15 +8,12 @@ export type _400 = string; /** * External ref to shared model (A) */ -export type ExternalRefA = { - id: string; - name?: string; -}; +export type ExternalRefA = ExternalSharedExternalSharedModel; /** * External ref to shared model (B) */ -export type ExternalRefB = ExternalRefA; +export type ExternalRefB = ExternalSharedExternalSharedModel; /** * Testing multiline comments in string: First line @@ -974,6 +971,11 @@ export type GenericSchemaDuplicateIssue1SystemString = { readonly hasError?: boolean; }; +export type ExternalSharedExternalSharedModel = { + id: string; + name?: string; +}; + /** * This is a model with one nested property */ diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/clean-false/types.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/clean-false/types.gen.ts index a6ae7c816..f66f6a1f2 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/clean-false/types.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/clean-false/types.gen.ts @@ -8,15 +8,12 @@ export type _400 = string; /** * External ref to shared model (A) */ -export type ExternalRefA = { - id: string; - name?: string; -}; +export type ExternalRefA = ExternalSharedExternalSharedModel; /** * External ref to shared model (B) */ -export type ExternalRefB = ExternalRefA; +export type ExternalRefB = ExternalSharedExternalSharedModel; /** * Testing multiline comments in string: First line @@ -974,6 +971,11 @@ export type GenericSchemaDuplicateIssue1SystemString = { readonly hasError?: boolean; }; +export type ExternalSharedExternalSharedModel = { + id: string; + name?: string; +}; + /** * This is a model with one nested property */ diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/default/types.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/default/types.gen.ts index a6ae7c816..f66f6a1f2 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/default/types.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/default/types.gen.ts @@ -8,15 +8,12 @@ export type _400 = string; /** * External ref to shared model (A) */ -export type ExternalRefA = { - id: string; - name?: string; -}; +export type ExternalRefA = ExternalSharedExternalSharedModel; /** * External ref to shared model (B) */ -export type ExternalRefB = ExternalRefA; +export type ExternalRefB = ExternalSharedExternalSharedModel; /** * Testing multiline comments in string: First line @@ -974,6 +971,11 @@ export type GenericSchemaDuplicateIssue1SystemString = { readonly hasError?: boolean; }; +export type ExternalSharedExternalSharedModel = { + id: string; + name?: string; +}; + /** * This is a model with one nested property */ diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/sdk-client-optional/types.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/sdk-client-optional/types.gen.ts index a6ae7c816..f66f6a1f2 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/sdk-client-optional/types.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/sdk-client-optional/types.gen.ts @@ -8,15 +8,12 @@ export type _400 = string; /** * External ref to shared model (A) */ -export type ExternalRefA = { - id: string; - name?: string; -}; +export type ExternalRefA = ExternalSharedExternalSharedModel; /** * External ref to shared model (B) */ -export type ExternalRefB = ExternalRefA; +export type ExternalRefB = ExternalSharedExternalSharedModel; /** * Testing multiline comments in string: First line @@ -974,6 +971,11 @@ export type GenericSchemaDuplicateIssue1SystemString = { readonly hasError?: boolean; }; +export type ExternalSharedExternalSharedModel = { + id: string; + name?: string; +}; + /** * This is a model with one nested property */ diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/sdk-client-required/types.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/sdk-client-required/types.gen.ts index a6ae7c816..f66f6a1f2 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/sdk-client-required/types.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/sdk-client-required/types.gen.ts @@ -8,15 +8,12 @@ export type _400 = string; /** * External ref to shared model (A) */ -export type ExternalRefA = { - id: string; - name?: string; -}; +export type ExternalRefA = ExternalSharedExternalSharedModel; /** * External ref to shared model (B) */ -export type ExternalRefB = ExternalRefA; +export type ExternalRefB = ExternalSharedExternalSharedModel; /** * Testing multiline comments in string: First line @@ -974,6 +971,11 @@ export type GenericSchemaDuplicateIssue1SystemString = { readonly hasError?: boolean; }; +export type ExternalSharedExternalSharedModel = { + id: string; + name?: string; +}; + /** * This is a model with one nested property */ diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/tsconfig-nodenext-sdk/types.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/tsconfig-nodenext-sdk/types.gen.ts index a6ae7c816..f66f6a1f2 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/tsconfig-nodenext-sdk/types.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/tsconfig-nodenext-sdk/types.gen.ts @@ -8,15 +8,12 @@ export type _400 = string; /** * External ref to shared model (A) */ -export type ExternalRefA = { - id: string; - name?: string; -}; +export type ExternalRefA = ExternalSharedExternalSharedModel; /** * External ref to shared model (B) */ -export type ExternalRefB = ExternalRefA; +export type ExternalRefB = ExternalSharedExternalSharedModel; /** * Testing multiline comments in string: First line @@ -974,6 +971,11 @@ export type GenericSchemaDuplicateIssue1SystemString = { readonly hasError?: boolean; }; +export type ExternalSharedExternalSharedModel = { + id: string; + name?: string; +}; + /** * This is a model with one nested property */ diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-false/types.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-false/types.gen.ts index a6ae7c816..f66f6a1f2 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-false/types.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-false/types.gen.ts @@ -8,15 +8,12 @@ export type _400 = string; /** * External ref to shared model (A) */ -export type ExternalRefA = { - id: string; - name?: string; -}; +export type ExternalRefA = ExternalSharedExternalSharedModel; /** * External ref to shared model (B) */ -export type ExternalRefB = ExternalRefA; +export type ExternalRefB = ExternalSharedExternalSharedModel; /** * Testing multiline comments in string: First line @@ -974,6 +971,11 @@ export type GenericSchemaDuplicateIssue1SystemString = { readonly hasError?: boolean; }; +export type ExternalSharedExternalSharedModel = { + id: string; + name?: string; +}; + /** * This is a model with one nested property */ diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-number/types.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-number/types.gen.ts index a6ae7c816..f66f6a1f2 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-number/types.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-number/types.gen.ts @@ -8,15 +8,12 @@ export type _400 = string; /** * External ref to shared model (A) */ -export type ExternalRefA = { - id: string; - name?: string; -}; +export type ExternalRefA = ExternalSharedExternalSharedModel; /** * External ref to shared model (B) */ -export type ExternalRefB = ExternalRefA; +export type ExternalRefB = ExternalSharedExternalSharedModel; /** * Testing multiline comments in string: First line @@ -974,6 +971,11 @@ export type GenericSchemaDuplicateIssue1SystemString = { readonly hasError?: boolean; }; +export type ExternalSharedExternalSharedModel = { + id: string; + name?: string; +}; + /** * This is a model with one nested property */ diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-strict/types.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-strict/types.gen.ts index 6dab9f3e0..dbf7777fa 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-strict/types.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-strict/types.gen.ts @@ -8,15 +8,12 @@ export type _400 = string; /** * External ref to shared model (A) */ -export type ExternalRefA = { - id: string; - name?: string; -}; +export type ExternalRefA = ExternalSharedExternalSharedModel; /** * External ref to shared model (B) */ -export type ExternalRefB = ExternalRefA; +export type ExternalRefB = ExternalSharedExternalSharedModel; /** * Testing multiline comments in string: First line @@ -974,6 +971,11 @@ export type GenericSchemaDuplicateIssue1SystemString = { readonly hasError?: boolean; }; +export type ExternalSharedExternalSharedModel = { + id: string; + name?: string; +}; + /** * This is a model with one nested property */ diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-string/types.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-string/types.gen.ts index a6ae7c816..f66f6a1f2 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-string/types.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-string/types.gen.ts @@ -8,15 +8,12 @@ export type _400 = string; /** * External ref to shared model (A) */ -export type ExternalRefA = { - id: string; - name?: string; -}; +export type ExternalRefA = ExternalSharedExternalSharedModel; /** * External ref to shared model (B) */ -export type ExternalRefB = ExternalRefA; +export type ExternalRefB = ExternalSharedExternalSharedModel; /** * Testing multiline comments in string: First line @@ -974,6 +971,11 @@ export type GenericSchemaDuplicateIssue1SystemString = { readonly hasError?: boolean; }; +export type ExternalSharedExternalSharedModel = { + id: string; + name?: string; +}; + /** * This is a model with one nested property */ diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/clean-false/types.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/clean-false/types.gen.ts index a6ae7c816..f66f6a1f2 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/clean-false/types.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/clean-false/types.gen.ts @@ -8,15 +8,12 @@ export type _400 = string; /** * External ref to shared model (A) */ -export type ExternalRefA = { - id: string; - name?: string; -}; +export type ExternalRefA = ExternalSharedExternalSharedModel; /** * External ref to shared model (B) */ -export type ExternalRefB = ExternalRefA; +export type ExternalRefB = ExternalSharedExternalSharedModel; /** * Testing multiline comments in string: First line @@ -974,6 +971,11 @@ export type GenericSchemaDuplicateIssue1SystemString = { readonly hasError?: boolean; }; +export type ExternalSharedExternalSharedModel = { + id: string; + name?: string; +}; + /** * This is a model with one nested property */ diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/default/types.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/default/types.gen.ts index a6ae7c816..f66f6a1f2 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/default/types.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/default/types.gen.ts @@ -8,15 +8,12 @@ export type _400 = string; /** * External ref to shared model (A) */ -export type ExternalRefA = { - id: string; - name?: string; -}; +export type ExternalRefA = ExternalSharedExternalSharedModel; /** * External ref to shared model (B) */ -export type ExternalRefB = ExternalRefA; +export type ExternalRefB = ExternalSharedExternalSharedModel; /** * Testing multiline comments in string: First line @@ -974,6 +971,11 @@ export type GenericSchemaDuplicateIssue1SystemString = { readonly hasError?: boolean; }; +export type ExternalSharedExternalSharedModel = { + id: string; + name?: string; +}; + /** * This is a model with one nested property */ diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/sdk-client-optional/types.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/sdk-client-optional/types.gen.ts index a6ae7c816..f66f6a1f2 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/sdk-client-optional/types.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/sdk-client-optional/types.gen.ts @@ -8,15 +8,12 @@ export type _400 = string; /** * External ref to shared model (A) */ -export type ExternalRefA = { - id: string; - name?: string; -}; +export type ExternalRefA = ExternalSharedExternalSharedModel; /** * External ref to shared model (B) */ -export type ExternalRefB = ExternalRefA; +export type ExternalRefB = ExternalSharedExternalSharedModel; /** * Testing multiline comments in string: First line @@ -974,6 +971,11 @@ export type GenericSchemaDuplicateIssue1SystemString = { readonly hasError?: boolean; }; +export type ExternalSharedExternalSharedModel = { + id: string; + name?: string; +}; + /** * This is a model with one nested property */ diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/sdk-client-required/types.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/sdk-client-required/types.gen.ts index a6ae7c816..f66f6a1f2 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/sdk-client-required/types.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/sdk-client-required/types.gen.ts @@ -8,15 +8,12 @@ export type _400 = string; /** * External ref to shared model (A) */ -export type ExternalRefA = { - id: string; - name?: string; -}; +export type ExternalRefA = ExternalSharedExternalSharedModel; /** * External ref to shared model (B) */ -export type ExternalRefB = ExternalRefA; +export type ExternalRefB = ExternalSharedExternalSharedModel; /** * Testing multiline comments in string: First line @@ -974,6 +971,11 @@ export type GenericSchemaDuplicateIssue1SystemString = { readonly hasError?: boolean; }; +export type ExternalSharedExternalSharedModel = { + id: string; + name?: string; +}; + /** * This is a model with one nested property */ diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/tsconfig-nodenext-sdk/types.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/tsconfig-nodenext-sdk/types.gen.ts index a6ae7c816..f66f6a1f2 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/tsconfig-nodenext-sdk/types.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/tsconfig-nodenext-sdk/types.gen.ts @@ -8,15 +8,12 @@ export type _400 = string; /** * External ref to shared model (A) */ -export type ExternalRefA = { - id: string; - name?: string; -}; +export type ExternalRefA = ExternalSharedExternalSharedModel; /** * External ref to shared model (B) */ -export type ExternalRefB = ExternalRefA; +export type ExternalRefB = ExternalSharedExternalSharedModel; /** * Testing multiline comments in string: First line @@ -974,6 +971,11 @@ export type GenericSchemaDuplicateIssue1SystemString = { readonly hasError?: boolean; }; +export type ExternalSharedExternalSharedModel = { + id: string; + name?: string; +}; + /** * This is a model with one nested property */ diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/base-url-false/types.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/base-url-false/types.gen.ts index 99c884c5a..b60ef01dd 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/base-url-false/types.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/base-url-false/types.gen.ts @@ -8,15 +8,12 @@ export type _400 = string; /** * External ref to shared model (A) */ -export type ExternalRefA = { - id: string; - name?: string; -}; +export type ExternalRefA = ExternalSharedExternalSharedModel; /** * External ref to shared model (B) */ -export type ExternalRefB = ExternalRefA; +export type ExternalRefB = ExternalSharedExternalSharedModel; /** * Testing multiline comments in string: First line @@ -974,6 +971,11 @@ export type GenericSchemaDuplicateIssue1SystemString = { readonly hasError?: boolean; }; +export type ExternalSharedExternalSharedModel = { + id: string; + name?: string; +}; + /** * This is a model with one nested property */ diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/base-url-number/types.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/base-url-number/types.gen.ts index 99c884c5a..b60ef01dd 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/base-url-number/types.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/base-url-number/types.gen.ts @@ -8,15 +8,12 @@ export type _400 = string; /** * External ref to shared model (A) */ -export type ExternalRefA = { - id: string; - name?: string; -}; +export type ExternalRefA = ExternalSharedExternalSharedModel; /** * External ref to shared model (B) */ -export type ExternalRefB = ExternalRefA; +export type ExternalRefB = ExternalSharedExternalSharedModel; /** * Testing multiline comments in string: First line @@ -974,6 +971,11 @@ export type GenericSchemaDuplicateIssue1SystemString = { readonly hasError?: boolean; }; +export type ExternalSharedExternalSharedModel = { + id: string; + name?: string; +}; + /** * This is a model with one nested property */ diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/base-url-strict/types.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/base-url-strict/types.gen.ts index 3b42909a3..98bbb29ab 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/base-url-strict/types.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/base-url-strict/types.gen.ts @@ -8,15 +8,12 @@ export type _400 = string; /** * External ref to shared model (A) */ -export type ExternalRefA = { - id: string; - name?: string; -}; +export type ExternalRefA = ExternalSharedExternalSharedModel; /** * External ref to shared model (B) */ -export type ExternalRefB = ExternalRefA; +export type ExternalRefB = ExternalSharedExternalSharedModel; /** * Testing multiline comments in string: First line @@ -974,6 +971,11 @@ export type GenericSchemaDuplicateIssue1SystemString = { readonly hasError?: boolean; }; +export type ExternalSharedExternalSharedModel = { + id: string; + name?: string; +}; + /** * This is a model with one nested property */ diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/base-url-string/types.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/base-url-string/types.gen.ts index 99c884c5a..b60ef01dd 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/base-url-string/types.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/base-url-string/types.gen.ts @@ -8,15 +8,12 @@ export type _400 = string; /** * External ref to shared model (A) */ -export type ExternalRefA = { - id: string; - name?: string; -}; +export type ExternalRefA = ExternalSharedExternalSharedModel; /** * External ref to shared model (B) */ -export type ExternalRefB = ExternalRefA; +export type ExternalRefB = ExternalSharedExternalSharedModel; /** * Testing multiline comments in string: First line @@ -974,6 +971,11 @@ export type GenericSchemaDuplicateIssue1SystemString = { readonly hasError?: boolean; }; +export type ExternalSharedExternalSharedModel = { + id: string; + name?: string; +}; + /** * This is a model with one nested property */ diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/clean-false/types.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/clean-false/types.gen.ts index 99c884c5a..b60ef01dd 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/clean-false/types.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/clean-false/types.gen.ts @@ -8,15 +8,12 @@ export type _400 = string; /** * External ref to shared model (A) */ -export type ExternalRefA = { - id: string; - name?: string; -}; +export type ExternalRefA = ExternalSharedExternalSharedModel; /** * External ref to shared model (B) */ -export type ExternalRefB = ExternalRefA; +export type ExternalRefB = ExternalSharedExternalSharedModel; /** * Testing multiline comments in string: First line @@ -974,6 +971,11 @@ export type GenericSchemaDuplicateIssue1SystemString = { readonly hasError?: boolean; }; +export type ExternalSharedExternalSharedModel = { + id: string; + name?: string; +}; + /** * This is a model with one nested property */ diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/default/types.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/default/types.gen.ts index 99c884c5a..b60ef01dd 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/default/types.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/default/types.gen.ts @@ -8,15 +8,12 @@ export type _400 = string; /** * External ref to shared model (A) */ -export type ExternalRefA = { - id: string; - name?: string; -}; +export type ExternalRefA = ExternalSharedExternalSharedModel; /** * External ref to shared model (B) */ -export type ExternalRefB = ExternalRefA; +export type ExternalRefB = ExternalSharedExternalSharedModel; /** * Testing multiline comments in string: First line @@ -974,6 +971,11 @@ export type GenericSchemaDuplicateIssue1SystemString = { readonly hasError?: boolean; }; +export type ExternalSharedExternalSharedModel = { + id: string; + name?: string; +}; + /** * This is a model with one nested property */ diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/sdk-client-optional/types.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/sdk-client-optional/types.gen.ts index 99c884c5a..b60ef01dd 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/sdk-client-optional/types.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/sdk-client-optional/types.gen.ts @@ -8,15 +8,12 @@ export type _400 = string; /** * External ref to shared model (A) */ -export type ExternalRefA = { - id: string; - name?: string; -}; +export type ExternalRefA = ExternalSharedExternalSharedModel; /** * External ref to shared model (B) */ -export type ExternalRefB = ExternalRefA; +export type ExternalRefB = ExternalSharedExternalSharedModel; /** * Testing multiline comments in string: First line @@ -974,6 +971,11 @@ export type GenericSchemaDuplicateIssue1SystemString = { readonly hasError?: boolean; }; +export type ExternalSharedExternalSharedModel = { + id: string; + name?: string; +}; + /** * This is a model with one nested property */ diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/sdk-client-required/types.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/sdk-client-required/types.gen.ts index 99c884c5a..b60ef01dd 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/sdk-client-required/types.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/sdk-client-required/types.gen.ts @@ -8,15 +8,12 @@ export type _400 = string; /** * External ref to shared model (A) */ -export type ExternalRefA = { - id: string; - name?: string; -}; +export type ExternalRefA = ExternalSharedExternalSharedModel; /** * External ref to shared model (B) */ -export type ExternalRefB = ExternalRefA; +export type ExternalRefB = ExternalSharedExternalSharedModel; /** * Testing multiline comments in string: First line @@ -974,6 +971,11 @@ export type GenericSchemaDuplicateIssue1SystemString = { readonly hasError?: boolean; }; +export type ExternalSharedExternalSharedModel = { + id: string; + name?: string; +}; + /** * This is a model with one nested property */ diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/tsconfig-nodenext-sdk/types.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/tsconfig-nodenext-sdk/types.gen.ts index 99c884c5a..b60ef01dd 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/tsconfig-nodenext-sdk/types.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/tsconfig-nodenext-sdk/types.gen.ts @@ -8,15 +8,12 @@ export type _400 = string; /** * External ref to shared model (A) */ -export type ExternalRefA = { - id: string; - name?: string; -}; +export type ExternalRefA = ExternalSharedExternalSharedModel; /** * External ref to shared model (B) */ -export type ExternalRefB = ExternalRefA; +export type ExternalRefB = ExternalSharedExternalSharedModel; /** * Testing multiline comments in string: First line @@ -974,6 +971,11 @@ export type GenericSchemaDuplicateIssue1SystemString = { readonly hasError?: boolean; }; +export type ExternalSharedExternalSharedModel = { + id: string; + name?: string; +}; + /** * This is a model with one nested property */ diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/client-custom/base-url-false/types.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/client-custom/base-url-false/types.gen.ts index a6ae7c816..f66f6a1f2 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/client-custom/base-url-false/types.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/client-custom/base-url-false/types.gen.ts @@ -8,15 +8,12 @@ export type _400 = string; /** * External ref to shared model (A) */ -export type ExternalRefA = { - id: string; - name?: string; -}; +export type ExternalRefA = ExternalSharedExternalSharedModel; /** * External ref to shared model (B) */ -export type ExternalRefB = ExternalRefA; +export type ExternalRefB = ExternalSharedExternalSharedModel; /** * Testing multiline comments in string: First line @@ -974,6 +971,11 @@ export type GenericSchemaDuplicateIssue1SystemString = { readonly hasError?: boolean; }; +export type ExternalSharedExternalSharedModel = { + id: string; + name?: string; +}; + /** * This is a model with one nested property */ diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/client-custom/base-url-number/types.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/client-custom/base-url-number/types.gen.ts index a6ae7c816..f66f6a1f2 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/client-custom/base-url-number/types.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/client-custom/base-url-number/types.gen.ts @@ -8,15 +8,12 @@ export type _400 = string; /** * External ref to shared model (A) */ -export type ExternalRefA = { - id: string; - name?: string; -}; +export type ExternalRefA = ExternalSharedExternalSharedModel; /** * External ref to shared model (B) */ -export type ExternalRefB = ExternalRefA; +export type ExternalRefB = ExternalSharedExternalSharedModel; /** * Testing multiline comments in string: First line @@ -974,6 +971,11 @@ export type GenericSchemaDuplicateIssue1SystemString = { readonly hasError?: boolean; }; +export type ExternalSharedExternalSharedModel = { + id: string; + name?: string; +}; + /** * This is a model with one nested property */ diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/client-custom/base-url-strict/types.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/client-custom/base-url-strict/types.gen.ts index 6dab9f3e0..dbf7777fa 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/client-custom/base-url-strict/types.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/client-custom/base-url-strict/types.gen.ts @@ -8,15 +8,12 @@ export type _400 = string; /** * External ref to shared model (A) */ -export type ExternalRefA = { - id: string; - name?: string; -}; +export type ExternalRefA = ExternalSharedExternalSharedModel; /** * External ref to shared model (B) */ -export type ExternalRefB = ExternalRefA; +export type ExternalRefB = ExternalSharedExternalSharedModel; /** * Testing multiline comments in string: First line @@ -974,6 +971,11 @@ export type GenericSchemaDuplicateIssue1SystemString = { readonly hasError?: boolean; }; +export type ExternalSharedExternalSharedModel = { + id: string; + name?: string; +}; + /** * This is a model with one nested property */ diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/client-custom/base-url-string/types.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/client-custom/base-url-string/types.gen.ts index a6ae7c816..f66f6a1f2 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/client-custom/base-url-string/types.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/client-custom/base-url-string/types.gen.ts @@ -8,15 +8,12 @@ export type _400 = string; /** * External ref to shared model (A) */ -export type ExternalRefA = { - id: string; - name?: string; -}; +export type ExternalRefA = ExternalSharedExternalSharedModel; /** * External ref to shared model (B) */ -export type ExternalRefB = ExternalRefA; +export type ExternalRefB = ExternalSharedExternalSharedModel; /** * Testing multiline comments in string: First line @@ -974,6 +971,11 @@ export type GenericSchemaDuplicateIssue1SystemString = { readonly hasError?: boolean; }; +export type ExternalSharedExternalSharedModel = { + id: string; + name?: string; +}; + /** * This is a model with one nested property */ diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/client-custom/bundle/types.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/client-custom/bundle/types.gen.ts index a6ae7c816..f66f6a1f2 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/client-custom/bundle/types.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/client-custom/bundle/types.gen.ts @@ -8,15 +8,12 @@ export type _400 = string; /** * External ref to shared model (A) */ -export type ExternalRefA = { - id: string; - name?: string; -}; +export type ExternalRefA = ExternalSharedExternalSharedModel; /** * External ref to shared model (B) */ -export type ExternalRefB = ExternalRefA; +export type ExternalRefB = ExternalSharedExternalSharedModel; /** * Testing multiline comments in string: First line @@ -974,6 +971,11 @@ export type GenericSchemaDuplicateIssue1SystemString = { readonly hasError?: boolean; }; +export type ExternalSharedExternalSharedModel = { + id: string; + name?: string; +}; + /** * This is a model with one nested property */ diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/client-custom/default/types.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/client-custom/default/types.gen.ts index a6ae7c816..f66f6a1f2 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/client-custom/default/types.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/client-custom/default/types.gen.ts @@ -8,15 +8,12 @@ export type _400 = string; /** * External ref to shared model (A) */ -export type ExternalRefA = { - id: string; - name?: string; -}; +export type ExternalRefA = ExternalSharedExternalSharedModel; /** * External ref to shared model (B) */ -export type ExternalRefB = ExternalRefA; +export type ExternalRefB = ExternalSharedExternalSharedModel; /** * Testing multiline comments in string: First line @@ -974,6 +971,11 @@ export type GenericSchemaDuplicateIssue1SystemString = { readonly hasError?: boolean; }; +export type ExternalSharedExternalSharedModel = { + id: string; + name?: string; +}; + /** * This is a model with one nested property */ diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/client-custom/sdk-client-optional/types.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/client-custom/sdk-client-optional/types.gen.ts index a6ae7c816..f66f6a1f2 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/client-custom/sdk-client-optional/types.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/client-custom/sdk-client-optional/types.gen.ts @@ -8,15 +8,12 @@ export type _400 = string; /** * External ref to shared model (A) */ -export type ExternalRefA = { - id: string; - name?: string; -}; +export type ExternalRefA = ExternalSharedExternalSharedModel; /** * External ref to shared model (B) */ -export type ExternalRefB = ExternalRefA; +export type ExternalRefB = ExternalSharedExternalSharedModel; /** * Testing multiline comments in string: First line @@ -974,6 +971,11 @@ export type GenericSchemaDuplicateIssue1SystemString = { readonly hasError?: boolean; }; +export type ExternalSharedExternalSharedModel = { + id: string; + name?: string; +}; + /** * This is a model with one nested property */ diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/client-custom/sdk-client-required/types.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/client-custom/sdk-client-required/types.gen.ts index a6ae7c816..f66f6a1f2 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/client-custom/sdk-client-required/types.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/client-custom/sdk-client-required/types.gen.ts @@ -8,15 +8,12 @@ export type _400 = string; /** * External ref to shared model (A) */ -export type ExternalRefA = { - id: string; - name?: string; -}; +export type ExternalRefA = ExternalSharedExternalSharedModel; /** * External ref to shared model (B) */ -export type ExternalRefB = ExternalRefA; +export type ExternalRefB = ExternalSharedExternalSharedModel; /** * Testing multiline comments in string: First line @@ -974,6 +971,11 @@ export type GenericSchemaDuplicateIssue1SystemString = { readonly hasError?: boolean; }; +export type ExternalSharedExternalSharedModel = { + id: string; + name?: string; +}; + /** * This is a model with one nested property */ diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/my-client/base-url-false/types.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/my-client/base-url-false/types.gen.ts index a6ae7c816..f66f6a1f2 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/my-client/base-url-false/types.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/my-client/base-url-false/types.gen.ts @@ -8,15 +8,12 @@ export type _400 = string; /** * External ref to shared model (A) */ -export type ExternalRefA = { - id: string; - name?: string; -}; +export type ExternalRefA = ExternalSharedExternalSharedModel; /** * External ref to shared model (B) */ -export type ExternalRefB = ExternalRefA; +export type ExternalRefB = ExternalSharedExternalSharedModel; /** * Testing multiline comments in string: First line @@ -974,6 +971,11 @@ export type GenericSchemaDuplicateIssue1SystemString = { readonly hasError?: boolean; }; +export type ExternalSharedExternalSharedModel = { + id: string; + name?: string; +}; + /** * This is a model with one nested property */ diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/my-client/base-url-number/types.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/my-client/base-url-number/types.gen.ts index a6ae7c816..f66f6a1f2 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/my-client/base-url-number/types.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/my-client/base-url-number/types.gen.ts @@ -8,15 +8,12 @@ export type _400 = string; /** * External ref to shared model (A) */ -export type ExternalRefA = { - id: string; - name?: string; -}; +export type ExternalRefA = ExternalSharedExternalSharedModel; /** * External ref to shared model (B) */ -export type ExternalRefB = ExternalRefA; +export type ExternalRefB = ExternalSharedExternalSharedModel; /** * Testing multiline comments in string: First line @@ -974,6 +971,11 @@ export type GenericSchemaDuplicateIssue1SystemString = { readonly hasError?: boolean; }; +export type ExternalSharedExternalSharedModel = { + id: string; + name?: string; +}; + /** * This is a model with one nested property */ diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/my-client/base-url-strict/types.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/my-client/base-url-strict/types.gen.ts index 6dab9f3e0..dbf7777fa 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/my-client/base-url-strict/types.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/my-client/base-url-strict/types.gen.ts @@ -8,15 +8,12 @@ export type _400 = string; /** * External ref to shared model (A) */ -export type ExternalRefA = { - id: string; - name?: string; -}; +export type ExternalRefA = ExternalSharedExternalSharedModel; /** * External ref to shared model (B) */ -export type ExternalRefB = ExternalRefA; +export type ExternalRefB = ExternalSharedExternalSharedModel; /** * Testing multiline comments in string: First line @@ -974,6 +971,11 @@ export type GenericSchemaDuplicateIssue1SystemString = { readonly hasError?: boolean; }; +export type ExternalSharedExternalSharedModel = { + id: string; + name?: string; +}; + /** * This is a model with one nested property */ diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/my-client/base-url-string/types.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/my-client/base-url-string/types.gen.ts index a6ae7c816..f66f6a1f2 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/my-client/base-url-string/types.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/my-client/base-url-string/types.gen.ts @@ -8,15 +8,12 @@ export type _400 = string; /** * External ref to shared model (A) */ -export type ExternalRefA = { - id: string; - name?: string; -}; +export type ExternalRefA = ExternalSharedExternalSharedModel; /** * External ref to shared model (B) */ -export type ExternalRefB = ExternalRefA; +export type ExternalRefB = ExternalSharedExternalSharedModel; /** * Testing multiline comments in string: First line @@ -974,6 +971,11 @@ export type GenericSchemaDuplicateIssue1SystemString = { readonly hasError?: boolean; }; +export type ExternalSharedExternalSharedModel = { + id: string; + name?: string; +}; + /** * This is a model with one nested property */ diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/my-client/bundle/types.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/my-client/bundle/types.gen.ts index a6ae7c816..f66f6a1f2 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/my-client/bundle/types.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/my-client/bundle/types.gen.ts @@ -8,15 +8,12 @@ export type _400 = string; /** * External ref to shared model (A) */ -export type ExternalRefA = { - id: string; - name?: string; -}; +export type ExternalRefA = ExternalSharedExternalSharedModel; /** * External ref to shared model (B) */ -export type ExternalRefB = ExternalRefA; +export type ExternalRefB = ExternalSharedExternalSharedModel; /** * Testing multiline comments in string: First line @@ -974,6 +971,11 @@ export type GenericSchemaDuplicateIssue1SystemString = { readonly hasError?: boolean; }; +export type ExternalSharedExternalSharedModel = { + id: string; + name?: string; +}; + /** * This is a model with one nested property */ diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/my-client/default/types.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/my-client/default/types.gen.ts index a6ae7c816..f66f6a1f2 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/my-client/default/types.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/my-client/default/types.gen.ts @@ -8,15 +8,12 @@ export type _400 = string; /** * External ref to shared model (A) */ -export type ExternalRefA = { - id: string; - name?: string; -}; +export type ExternalRefA = ExternalSharedExternalSharedModel; /** * External ref to shared model (B) */ -export type ExternalRefB = ExternalRefA; +export type ExternalRefB = ExternalSharedExternalSharedModel; /** * Testing multiline comments in string: First line @@ -974,6 +971,11 @@ export type GenericSchemaDuplicateIssue1SystemString = { readonly hasError?: boolean; }; +export type ExternalSharedExternalSharedModel = { + id: string; + name?: string; +}; + /** * This is a model with one nested property */ diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/my-client/sdk-client-optional/types.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/my-client/sdk-client-optional/types.gen.ts index a6ae7c816..f66f6a1f2 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/my-client/sdk-client-optional/types.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/my-client/sdk-client-optional/types.gen.ts @@ -8,15 +8,12 @@ export type _400 = string; /** * External ref to shared model (A) */ -export type ExternalRefA = { - id: string; - name?: string; -}; +export type ExternalRefA = ExternalSharedExternalSharedModel; /** * External ref to shared model (B) */ -export type ExternalRefB = ExternalRefA; +export type ExternalRefB = ExternalSharedExternalSharedModel; /** * Testing multiline comments in string: First line @@ -974,6 +971,11 @@ export type GenericSchemaDuplicateIssue1SystemString = { readonly hasError?: boolean; }; +export type ExternalSharedExternalSharedModel = { + id: string; + name?: string; +}; + /** * This is a model with one nested property */ diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/my-client/sdk-client-required/types.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/my-client/sdk-client-required/types.gen.ts index a6ae7c816..f66f6a1f2 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/my-client/sdk-client-required/types.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/my-client/sdk-client-required/types.gen.ts @@ -8,15 +8,12 @@ export type _400 = string; /** * External ref to shared model (A) */ -export type ExternalRefA = { - id: string; - name?: string; -}; +export type ExternalRefA = ExternalSharedExternalSharedModel; /** * External ref to shared model (B) */ -export type ExternalRefB = ExternalRefA; +export type ExternalRefB = ExternalSharedExternalSharedModel; /** * Testing multiline comments in string: First line @@ -974,6 +971,11 @@ export type GenericSchemaDuplicateIssue1SystemString = { readonly hasError?: boolean; }; +export type ExternalSharedExternalSharedModel = { + id: string; + name?: string; +}; + /** * This is a model with one nested property */ diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/external/types.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/external/types.gen.ts index ac461a885..c60dd5c3b 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/external/types.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/external/types.gen.ts @@ -3,78 +3,470 @@ /** * External schema (A) */ -export type ExternalSchemaA = { - id: string; - name?: string; -}; +export type ExternalSchemaA = ExternalSharedExternalSharedModel; + +/** + * External schema (B) - second use of ExternalSharedModel + */ +export type ExternalSchemaB = ExternalSharedExternalSharedModel; + +/** + * External schema (C) - third use of ExternalSharedModel + */ +export type ExternalSchemaC = ExternalSharedExternalSharedModel; /** - * External schema (B) + * External schema via path reference (A) */ -export type ExternalSchemaB = ExternalSchemaA; +export type ExternalSchemaPathA = ExternalSharedExternalSharedModel; /** - * External schema (C) + * External schema via path reference (B) - second use */ -export type ExternalSchemaC = ExternalSchemaA; +export type ExternalSchemaPathB = ExternalSharedExternalSharedModel; /** * External schema property (A) */ export type ExternalSchemaPropertyA = { - 0?: string; + uuid1?: ExternalSharedExternalSharedModelWithUuid; }; /** - * External schema property (B) + * External schema property (B) - second use of UUID */ export type ExternalSchemaPropertyB = { - 0?: ; + uuid2?: ExternalSharedExternalSharedModelWithUuid; }; /** - * External schema property from component (A.id) + * External schema property (C) - third use of UUID */ -export type ExternalSchemaPropertyFromComponent = { - 0?: ; +export type ExternalSchemaPropertyC = { + uuid3?: ExternalSharedExternalSharedModelWithUuid; }; /** * External schema property with duplicate refs (D) */ export type ExternalSchemaPropertyD = { - 0?: ; - 1?: ; + uuid4?: ExternalSharedExternalSharedModelWithUuid; + uuid5?: ExternalSharedExternalSharedModelWithUuid; }; /** * External schema property via external property ref (id) */ export type ExternalSchemaExternalProp = { - 0?: ; + id3?: ExternalSharedId; + id4?: ExternalSharedId; }; /** * Alias to external property via component property ref */ export type ExternalSchemaExternalPropAlias = { - 0?: ; + id5?: ExternalSharedId; + id6?: ExternalSharedId; }; /** * External double nested prop via property ref */ export type ExternalDoubleNestedProp = { - 0?: string; + deep1?: ExternalSharedDeep; + deep2?: ExternalSharedDeep; }; /** * External double nested numeric properties */ export type ExternalDoubleNestedNumeric = { - 0?: string; + numeric1?: ExternalShared1; + numeric2?: ExternalShared1; +}; + +/** + * External nested object reference (A) + */ +export type ExternalNestedObjectA = ExternalSharedExternalNested; + +/** + * External nested object reference (B) - second use + */ +export type ExternalNestedObjectB = ExternalSharedExternalNested; + +/** + * External numeric nested object reference (A) + */ +export type ExternalNestedNumericObjectA = ExternalSharedExternalNestedNumeric; + +/** + * External numeric nested object reference (B) - second use + */ +export type ExternalNestedNumericObjectB = ExternalSharedExternalNestedNumeric; + +/** + * Mixed external property references + */ +export type ExternalMixedProperties = { + id7?: ExternalSharedId; + name1?: ExternalSharedName; + uuid6?: ExternalSharedExternalSharedModelWithUuid; + deep3?: ExternalSharedDeep; + numeric3?: ExternalShared1; +}; + +/** + * Array containing external references + */ +export type ExternalArraySchema = { + items?: Array; + uuidItems?: Array; +}; + +/** + * Union type with external references + */ +export type ExternalUnionSchema = ExternalSharedExternalSharedModel | ExternalSharedExternalSharedModelWithUuid; + +/** + * AllOf with external references + */ +export type ExternalAllOfSchema = ExternalSharedExternalSharedModel & { + additional?: ExternalSharedExternalSharedModelWithUuid; +}; + +/** + * AnyOf with external references + */ +export type ExternalAnyOfSchema = ExternalSharedExternalNested | ExternalSharedExternalNestedNumeric; + +export type ExternalSharedExternalSharedModelWithUuid = string; + +export type ExternalSharedExternalSharedModel = { + id: string; + name?: string; +}; + +export type ExternalSharedId = string; + +export type ExternalSharedExternalNested = { + inner?: { + deep?: string; + }; +}; + +export type ExternalSharedDeep = string; + +export type ExternalShared1 = string; + +export type ExternalSharedName = string; + +export type ExternalSharedExternalNestedNumeric = { + 0?: { + 1?: string; + }; +}; + +export type ExternalIdParam = ExternalSharedId; + +export type ExternalUuidParam = ExternalSharedExternalSharedModelWithUuid; + +export type ExternalDeepParam = ExternalSharedDeep; + +export type ExternalNumericParam = ExternalShared1; + +/** + * Request body using external model + */ +export type ExternalModelBody = ExternalSharedExternalSharedModel; + +/** + * Request body using external UUID + */ +export type ExternalUuidBody = ExternalSharedExternalSharedModelWithUuid; + +/** + * Request body using external nested object + */ +export type ExternalNestedBody = ExternalSharedExternalNested; + +/** + * Request body with mixed external properties + */ +export type ExternalMixedBody = { + id?: ExternalSharedId; + name?: ExternalSharedName; + uuid?: ExternalSharedExternalSharedModelWithUuid; + deep?: ExternalSharedDeep; +}; + +export type GetExternalModelData = { + body?: never; + path: { + id: ExternalSharedId; + }; + query?: { + uuid?: ExternalSharedExternalSharedModelWithUuid; + }; + url: '/external-model'; +}; + +export type GetExternalModelErrors = { + /** + * Response using external UUID + */ + 400: ExternalSharedExternalSharedModelWithUuid; +}; + +export type GetExternalModelError = GetExternalModelErrors[keyof GetExternalModelErrors]; + +export type GetExternalModelResponses = { + /** + * Response using external model + */ + 200: ExternalSharedExternalSharedModel; +}; + +export type GetExternalModelResponse = GetExternalModelResponses[keyof GetExternalModelResponses]; + +export type PostExternalModelData = { + /** + * Request body using external model + */ + body: ExternalModelBody; + path?: never; + query?: never; + url: '/external-model'; +}; + +export type PostExternalModelErrors = { + /** + * Response with union of external types + */ + 422: ExternalSharedExternalSharedModel | ExternalSharedExternalSharedModelWithUuid | ExternalSharedExternalNested; +}; + +export type PostExternalModelError = PostExternalModelErrors[keyof PostExternalModelErrors]; + +export type PostExternalModelResponses = { + /** + * Response using external model + */ + 201: ExternalSharedExternalSharedModel; +}; + +export type PostExternalModelResponse = PostExternalModelResponses[keyof PostExternalModelResponses]; + +export type GetExternalUuidData = { + body?: never; + path?: never; + query?: { + uuid?: ExternalSharedExternalSharedModelWithUuid; + }; + url: '/external-uuid'; +}; + +export type GetExternalUuidResponses = { + /** + * Response using external UUID + */ + 200: ExternalSharedExternalSharedModelWithUuid; +}; + +export type GetExternalUuidResponse = GetExternalUuidResponses[keyof GetExternalUuidResponses]; + +export type PutExternalUuidData = { + /** + * Request body using external UUID + */ + body?: ExternalUuidBody; + path?: never; + query?: never; + url: '/external-uuid'; +}; + +export type PutExternalUuidResponses = { + /** + * Response using external UUID + */ + 200: ExternalSharedExternalSharedModelWithUuid; +}; + +export type PutExternalUuidResponse = PutExternalUuidResponses[keyof PutExternalUuidResponses]; + +export type GetExternalNestedData = { + body?: never; + headers?: { + deep?: ExternalSharedDeep; + }; + path?: never; + query?: never; + url: '/external-nested'; +}; + +export type GetExternalNestedResponses = { + /** + * Response using external nested object + */ + 200: ExternalSharedExternalNested; +}; + +export type GetExternalNestedResponse = GetExternalNestedResponses[keyof GetExternalNestedResponses]; + +export type PostExternalNestedData = { + /** + * Request body using external nested object + */ + body?: ExternalNestedBody; + path?: never; + query?: never; + url: '/external-nested'; +}; + +export type PostExternalNestedResponses = { + /** + * Response using external nested object + */ + 201: ExternalSharedExternalNested; +}; + +export type PostExternalNestedResponse = PostExternalNestedResponses[keyof PostExternalNestedResponses]; + +export type GetExternalMixedData = { + body?: never; + headers?: { + deep?: ExternalSharedDeep; + }; + path: { + id: ExternalSharedId; + }; + query?: { + uuid?: ExternalSharedExternalSharedModelWithUuid; + numeric?: ExternalShared1; + }; + url: '/external-mixed'; +}; + +export type GetExternalMixedResponses = { + /** + * Response with array of external models + */ + 200: Array; +}; + +export type GetExternalMixedResponse = GetExternalMixedResponses[keyof GetExternalMixedResponses]; + +export type PostExternalMixedData = { + /** + * Request body with mixed external properties + */ + body?: ExternalMixedBody; + path?: never; + query?: never; + url: '/external-mixed'; +}; + +export type PostExternalMixedResponses = { + /** + * Response using external model + */ + 201: ExternalSharedExternalSharedModel; }; +export type PostExternalMixedResponse = PostExternalMixedResponses[keyof PostExternalMixedResponses]; + +export type GetExternalArrayData = { + body?: never; + path?: never; + query?: never; + url: '/external-array'; +}; + +export type GetExternalArrayResponses = { + /** + * Response with array of external models + */ + 200: Array; +}; + +export type GetExternalArrayResponse = GetExternalArrayResponses[keyof GetExternalArrayResponses]; + +export type PostExternalArrayData = { + body: Array; + path?: never; + query?: never; + url: '/external-array'; +}; + +export type PostExternalArrayResponses = { + /** + * Response with array of external models + */ + 201: Array; +}; + +export type PostExternalArrayResponse = PostExternalArrayResponses[keyof PostExternalArrayResponses]; + +export type GetExternalUnionData = { + body?: never; + path?: never; + query?: never; + url: '/external-union'; +}; + +export type GetExternalUnionResponses = { + /** + * Response with union of external types + */ + 200: ExternalSharedExternalSharedModel | ExternalSharedExternalSharedModelWithUuid | ExternalSharedExternalNested; +}; + +export type GetExternalUnionResponse = GetExternalUnionResponses[keyof GetExternalUnionResponses]; + +export type PostExternalUnionData = { + body: ExternalSharedExternalSharedModel | ExternalSharedExternalSharedModelWithUuid | ExternalSharedExternalNested; + path?: never; + query?: never; + url: '/external-union'; +}; + +export type PostExternalUnionResponses = { + /** + * Response with union of external types + */ + 201: ExternalSharedExternalSharedModel | ExternalSharedExternalSharedModelWithUuid | ExternalSharedExternalNested; +}; + +export type PostExternalUnionResponse = PostExternalUnionResponses[keyof PostExternalUnionResponses]; + +export type GetExternalPropertiesByIdData = { + body?: never; + headers?: { + deep?: ExternalSharedDeep; + }; + path: { + id: ExternalSharedId; + }; + query?: { + uuid?: ExternalSharedExternalSharedModelWithUuid; + }; + url: '/external-properties/{id}'; +}; + +export type GetExternalPropertiesByIdResponses = { + 200: { + id?: ExternalSharedId; + name?: ExternalSharedName; + uuid?: ExternalSharedExternalSharedModelWithUuid; + deep?: ExternalSharedDeep; + numeric?: ExternalShared1; + }; +}; + +export type GetExternalPropertiesByIdResponse = GetExternalPropertiesByIdResponses[keyof GetExternalPropertiesByIdResponses]; + export type ClientOptions = { baseUrl: `${string}://${string}` | (string & {}); }; \ No newline at end of file diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/schemas/default/schemas.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/schemas/default/schemas.gen.ts index 4e3603d9c..afccf5f14 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/schemas/default/schemas.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/schemas/default/schemas.gen.ts @@ -7,21 +7,12 @@ export const _400Schema = { export const ExternalRefASchema = { description: 'External ref to shared model (A)', - type: 'object', - properties: { - id: { - type: 'string' - }, - name: { - type: 'string' - } - }, - required: ['id'] + '$ref': '#/components/schemas/external-shared_ExternalSharedModel' } as const; export const ExternalRefBSchema = { description: 'External ref to shared model (B)', - '$ref': '#/components/schemas/ExternalRefA' + '$ref': '#/components/schemas/external-shared_ExternalSharedModel' } as const; export const camelCaseCommentWithBreaksSchema = { @@ -1993,6 +1984,19 @@ export const Generic_Schema_Duplicate_Issue_1_System_String_Schema = { additionalProperties: false } as const; +export const external_shared_ExternalSharedModelSchema = { + type: 'object', + properties: { + id: { + type: 'string' + }, + name: { + type: 'string' + } + }, + required: ['id'] +} as const; + export const ModelWithPropertiesWritableSchema = { description: 'This is a model with one nested property', type: 'object', diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/sdk/default/types.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/sdk/default/types.gen.ts index a6ae7c816..f66f6a1f2 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/sdk/default/types.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/sdk/default/types.gen.ts @@ -8,15 +8,12 @@ export type _400 = string; /** * External ref to shared model (A) */ -export type ExternalRefA = { - id: string; - name?: string; -}; +export type ExternalRefA = ExternalSharedExternalSharedModel; /** * External ref to shared model (B) */ -export type ExternalRefB = ExternalRefA; +export type ExternalRefB = ExternalSharedExternalSharedModel; /** * Testing multiline comments in string: First line @@ -974,6 +971,11 @@ export type GenericSchemaDuplicateIssue1SystemString = { readonly hasError?: boolean; }; +export type ExternalSharedExternalSharedModel = { + id: string; + name?: string; +}; + /** * This is a model with one nested property */ diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/sdk/throwOnError/types.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/sdk/throwOnError/types.gen.ts index a6ae7c816..f66f6a1f2 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/sdk/throwOnError/types.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/sdk/throwOnError/types.gen.ts @@ -8,15 +8,12 @@ export type _400 = string; /** * External ref to shared model (A) */ -export type ExternalRefA = { - id: string; - name?: string; -}; +export type ExternalRefA = ExternalSharedExternalSharedModel; /** * External ref to shared model (B) */ -export type ExternalRefB = ExternalRefA; +export type ExternalRefB = ExternalSharedExternalSharedModel; /** * Testing multiline comments in string: First line @@ -974,6 +971,11 @@ export type GenericSchemaDuplicateIssue1SystemString = { readonly hasError?: boolean; }; +export type ExternalSharedExternalSharedModel = { + id: string; + name?: string; +}; + /** * This is a model with one nested property */ diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@pinia/colada/fetch/types.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@pinia/colada/fetch/types.gen.ts index a6ae7c816..f66f6a1f2 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@pinia/colada/fetch/types.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@pinia/colada/fetch/types.gen.ts @@ -8,15 +8,12 @@ export type _400 = string; /** * External ref to shared model (A) */ -export type ExternalRefA = { - id: string; - name?: string; -}; +export type ExternalRefA = ExternalSharedExternalSharedModel; /** * External ref to shared model (B) */ -export type ExternalRefB = ExternalRefA; +export type ExternalRefB = ExternalSharedExternalSharedModel; /** * Testing multiline comments in string: First line @@ -974,6 +971,11 @@ export type GenericSchemaDuplicateIssue1SystemString = { readonly hasError?: boolean; }; +export type ExternalSharedExternalSharedModel = { + id: string; + name?: string; +}; + /** * This is a model with one nested property */ diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@pinia/colada/group-by-tag/types.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@pinia/colada/group-by-tag/types.gen.ts index a6ae7c816..f66f6a1f2 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@pinia/colada/group-by-tag/types.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@pinia/colada/group-by-tag/types.gen.ts @@ -8,15 +8,12 @@ export type _400 = string; /** * External ref to shared model (A) */ -export type ExternalRefA = { - id: string; - name?: string; -}; +export type ExternalRefA = ExternalSharedExternalSharedModel; /** * External ref to shared model (B) */ -export type ExternalRefB = ExternalRefA; +export type ExternalRefB = ExternalSharedExternalSharedModel; /** * Testing multiline comments in string: First line @@ -974,6 +971,11 @@ export type GenericSchemaDuplicateIssue1SystemString = { readonly hasError?: boolean; }; +export type ExternalSharedExternalSharedModel = { + id: string; + name?: string; +}; + /** * This is a model with one nested property */ diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/angular-query-experimental/axios/types.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/angular-query-experimental/axios/types.gen.ts index 99c884c5a..b60ef01dd 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/angular-query-experimental/axios/types.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/angular-query-experimental/axios/types.gen.ts @@ -8,15 +8,12 @@ export type _400 = string; /** * External ref to shared model (A) */ -export type ExternalRefA = { - id: string; - name?: string; -}; +export type ExternalRefA = ExternalSharedExternalSharedModel; /** * External ref to shared model (B) */ -export type ExternalRefB = ExternalRefA; +export type ExternalRefB = ExternalSharedExternalSharedModel; /** * Testing multiline comments in string: First line @@ -974,6 +971,11 @@ export type GenericSchemaDuplicateIssue1SystemString = { readonly hasError?: boolean; }; +export type ExternalSharedExternalSharedModel = { + id: string; + name?: string; +}; + /** * This is a model with one nested property */ diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/angular-query-experimental/fetch/types.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/angular-query-experimental/fetch/types.gen.ts index a6ae7c816..f66f6a1f2 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/angular-query-experimental/fetch/types.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/angular-query-experimental/fetch/types.gen.ts @@ -8,15 +8,12 @@ export type _400 = string; /** * External ref to shared model (A) */ -export type ExternalRefA = { - id: string; - name?: string; -}; +export type ExternalRefA = ExternalSharedExternalSharedModel; /** * External ref to shared model (B) */ -export type ExternalRefB = ExternalRefA; +export type ExternalRefB = ExternalSharedExternalSharedModel; /** * Testing multiline comments in string: First line @@ -974,6 +971,11 @@ export type GenericSchemaDuplicateIssue1SystemString = { readonly hasError?: boolean; }; +export type ExternalSharedExternalSharedModel = { + id: string; + name?: string; +}; + /** * This is a model with one nested property */ diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/react-query/axios/types.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/react-query/axios/types.gen.ts index 99c884c5a..b60ef01dd 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/react-query/axios/types.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/react-query/axios/types.gen.ts @@ -8,15 +8,12 @@ export type _400 = string; /** * External ref to shared model (A) */ -export type ExternalRefA = { - id: string; - name?: string; -}; +export type ExternalRefA = ExternalSharedExternalSharedModel; /** * External ref to shared model (B) */ -export type ExternalRefB = ExternalRefA; +export type ExternalRefB = ExternalSharedExternalSharedModel; /** * Testing multiline comments in string: First line @@ -974,6 +971,11 @@ export type GenericSchemaDuplicateIssue1SystemString = { readonly hasError?: boolean; }; +export type ExternalSharedExternalSharedModel = { + id: string; + name?: string; +}; + /** * This is a model with one nested property */ diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/react-query/fetch/types.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/react-query/fetch/types.gen.ts index a6ae7c816..f66f6a1f2 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/react-query/fetch/types.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/react-query/fetch/types.gen.ts @@ -8,15 +8,12 @@ export type _400 = string; /** * External ref to shared model (A) */ -export type ExternalRefA = { - id: string; - name?: string; -}; +export type ExternalRefA = ExternalSharedExternalSharedModel; /** * External ref to shared model (B) */ -export type ExternalRefB = ExternalRefA; +export type ExternalRefB = ExternalSharedExternalSharedModel; /** * Testing multiline comments in string: First line @@ -974,6 +971,11 @@ export type GenericSchemaDuplicateIssue1SystemString = { readonly hasError?: boolean; }; +export type ExternalSharedExternalSharedModel = { + id: string; + name?: string; +}; + /** * This is a model with one nested property */ diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/solid-query/axios/types.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/solid-query/axios/types.gen.ts index 99c884c5a..b60ef01dd 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/solid-query/axios/types.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/solid-query/axios/types.gen.ts @@ -8,15 +8,12 @@ export type _400 = string; /** * External ref to shared model (A) */ -export type ExternalRefA = { - id: string; - name?: string; -}; +export type ExternalRefA = ExternalSharedExternalSharedModel; /** * External ref to shared model (B) */ -export type ExternalRefB = ExternalRefA; +export type ExternalRefB = ExternalSharedExternalSharedModel; /** * Testing multiline comments in string: First line @@ -974,6 +971,11 @@ export type GenericSchemaDuplicateIssue1SystemString = { readonly hasError?: boolean; }; +export type ExternalSharedExternalSharedModel = { + id: string; + name?: string; +}; + /** * This is a model with one nested property */ diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/solid-query/fetch/types.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/solid-query/fetch/types.gen.ts index a6ae7c816..f66f6a1f2 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/solid-query/fetch/types.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/solid-query/fetch/types.gen.ts @@ -8,15 +8,12 @@ export type _400 = string; /** * External ref to shared model (A) */ -export type ExternalRefA = { - id: string; - name?: string; -}; +export type ExternalRefA = ExternalSharedExternalSharedModel; /** * External ref to shared model (B) */ -export type ExternalRefB = ExternalRefA; +export type ExternalRefB = ExternalSharedExternalSharedModel; /** * Testing multiline comments in string: First line @@ -974,6 +971,11 @@ export type GenericSchemaDuplicateIssue1SystemString = { readonly hasError?: boolean; }; +export type ExternalSharedExternalSharedModel = { + id: string; + name?: string; +}; + /** * This is a model with one nested property */ diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/svelte-query/axios/types.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/svelte-query/axios/types.gen.ts index 99c884c5a..b60ef01dd 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/svelte-query/axios/types.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/svelte-query/axios/types.gen.ts @@ -8,15 +8,12 @@ export type _400 = string; /** * External ref to shared model (A) */ -export type ExternalRefA = { - id: string; - name?: string; -}; +export type ExternalRefA = ExternalSharedExternalSharedModel; /** * External ref to shared model (B) */ -export type ExternalRefB = ExternalRefA; +export type ExternalRefB = ExternalSharedExternalSharedModel; /** * Testing multiline comments in string: First line @@ -974,6 +971,11 @@ export type GenericSchemaDuplicateIssue1SystemString = { readonly hasError?: boolean; }; +export type ExternalSharedExternalSharedModel = { + id: string; + name?: string; +}; + /** * This is a model with one nested property */ diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/svelte-query/fetch/types.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/svelte-query/fetch/types.gen.ts index a6ae7c816..f66f6a1f2 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/svelte-query/fetch/types.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/svelte-query/fetch/types.gen.ts @@ -8,15 +8,12 @@ export type _400 = string; /** * External ref to shared model (A) */ -export type ExternalRefA = { - id: string; - name?: string; -}; +export type ExternalRefA = ExternalSharedExternalSharedModel; /** * External ref to shared model (B) */ -export type ExternalRefB = ExternalRefA; +export type ExternalRefB = ExternalSharedExternalSharedModel; /** * Testing multiline comments in string: First line @@ -974,6 +971,11 @@ export type GenericSchemaDuplicateIssue1SystemString = { readonly hasError?: boolean; }; +export type ExternalSharedExternalSharedModel = { + id: string; + name?: string; +}; + /** * This is a model with one nested property */ diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/vue-query/axios/types.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/vue-query/axios/types.gen.ts index 99c884c5a..b60ef01dd 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/vue-query/axios/types.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/vue-query/axios/types.gen.ts @@ -8,15 +8,12 @@ export type _400 = string; /** * External ref to shared model (A) */ -export type ExternalRefA = { - id: string; - name?: string; -}; +export type ExternalRefA = ExternalSharedExternalSharedModel; /** * External ref to shared model (B) */ -export type ExternalRefB = ExternalRefA; +export type ExternalRefB = ExternalSharedExternalSharedModel; /** * Testing multiline comments in string: First line @@ -974,6 +971,11 @@ export type GenericSchemaDuplicateIssue1SystemString = { readonly hasError?: boolean; }; +export type ExternalSharedExternalSharedModel = { + id: string; + name?: string; +}; + /** * This is a model with one nested property */ diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/vue-query/fetch/types.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/vue-query/fetch/types.gen.ts index a6ae7c816..f66f6a1f2 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/vue-query/fetch/types.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/vue-query/fetch/types.gen.ts @@ -8,15 +8,12 @@ export type _400 = string; /** * External ref to shared model (A) */ -export type ExternalRefA = { - id: string; - name?: string; -}; +export type ExternalRefA = ExternalSharedExternalSharedModel; /** * External ref to shared model (B) */ -export type ExternalRefB = ExternalRefA; +export type ExternalRefB = ExternalSharedExternalSharedModel; /** * Testing multiline comments in string: First line @@ -974,6 +971,11 @@ export type GenericSchemaDuplicateIssue1SystemString = { readonly hasError?: boolean; }; +export type ExternalSharedExternalSharedModel = { + id: string; + name?: string; +}; + /** * This is a model with one nested property */ diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/fastify/default/types.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/fastify/default/types.gen.ts index a6ae7c816..f66f6a1f2 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/fastify/default/types.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/fastify/default/types.gen.ts @@ -8,15 +8,12 @@ export type _400 = string; /** * External ref to shared model (A) */ -export type ExternalRefA = { - id: string; - name?: string; -}; +export type ExternalRefA = ExternalSharedExternalSharedModel; /** * External ref to shared model (B) */ -export type ExternalRefB = ExternalRefA; +export type ExternalRefB = ExternalSharedExternalSharedModel; /** * Testing multiline comments in string: First line @@ -974,6 +971,11 @@ export type GenericSchemaDuplicateIssue1SystemString = { readonly hasError?: boolean; }; +export type ExternalSharedExternalSharedModel = { + id: string; + name?: string; +}; + /** * This is a model with one nested property */ diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/valibot/default/valibot.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/valibot/default/valibot.gen.ts index a5ad1f87c..f01687633 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/valibot/default/valibot.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/valibot/default/valibot.gen.ts @@ -7,18 +7,20 @@ import * as v from 'valibot'; */ export const v400 = v.string(); -/** - * External ref to shared model (A) - */ -export const vExternalRefA = v.object({ +export const vExternalSharedExternalSharedModel = v.object({ id: v.string(), name: v.optional(v.string()) }); +/** + * External ref to shared model (A) + */ +export const vExternalRefA = vExternalSharedExternalSharedModel; + /** * External ref to shared model (B) */ -export const vExternalRefB = vExternalRefA; +export const vExternalRefB = vExternalSharedExternalSharedModel; /** * Testing multiline comments in string: First line diff --git a/packages/openapi-ts-tests/specs/2.0.x/external-shared.json b/packages/openapi-ts-tests/specs/2.0.x/external-shared.json index ed014d790..423e90036 100644 --- a/packages/openapi-ts-tests/specs/2.0.x/external-shared.json +++ b/packages/openapi-ts-tests/specs/2.0.x/external-shared.json @@ -1,10 +1,38 @@ { - "ExternalSharedModel": { - "type": "object", - "properties": { - "id": { "type": "string" }, - "name": { "type": "string" } + "definitions": { + "ExternalSharedModel": { + "type": "object", + "properties": { + "id": { "type": "string" }, + "name": { "type": "string" } + }, + "required": ["id"] }, - "required": ["id"] + "ExternalSharedModelWithUuid": { + "type": "string", + "format": "uuid" + }, + "ExternalNested": { + "type": "object", + "properties": { + "inner": { + "type": "object", + "properties": { + "deep": { "type": "string" } + } + } + } + }, + "ExternalNestedNumeric": { + "type": "object", + "properties": { + "0": { + "type": "object", + "properties": { + "1": { "type": "string" } + } + } + } + } } } diff --git a/packages/openapi-ts-tests/specs/2.0.x/external.yaml b/packages/openapi-ts-tests/specs/2.0.x/external.yaml new file mode 100644 index 000000000..0c483b82d --- /dev/null +++ b/packages/openapi-ts-tests/specs/2.0.x/external.yaml @@ -0,0 +1,405 @@ +swagger: '2.0' +info: + title: Swagger 2.0 external example + version: 1 +# Paths using external references +paths: + /external-model: + get: + summary: Get external model + parameters: + - $ref: '#/parameters/ExternalIdParam' + - $ref: '#/parameters/ExternalUuidParam' + responses: + '200': + $ref: '#/responses/ExternalModelResponse' + '400': + $ref: '#/responses/ExternalUuidResponse' + post: + summary: Create external model + parameters: + - $ref: '#/parameters/ExternalModelBody' + responses: + '201': + $ref: '#/responses/ExternalModelResponse' + '422': + $ref: '#/responses/ExternalUnionResponse' + + /external-uuid: + get: + summary: Get external UUID + parameters: + - $ref: '#/parameters/ExternalUuidParam' + responses: + '200': + $ref: '#/responses/ExternalUuidResponse' + put: + summary: Update external UUID + parameters: + - $ref: '#/parameters/ExternalUuidBody' + responses: + '200': + $ref: '#/responses/ExternalUuidResponse' + + /external-nested: + get: + summary: Get external nested object + parameters: + - $ref: '#/parameters/ExternalDeepParam' + responses: + '200': + $ref: '#/responses/ExternalNestedResponse' + post: + summary: Create external nested object + parameters: + - $ref: '#/parameters/ExternalNestedBody' + responses: + '201': + $ref: '#/responses/ExternalNestedResponse' + + /external-mixed: + get: + summary: Get mixed external data + parameters: + - $ref: '#/parameters/ExternalIdParam' + - $ref: '#/parameters/ExternalUuidParam' + - $ref: '#/parameters/ExternalDeepParam' + - $ref: '#/parameters/ExternalNumericParam' + responses: + '200': + $ref: '#/responses/ExternalArrayResponse' + post: + summary: Create mixed external data + parameters: + - $ref: '#/parameters/ExternalMixedBody' + responses: + '201': + $ref: '#/responses/ExternalModelResponse' + + /external-array: + get: + summary: Get array of external models + responses: + '200': + $ref: '#/responses/ExternalArrayResponse' + post: + summary: Create array of external models + parameters: + - name: body + in: body + required: true + schema: + type: array + items: + $ref: './external-shared.json#/definitions/ExternalSharedModel' + responses: + '201': + $ref: '#/responses/ExternalArrayResponse' + + /external-union: + get: + summary: Get union of external types + responses: + '200': + $ref: '#/responses/ExternalUnionResponse' + post: + summary: Create union of external types + parameters: + - name: body + in: body + required: true + schema: + oneOf: + - $ref: './external-shared.json#/definitions/ExternalSharedModel' + - $ref: './external-shared.json#/definitions/ExternalSharedModelWithUuid' + - $ref: './external-shared.json#/definitions/ExternalNested' + responses: + '201': + $ref: '#/responses/ExternalUnionResponse' + + /external-properties/{id}: + get: + summary: Get external properties + parameters: + - name: id + in: path + required: true + schema: + $ref: './external-shared.json#/definitions/ExternalSharedModel/properties/id' + - name: uuid + in: query + schema: + $ref: './external-shared.json#/definitions/ExternalSharedModelWithUuid' + - name: deep + in: header + schema: + $ref: './external-shared.json#/definitions/ExternalNested/properties/inner/properties/deep' + responses: + '200': + schema: + type: object + properties: + id: + $ref: './external-shared.json#/definitions/ExternalSharedModel/properties/id' + name: + $ref: './external-shared.json#/definitions/ExternalSharedModel/properties/name' + uuid: + $ref: './external-shared.json#/definitions/ExternalSharedModelWithUuid' + deep: + $ref: './external-shared.json#/definitions/ExternalNested/properties/inner/properties/deep' + numeric: + $ref: './external-shared.json#/definitions/ExternalNestedNumeric/properties/0/properties/1' + +# Definitions (equivalent to components/schemas in OpenAPI 3.0) +definitions: + # Basic external schema references (multiple uses of each type) + ExternalSchemaA: + description: External schema (A) + $ref: './external-shared.json#/definitions/ExternalSharedModel' + ExternalSchemaB: + description: External schema (B) - second use of ExternalSharedModel + $ref: './external-shared.json#/definitions/ExternalSharedModel' + ExternalSchemaC: + description: External schema (C) - third use of ExternalSharedModel + $ref: './external-shared.json#/definitions/ExternalSharedModel' + + # Path-based references using /path syntax + ExternalSchemaPathA: + description: External schema via path reference (A) + $ref: './external-shared.json#/definitions/ExternalSharedModel' + ExternalSchemaPathB: + description: External schema via path reference (B) - second use + $ref: './external-shared.json#/definitions/ExternalSharedModel' + + # UUID type references (multiple uses) + ExternalSchemaPropertyA: + description: External schema property (A) + type: object + properties: + uuid1: + $ref: './external-shared.json#/definitions/ExternalSharedModelWithUuid' + ExternalSchemaPropertyB: + description: External schema property (B) - second use of UUID + type: object + properties: + uuid2: + $ref: './external-shared.json#/definitions/ExternalSharedModelWithUuid' + ExternalSchemaPropertyC: + description: External schema property (C) - third use of UUID + type: object + properties: + uuid3: + $ref: './external-shared.json#/definitions/ExternalSharedModelWithUuid' + + # Duplicate refs in same schema + ExternalSchemaPropertyD: + description: External schema property with duplicate refs (D) + type: object + properties: + uuid4: + $ref: './external-shared.json#/definitions/ExternalSharedModelWithUuid' + uuid5: + $ref: './external-shared.json#/definitions/ExternalSharedModelWithUuid' + + # External property references + ExternalSchemaExternalProp: + description: External schema property via external property ref (id) + type: object + properties: + id3: + $ref: './external-shared.json#/definitions/ExternalSharedModel/properties/id' + id4: + $ref: './external-shared.json#/definitions/ExternalSharedModel/properties/id' + + # Alias references + ExternalSchemaExternalPropAlias: + description: Alias to external property via component property ref + type: object + properties: + id5: + $ref: '#/definitions/ExternalSchemaExternalProp/properties/id3' + id6: + $ref: '#/definitions/ExternalSchemaExternalProp/properties/id4' + + # Nested property references (multiple uses) + ExternalDoubleNestedProp: + description: External double nested prop via property ref + type: object + properties: + deep1: + $ref: './external-shared.json#/definitions/ExternalNested/properties/inner/properties/deep' + deep2: + $ref: './external-shared.json#/definitions/ExternalNested/properties/inner/properties/deep' + + # Numeric property references (multiple uses) + ExternalDoubleNestedNumeric: + description: External double nested numeric properties + type: object + properties: + numeric1: + $ref: './external-shared.json#/definitions/ExternalNestedNumeric/properties/0/properties/1' + numeric2: + $ref: './external-shared.json#/definitions/ExternalNestedNumeric/properties/0/properties/1' + + # Complex nested object references + ExternalNestedObjectA: + description: External nested object reference (A) + $ref: './external-shared.json#/definitions/ExternalNested' + ExternalNestedObjectB: + description: External nested object reference (B) - second use + $ref: './external-shared.json#/definitions/ExternalNested' + + # Numeric nested object references + ExternalNestedNumericObjectA: + description: External numeric nested object reference (A) + $ref: './external-shared.json#/definitions/ExternalNestedNumeric' + ExternalNestedNumericObjectB: + description: External numeric nested object reference (B) - second use + $ref: './external-shared.json#/definitions/ExternalNestedNumeric' + + # Mixed property references + ExternalMixedProperties: + description: Mixed external property references + type: object + properties: + id7: + $ref: './external-shared.json#/definitions/ExternalSharedModel/properties/id' + name1: + $ref: './external-shared.json#/definitions/ExternalSharedModel/properties/name' + uuid6: + $ref: './external-shared.json#/definitions/ExternalSharedModelWithUuid' + deep3: + $ref: './external-shared.json#/definitions/ExternalNested/properties/inner/properties/deep' + numeric3: + $ref: './external-shared.json#/definitions/ExternalNestedNumeric/properties/0/properties/1' + + # Array of external references + ExternalArraySchema: + description: Array containing external references + type: object + properties: + items: + type: array + items: + $ref: './external-shared.json#/definitions/ExternalSharedModel' + uuidItems: + type: array + items: + $ref: './external-shared.json#/definitions/ExternalSharedModelWithUuid' + + # Union types with external references + ExternalUnionSchema: + description: Union type with external references + oneOf: + - $ref: './external-shared.json#/definitions/ExternalSharedModel' + - $ref: './external-shared.json#/definitions/ExternalSharedModel' + - $ref: './external-shared.json#/definitions/ExternalSharedModelWithUuid' + - $ref: './external-shared.json#/definitions/ExternalSharedModelWithUuid' + + # AllOf with external references + ExternalAllOfSchema: + description: AllOf with external references + allOf: + - $ref: './external-shared.json#/definitions/ExternalSharedModel' + - $ref: './external-shared.json#/definitions/ExternalSharedModel' + - type: object + properties: + additional: + $ref: './external-shared.json#/definitions/ExternalSharedModelWithUuid' + + # AnyOf with external references + ExternalAnyOfSchema: + description: AnyOf with external references + anyOf: + - $ref: './external-shared.json#/definitions/ExternalNested' + - $ref: './external-shared.json#/definitions/ExternalNested' + - $ref: './external-shared.json#/definitions/ExternalNestedNumeric' + - $ref: './external-shared.json#/definitions/ExternalNestedNumeric' + +# Parameters using external references +parameters: + ExternalIdParam: + name: id + in: path + required: true + schema: + $ref: './external-shared.json#/definitions/ExternalSharedModel/properties/id' + ExternalUuidParam: + name: uuid + in: query + schema: + $ref: './external-shared.json#/definitions/ExternalSharedModelWithUuid' + ExternalDeepParam: + name: deep + in: header + schema: + $ref: './external-shared.json#/definitions/ExternalNested/properties/inner/properties/deep' + ExternalNumericParam: + name: numeric + in: query + schema: + $ref: './external-shared.json#/definitions/ExternalNestedNumeric/properties/0/properties/1' + + # Request bodies using external references + ExternalModelBody: + name: body + in: body + description: Request body using external model + required: true + schema: + $ref: './external-shared.json#/definitions/ExternalSharedModel' + ExternalUuidBody: + name: body + in: body + description: Request body using external UUID + schema: + $ref: './external-shared.json#/definitions/ExternalSharedModelWithUuid' + ExternalNestedBody: + name: body + in: body + description: Request body using external nested object + schema: + $ref: './external-shared.json#/definitions/ExternalNested' + ExternalMixedBody: + name: body + in: body + description: Request body with mixed external properties + schema: + type: object + properties: + id: + $ref: './external-shared.json#/definitions/ExternalSharedModel/properties/id' + name: + $ref: './external-shared.json#/definitions/ExternalSharedModel/properties/name' + uuid: + $ref: './external-shared.json#/definitions/ExternalSharedModelWithUuid' + deep: + $ref: './external-shared.json#/definitions/ExternalNested/properties/inner/properties/deep' + +# Responses using external references +responses: + ExternalModelResponse: + description: Response using external model + schema: + $ref: './external-shared.json#/definitions/ExternalSharedModel' + ExternalUuidResponse: + description: Response using external UUID + schema: + $ref: './external-shared.json#/definitions/ExternalSharedModelWithUuid' + ExternalNestedResponse: + description: Response using external nested object + schema: + $ref: './external-shared.json#/definitions/ExternalNested' + ExternalArrayResponse: + description: Response with array of external models + schema: + type: array + items: + $ref: './external-shared.json#/definitions/ExternalSharedModel' + ExternalUnionResponse: + description: Response with union of external types + schema: + oneOf: + - $ref: './external-shared.json#/definitions/ExternalSharedModel' + - $ref: './external-shared.json#/definitions/ExternalSharedModelWithUuid' + - $ref: './external-shared.json#/definitions/ExternalNested' diff --git a/packages/openapi-ts-tests/specs/2.0.x/full.yaml b/packages/openapi-ts-tests/specs/2.0.x/full.yaml index fc909ea35..cd6dbbc1b 100644 --- a/packages/openapi-ts-tests/specs/2.0.x/full.yaml +++ b/packages/openapi-ts-tests/specs/2.0.x/full.yaml @@ -683,10 +683,10 @@ paths: definitions: ExternalRefA: description: External ref to shared model (A) - $ref: './external-shared.json#/ExternalSharedModel' + $ref: './external-shared.json#/definitions/ExternalSharedModel' ExternalRefB: description: External ref to shared model (B) - $ref: './external-shared.json#/ExternalSharedModel' + $ref: './external-shared.json#/definitions/ExternalSharedModel' CommentWithBreaks: description: |- Testing multiline comments in string: First line diff --git a/packages/openapi-ts-tests/specs/3.0.x/external-shared.json b/packages/openapi-ts-tests/specs/3.0.x/external-shared.json index ed014d790..278ab0761 100644 --- a/packages/openapi-ts-tests/specs/3.0.x/external-shared.json +++ b/packages/openapi-ts-tests/specs/3.0.x/external-shared.json @@ -1,10 +1,40 @@ { - "ExternalSharedModel": { - "type": "object", - "properties": { - "id": { "type": "string" }, - "name": { "type": "string" } - }, - "required": ["id"] + "components": { + "schemas": { + "ExternalSharedModel": { + "type": "object", + "properties": { + "id": { "type": "string" }, + "name": { "type": "string" } + }, + "required": ["id"] + }, + "ExternalSharedModelWithUuid": { + "type": "string", + "format": "uuid" + }, + "ExternalNested": { + "type": "object", + "properties": { + "inner": { + "type": "object", + "properties": { + "deep": { "type": "string" } + } + } + } + }, + "ExternalNestedNumeric": { + "type": "object", + "properties": { + "0": { + "type": "object", + "properties": { + "1": { "type": "string" } + } + } + } + } + } } } diff --git a/packages/openapi-ts-tests/specs/3.0.x/external.yaml b/packages/openapi-ts-tests/specs/3.0.x/external.yaml new file mode 100644 index 000000000..757cb4dbb --- /dev/null +++ b/packages/openapi-ts-tests/specs/3.0.x/external.yaml @@ -0,0 +1,433 @@ +openapi: 3.0.0 +info: + title: OpenAPI 3.0 external example + version: 1 +# Paths using external references +paths: + /external-model: + get: + summary: Get external model + parameters: + - $ref: '#/components/parameters/ExternalIdParam' + - $ref: '#/components/parameters/ExternalUuidParam' + responses: + '200': + $ref: '#/components/responses/ExternalModelResponse' + '400': + $ref: '#/components/responses/ExternalUuidResponse' + post: + summary: Create external model + requestBody: + $ref: '#/components/requestBodies/ExternalModelBody' + responses: + '201': + $ref: '#/components/responses/ExternalModelResponse' + '422': + $ref: '#/components/responses/ExternalUnionResponse' + + /external-uuid: + get: + summary: Get external UUID + parameters: + - $ref: '#/components/parameters/ExternalUuidParam' + responses: + '200': + $ref: '#/components/responses/ExternalUuidResponse' + put: + summary: Update external UUID + requestBody: + $ref: '#/components/requestBodies/ExternalUuidBody' + responses: + '200': + $ref: '#/components/responses/ExternalUuidResponse' + + /external-nested: + get: + summary: Get external nested object + parameters: + - $ref: '#/components/parameters/ExternalDeepParam' + responses: + '200': + $ref: '#/components/responses/ExternalNestedResponse' + post: + summary: Create external nested object + requestBody: + $ref: '#/components/requestBodies/ExternalNestedBody' + responses: + '201': + $ref: '#/components/responses/ExternalNestedResponse' + + /external-mixed: + get: + summary: Get mixed external data + parameters: + - $ref: '#/components/parameters/ExternalIdParam' + - $ref: '#/components/parameters/ExternalUuidParam' + - $ref: '#/components/parameters/ExternalDeepParam' + - $ref: '#/components/parameters/ExternalNumericParam' + responses: + '200': + $ref: '#/components/responses/ExternalArrayResponse' + post: + summary: Create mixed external data + requestBody: + $ref: '#/components/requestBodies/ExternalMixedBody' + responses: + '201': + $ref: '#/components/responses/ExternalModelResponse' + + /external-array: + get: + summary: Get array of external models + responses: + '200': + $ref: '#/components/responses/ExternalArrayResponse' + post: + summary: Create array of external models + requestBody: + content: + application/json: + schema: + type: array + items: + $ref: './external-shared.json#/components/schemas/ExternalSharedModel' + required: true + responses: + '201': + $ref: '#/components/responses/ExternalArrayResponse' + + /external-union: + get: + summary: Get union of external types + responses: + '200': + $ref: '#/components/responses/ExternalUnionResponse' + post: + summary: Create union of external types + requestBody: + content: + application/json: + schema: + oneOf: + - $ref: './external-shared.json#/components/schemas/ExternalSharedModel' + - $ref: './external-shared.json#/components/schemas/ExternalSharedModelWithUuid' + - $ref: './external-shared.json#/components/schemas/ExternalNested' + required: true + responses: + '201': + $ref: '#/components/responses/ExternalUnionResponse' + + /external-properties/{id}: + get: + summary: Get external properties + parameters: + - name: id + in: path + required: true + schema: + $ref: './external-shared.json#/components/schemas/ExternalSharedModel/properties/id' + - name: uuid + in: query + schema: + $ref: './external-shared.json#/components/schemas/ExternalSharedModelWithUuid' + - name: deep + in: header + schema: + $ref: './external-shared.json#/components/schemas/ExternalNested/properties/inner/properties/deep' + responses: + '200': + content: + application/json: + schema: + type: object + properties: + id: + $ref: './external-shared.json#/components/schemas/ExternalSharedModel/properties/id' + name: + $ref: './external-shared.json#/components/schemas/ExternalSharedModel/properties/name' + uuid: + $ref: './external-shared.json#/components/schemas/ExternalSharedModelWithUuid' + deep: + $ref: './external-shared.json#/components/schemas/ExternalNested/properties/inner/properties/deep' + numeric: + $ref: './external-shared.json#/components/schemas/ExternalNestedNumeric/properties/0/properties/1' + +components: + schemas: + # Basic external schema references (multiple uses of each type) + ExternalSchemaA: + description: External schema (A) + $ref: './external-shared.json#/components/schemas/ExternalSharedModel' + ExternalSchemaB: + description: External schema (B) - second use of ExternalSharedModel + $ref: './external-shared.json#/components/schemas/ExternalSharedModel' + ExternalSchemaC: + description: External schema (C) - third use of ExternalSharedModel + $ref: './external-shared.json#/components/schemas/ExternalSharedModel' + + # Path-based references using /path syntax + ExternalSchemaPathA: + description: External schema via path reference (A) + $ref: './external-shared.json#/components/schemas/ExternalSharedModel' + ExternalSchemaPathB: + description: External schema via path reference (B) - second use + $ref: './external-shared.json#/components/schemas/ExternalSharedModel' + + # UUID type references (multiple uses) + ExternalSchemaPropertyA: + description: External schema property (A) + type: object + properties: + uuid1: + $ref: './external-shared.json#/components/schemas/ExternalSharedModelWithUuid' + ExternalSchemaPropertyB: + description: External schema property (B) - second use of UUID + type: object + properties: + uuid2: + $ref: './external-shared.json#/components/schemas/ExternalSharedModelWithUuid' + ExternalSchemaPropertyC: + description: External schema property (C) - third use of UUID + type: object + properties: + uuid3: + $ref: './external-shared.json#/components/schemas/ExternalSharedModelWithUuid' + + # Duplicate refs in same schema + ExternalSchemaPropertyD: + description: External schema property with duplicate refs (D) + type: object + properties: + uuid4: + $ref: './external-shared.json#/components/schemas/ExternalSharedModelWithUuid' + uuid5: + $ref: './external-shared.json#/components/schemas/ExternalSharedModelWithUuid' + + # External property references + ExternalSchemaExternalProp: + description: External schema property via external property ref (id) + type: object + properties: + id3: + $ref: './external-shared.json#/components/schemas/ExternalSharedModel/properties/id' + id4: + $ref: './external-shared.json#/components/schemas/ExternalSharedModel/properties/id' + + # Alias references + ExternalSchemaExternalPropAlias: + description: Alias to external property via component property ref + type: object + properties: + id5: + $ref: '#/components/schemas/ExternalSchemaExternalProp/properties/id3' + id6: + $ref: '#/components/schemas/ExternalSchemaExternalProp/properties/id4' + + # Nested property references (multiple uses) + ExternalDoubleNestedProp: + description: External double nested prop via property ref + type: object + properties: + deep1: + $ref: './external-shared.json#/components/schemas/ExternalNested/properties/inner/properties/deep' + deep2: + $ref: './external-shared.json#/components/schemas/ExternalNested/properties/inner/properties/deep' + + # Numeric property references (multiple uses) + ExternalDoubleNestedNumeric: + description: External double nested numeric properties + type: object + properties: + numeric1: + $ref: './external-shared.json#/components/schemas/ExternalNestedNumeric/properties/0/properties/1' + numeric2: + $ref: './external-shared.json#/components/schemas/ExternalNestedNumeric/properties/0/properties/1' + + # Complex nested object references + ExternalNestedObjectA: + description: External nested object reference (A) + $ref: './external-shared.json#/components/schemas/ExternalNested' + ExternalNestedObjectB: + description: External nested object reference (B) - second use + $ref: './external-shared.json#/components/schemas/ExternalNested' + + # Numeric nested object references + ExternalNestedNumericObjectA: + description: External numeric nested object reference (A) + $ref: './external-shared.json#/components/schemas/ExternalNestedNumeric' + ExternalNestedNumericObjectB: + description: External numeric nested object reference (B) - second use + $ref: './external-shared.json#/components/schemas/ExternalNestedNumeric' + + # Mixed property references + ExternalMixedProperties: + description: Mixed external property references + type: object + properties: + id7: + $ref: './external-shared.json#/components/schemas/ExternalSharedModel/properties/id' + name1: + $ref: './external-shared.json#/components/schemas/ExternalSharedModel/properties/name' + uuid6: + $ref: './external-shared.json#/components/schemas/ExternalSharedModelWithUuid' + deep3: + $ref: './external-shared.json#/components/schemas/ExternalNested/properties/inner/properties/deep' + numeric3: + $ref: './external-shared.json#/components/schemas/ExternalNestedNumeric/properties/0/properties/1' + + # Array of external references + ExternalArraySchema: + description: Array containing external references + type: object + properties: + items: + type: array + items: + $ref: './external-shared.json#/components/schemas/ExternalSharedModel' + uuidItems: + type: array + items: + $ref: './external-shared.json#/components/schemas/ExternalSharedModelWithUuid' + + # Union types with external references + ExternalUnionSchema: + description: Union type with external references + oneOf: + - $ref: './external-shared.json#/components/schemas/ExternalSharedModel' + - $ref: './external-shared.json#/components/schemas/ExternalSharedModel' + - $ref: './external-shared.json#/components/schemas/ExternalSharedModelWithUuid' + - $ref: './external-shared.json#/components/schemas/ExternalSharedModelWithUuid' + + # AllOf with external references + ExternalAllOfSchema: + description: AllOf with external references + allOf: + - $ref: './external-shared.json#/components/schemas/ExternalSharedModel' + - $ref: './external-shared.json#/components/schemas/ExternalSharedModel' + - type: object + properties: + additional: + $ref: './external-shared.json#/components/schemas/ExternalSharedModelWithUuid' + + # AnyOf with external references + ExternalAnyOfSchema: + description: AnyOf with external references + anyOf: + - $ref: './external-shared.json#/components/schemas/ExternalNested' + - $ref: './external-shared.json#/components/schemas/ExternalNested' + - $ref: './external-shared.json#/components/schemas/ExternalNestedNumeric' + - $ref: './external-shared.json#/components/schemas/ExternalNestedNumeric' + + # Parameters using external references + parameters: + ExternalIdParam: + name: id + in: path + required: true + schema: + $ref: './external-shared.json#/components/schemas/ExternalSharedModel/properties/id' + ExternalUuidParam: + name: uuid + in: query + schema: + $ref: './external-shared.json#/components/schemas/ExternalSharedModelWithUuid' + ExternalDeepParam: + name: deep + in: header + schema: + $ref: './external-shared.json#/components/schemas/ExternalNested/properties/inner/properties/deep' + ExternalNumericParam: + name: numeric + in: query + schema: + $ref: './external-shared.json#/components/schemas/ExternalNestedNumeric/properties/0/properties/1' + + # Request bodies using external references + requestBodies: + ExternalModelBody: + description: Request body using external model + required: true + content: + application/json: + schema: + $ref: './external-shared.json#/components/schemas/ExternalSharedModel' + ExternalUuidBody: + description: Request body using external UUID + content: + application/json: + schema: + $ref: './external-shared.json#/components/schemas/ExternalSharedModelWithUuid' + ExternalNestedBody: + description: Request body using external nested object + content: + application/json: + schema: + $ref: './external-shared.json#/components/schemas/ExternalNested' + ExternalMixedBody: + description: Request body with mixed external properties + content: + application/json: + schema: + type: object + properties: + id: + $ref: './external-shared.json#/components/schemas/ExternalSharedModel/properties/id' + name: + $ref: './external-shared.json#/components/schemas/ExternalSharedModel/properties/name' + uuid: + $ref: './external-shared.json#/components/schemas/ExternalSharedModelWithUuid' + deep: + $ref: './external-shared.json#/components/schemas/ExternalNested/properties/inner/properties/deep' + + # Responses using external references + responses: + ExternalModelResponse: + description: Response using external model + content: + application/json: + schema: + $ref: './external-shared.json#/components/schemas/ExternalSharedModel' + ExternalUuidResponse: + description: Response using external UUID + content: + application/json: + schema: + $ref: './external-shared.json#/components/schemas/ExternalSharedModelWithUuid' + ExternalNestedResponse: + description: Response using external nested object + content: + application/json: + schema: + $ref: './external-shared.json#/components/schemas/ExternalNested' + ExternalArrayResponse: + description: Response with array of external models + content: + application/json: + schema: + type: array + items: + $ref: './external-shared.json#/components/schemas/ExternalSharedModel' + ExternalUnionResponse: + description: Response with union of external types + content: + application/json: + schema: + oneOf: + - $ref: './external-shared.json#/components/schemas/ExternalSharedModel' + - $ref: './external-shared.json#/components/schemas/ExternalSharedModelWithUuid' + - $ref: './external-shared.json#/components/schemas/ExternalNested' + + # Headers using external references + headers: + ExternalIdHeader: + description: Header using external ID property + schema: + $ref: './external-shared.json#/components/schemas/ExternalSharedModel/properties/id' + ExternalUuidHeader: + description: Header using external UUID + schema: + $ref: './external-shared.json#/components/schemas/ExternalSharedModelWithUuid' + ExternalDeepHeader: + description: Header using external deep property + schema: + $ref: './external-shared.json#/components/schemas/ExternalNested/properties/inner/properties/deep' diff --git a/packages/openapi-ts-tests/specs/3.0.x/full.yaml b/packages/openapi-ts-tests/specs/3.0.x/full.yaml index c1348f6ed..584be1ddd 100644 --- a/packages/openapi-ts-tests/specs/3.0.x/full.yaml +++ b/packages/openapi-ts-tests/specs/3.0.x/full.yaml @@ -1236,10 +1236,10 @@ components: schemas: ExternalRefA: description: External ref to shared model (A) - $ref: './external-shared.json#/ExternalSharedModel' + $ref: './external-shared.json#/components/schemas/ExternalSharedModel' ExternalRefB: description: External ref to shared model (B) - $ref: './external-shared.json#/ExternalSharedModel' + $ref: './external-shared.json#/components/schemas/ExternalSharedModel' '400': description: Model with number-only name type: string diff --git a/packages/openapi-ts-tests/specs/3.1.x/external-shared.json b/packages/openapi-ts-tests/specs/3.1.x/external-shared.json index 4f0914ca9..278ab0761 100644 --- a/packages/openapi-ts-tests/specs/3.1.x/external-shared.json +++ b/packages/openapi-ts-tests/specs/3.1.x/external-shared.json @@ -1,34 +1,38 @@ { - "ExternalSharedModel": { - "type": "object", - "properties": { - "id": { "type": "string" }, - "name": { "type": "string" } - }, - "required": ["id"] - }, - "ExternalSharedModelWithUuid": { - "type": "string", - "format": "uuid" - }, - "ExternalNested": { - "type": "object", - "properties": { - "inner": { + "components": { + "schemas": { + "ExternalSharedModel": { "type": "object", "properties": { - "deep": { "type": "string" } + "id": { "type": "string" }, + "name": { "type": "string" } + }, + "required": ["id"] + }, + "ExternalSharedModelWithUuid": { + "type": "string", + "format": "uuid" + }, + "ExternalNested": { + "type": "object", + "properties": { + "inner": { + "type": "object", + "properties": { + "deep": { "type": "string" } + } + } } - } - } - }, - "ExternalNestedNumeric": { - "type": "object", - "properties": { - "0": { + }, + "ExternalNestedNumeric": { "type": "object", "properties": { - "1": { "type": "string" } + "0": { + "type": "object", + "properties": { + "1": { "type": "string" } + } + } } } } diff --git a/packages/openapi-ts-tests/specs/3.1.x/external.yaml b/packages/openapi-ts-tests/specs/3.1.x/external.yaml index 1be6db44b..b688225b2 100644 --- a/packages/openapi-ts-tests/specs/3.1.x/external.yaml +++ b/packages/openapi-ts-tests/specs/3.1.x/external.yaml @@ -2,55 +2,432 @@ openapi: 3.1.1 info: title: OpenAPI 3.1.1 external example version: 1 +# Paths using external references +paths: + /external-model: + get: + summary: Get external model + parameters: + - $ref: '#/components/parameters/ExternalIdParam' + - $ref: '#/components/parameters/ExternalUuidParam' + responses: + '200': + $ref: '#/components/responses/ExternalModelResponse' + '400': + $ref: '#/components/responses/ExternalUuidResponse' + post: + summary: Create external model + requestBody: + $ref: '#/components/requestBodies/ExternalModelBody' + responses: + '201': + $ref: '#/components/responses/ExternalModelResponse' + '422': + $ref: '#/components/responses/ExternalUnionResponse' + + /external-uuid: + get: + summary: Get external UUID + parameters: + - $ref: '#/components/parameters/ExternalUuidParam' + responses: + '200': + $ref: '#/components/responses/ExternalUuidResponse' + put: + summary: Update external UUID + requestBody: + $ref: '#/components/requestBodies/ExternalUuidBody' + responses: + '200': + $ref: '#/components/responses/ExternalUuidResponse' + + /external-nested: + get: + summary: Get external nested object + parameters: + - $ref: '#/components/parameters/ExternalDeepParam' + responses: + '200': + $ref: '#/components/responses/ExternalNestedResponse' + post: + summary: Create external nested object + requestBody: + $ref: '#/components/requestBodies/ExternalNestedBody' + responses: + '201': + $ref: '#/components/responses/ExternalNestedResponse' + + /external-mixed: + get: + summary: Get mixed external data + parameters: + - $ref: '#/components/parameters/ExternalIdParam' + - $ref: '#/components/parameters/ExternalUuidParam' + - $ref: '#/components/parameters/ExternalDeepParam' + - $ref: '#/components/parameters/ExternalNumericParam' + responses: + '200': + $ref: '#/components/responses/ExternalArrayResponse' + post: + summary: Create mixed external data + requestBody: + $ref: '#/components/requestBodies/ExternalMixedBody' + responses: + '201': + $ref: '#/components/responses/ExternalModelResponse' + + /external-array: + get: + summary: Get array of external models + responses: + '200': + $ref: '#/components/responses/ExternalArrayResponse' + post: + summary: Create array of external models + requestBody: + content: + application/json: + schema: + type: array + items: + $ref: './external-shared.json#/components/schemas/ExternalSharedModel' + required: true + responses: + '201': + $ref: '#/components/responses/ExternalArrayResponse' + + /external-union: + get: + summary: Get union of external types + responses: + '200': + $ref: '#/components/responses/ExternalUnionResponse' + post: + summary: Create union of external types + requestBody: + content: + application/json: + schema: + oneOf: + - $ref: './external-shared.json#/components/schemas/ExternalSharedModel' + - $ref: './external-shared.json#/components/schemas/ExternalSharedModelWithUuid' + - $ref: './external-shared.json#/components/schemas/ExternalNested' + required: true + responses: + '201': + $ref: '#/components/responses/ExternalUnionResponse' + + /external-properties/{id}: + get: + summary: Get external properties + parameters: + - name: id + in: path + required: true + schema: + $ref: './external-shared.json#/components/schemas/ExternalSharedModel/properties/id' + - name: uuid + in: query + schema: + $ref: './external-shared.json#/components/schemas/ExternalSharedModelWithUuid' + - name: deep + in: header + schema: + $ref: './external-shared.json#/components/schemas/ExternalNested/properties/inner/properties/deep' + responses: + '200': + content: + application/json: + schema: + type: object + properties: + id: + $ref: './external-shared.json#/components/schemas/ExternalSharedModel/properties/id' + name: + $ref: './external-shared.json#/components/schemas/ExternalSharedModel/properties/name' + uuid: + $ref: './external-shared.json#/components/schemas/ExternalSharedModelWithUuid' + deep: + $ref: './external-shared.json#/components/schemas/ExternalNested/properties/inner/properties/deep' + numeric: + $ref: './external-shared.json#/components/schemas/ExternalNestedNumeric/properties/0/properties/1' + components: schemas: + # Basic external schema references (multiple uses of each type) ExternalSchemaA: description: External schema (A) - $ref: './external-shared.json#/ExternalSharedModel' + $ref: './external-shared.json#/components/schemas/ExternalSharedModel' ExternalSchemaB: - description: External schema (B) - $ref: './external-shared.json#/ExternalSharedModel' + description: External schema (B) - second use of ExternalSharedModel + $ref: './external-shared.json#/components/schemas/ExternalSharedModel' ExternalSchemaC: - description: External schema (C) - $ref: './external-shared.json#/ExternalSharedModel' + description: External schema (C) - third use of ExternalSharedModel + $ref: './external-shared.json#/components/schemas/ExternalSharedModel' + + # Path-based references using /path syntax + ExternalSchemaPathA: + description: External schema via path reference (A) + $ref: './external-shared.json#/components/schemas/ExternalSharedModel' + ExternalSchemaPathB: + description: External schema via path reference (B) - second use + $ref: './external-shared.json#/components/schemas/ExternalSharedModel' + + # UUID type references (multiple uses) ExternalSchemaPropertyA: description: External schema property (A) type: object properties: - - $ref: './external-shared.json#/ExternalSharedModelWithUuid' + uuid1: + $ref: './external-shared.json#/components/schemas/ExternalSharedModelWithUuid' ExternalSchemaPropertyB: - description: External schema property (B) + description: External schema property (B) - second use of UUID type: object properties: - - $ref: './external-shared.json#/ExternalSharedModelWithUuid' - ExternalSchemaPropertyFromComponent: - description: External schema property from component (A.id) + uuid2: + $ref: './external-shared.json#/components/schemas/ExternalSharedModelWithUuid' + ExternalSchemaPropertyC: + description: External schema property (C) - third use of UUID type: object properties: - - $ref: '#/components/schemas/ExternalSchemaA/properties/id' + uuid3: + $ref: './external-shared.json#/components/schemas/ExternalSharedModelWithUuid' + + # Duplicate refs in same schema ExternalSchemaPropertyD: description: External schema property with duplicate refs (D) type: object properties: - - $ref: './external-shared.json#/ExternalSharedModelWithUuid' - - $ref: './external-shared.json#/ExternalSharedModelWithUuid' + uuid4: + $ref: './external-shared.json#/components/schemas/ExternalSharedModelWithUuid' + uuid5: + $ref: './external-shared.json#/components/schemas/ExternalSharedModelWithUuid' + + # External property references ExternalSchemaExternalProp: description: External schema property via external property ref (id) type: object properties: - - $ref: './external-shared.json#/ExternalSharedModel/properties/id' + id3: + $ref: './external-shared.json#/components/schemas/ExternalSharedModel/properties/id' + id4: + $ref: './external-shared.json#/components/schemas/ExternalSharedModel/properties/id' + + # Alias references ExternalSchemaExternalPropAlias: description: Alias to external property via component property ref type: object properties: - - $ref: '#/components/schemas/ExternalSchemaExternalProp/properties/0' + id5: + $ref: '#/components/schemas/ExternalSchemaExternalProp/properties/id3' + id6: + $ref: '#/components/schemas/ExternalSchemaExternalProp/properties/id4' + + # Nested property references (multiple uses) ExternalDoubleNestedProp: description: External double nested prop via property ref type: object properties: - - $ref: './external-shared.json#/ExternalNested/properties/inner/properties/deep' + deep1: + $ref: './external-shared.json#/components/schemas/ExternalNested/properties/inner/properties/deep' + deep2: + $ref: './external-shared.json#/components/schemas/ExternalNested/properties/inner/properties/deep' + + # Numeric property references (multiple uses) ExternalDoubleNestedNumeric: description: External double nested numeric properties type: object properties: - - $ref: './external-shared.json#/ExternalNestedNumeric/properties/0/properties/1' + numeric1: + $ref: './external-shared.json#/components/schemas/ExternalNestedNumeric/properties/0/properties/1' + numeric2: + $ref: './external-shared.json#/components/schemas/ExternalNestedNumeric/properties/0/properties/1' + + # Complex nested object references + ExternalNestedObjectA: + description: External nested object reference (A) + $ref: './external-shared.json#/components/schemas/ExternalNested' + ExternalNestedObjectB: + description: External nested object reference (B) - second use + $ref: './external-shared.json#/components/schemas/ExternalNested' + + # Numeric nested object references + ExternalNestedNumericObjectA: + description: External numeric nested object reference (A) + $ref: './external-shared.json#/components/schemas/ExternalNestedNumeric' + ExternalNestedNumericObjectB: + description: External numeric nested object reference (B) - second use + $ref: './external-shared.json#/components/schemas/ExternalNestedNumeric' + + # Mixed property references + ExternalMixedProperties: + description: Mixed external property references + type: object + properties: + id7: + $ref: './external-shared.json#/components/schemas/ExternalSharedModel/properties/id' + name1: + $ref: './external-shared.json#/components/schemas/ExternalSharedModel/properties/name' + uuid6: + $ref: './external-shared.json#/components/schemas/ExternalSharedModelWithUuid' + deep3: + $ref: './external-shared.json#/components/schemas/ExternalNested/properties/inner/properties/deep' + numeric3: + $ref: './external-shared.json#/components/schemas/ExternalNestedNumeric/properties/0/properties/1' + + # Array of external references + ExternalArraySchema: + description: Array containing external references + type: object + properties: + items: + type: array + items: + $ref: './external-shared.json#/components/schemas/ExternalSharedModel' + uuidItems: + type: array + items: + $ref: './external-shared.json#/components/schemas/ExternalSharedModelWithUuid' + + # Union types with external references + ExternalUnionSchema: + description: Union type with external references + oneOf: + - $ref: './external-shared.json#/components/schemas/ExternalSharedModel' + - $ref: './external-shared.json#/components/schemas/ExternalSharedModel' + - $ref: './external-shared.json#/components/schemas/ExternalSharedModelWithUuid' + - $ref: './external-shared.json#/components/schemas/ExternalSharedModelWithUuid' + + # AllOf with external references + ExternalAllOfSchema: + description: AllOf with external references + allOf: + - $ref: './external-shared.json#/components/schemas/ExternalSharedModel' + - $ref: './external-shared.json#/components/schemas/ExternalSharedModel' + - type: object + properties: + additional: + $ref: './external-shared.json#/components/schemas/ExternalSharedModelWithUuid' + + # AnyOf with external references + ExternalAnyOfSchema: + description: AnyOf with external references + anyOf: + - $ref: './external-shared.json#/components/schemas/ExternalNested' + - $ref: './external-shared.json#/components/schemas/ExternalNested' + - $ref: './external-shared.json#/components/schemas/ExternalNestedNumeric' + - $ref: './external-shared.json#/components/schemas/ExternalNestedNumeric' + + # Parameters using external references + parameters: + ExternalIdParam: + name: id + in: path + required: true + schema: + $ref: './external-shared.json#/components/schemas/ExternalSharedModel/properties/id' + ExternalUuidParam: + name: uuid + in: query + schema: + $ref: './external-shared.json#/components/schemas/ExternalSharedModelWithUuid' + ExternalDeepParam: + name: deep + in: header + schema: + $ref: './external-shared.json#/components/schemas/ExternalNested/properties/inner/properties/deep' + ExternalNumericParam: + name: numeric + in: query + schema: + $ref: './external-shared.json#/components/schemas/ExternalNestedNumeric/properties/0/properties/1' + + # Request bodies using external references + requestBodies: + ExternalModelBody: + description: Request body using external model + required: true + content: + application/json: + schema: + $ref: './external-shared.json#/components/schemas/ExternalSharedModel' + ExternalUuidBody: + description: Request body using external UUID + content: + application/json: + schema: + $ref: './external-shared.json#/components/schemas/ExternalSharedModelWithUuid' + ExternalNestedBody: + description: Request body using external nested object + content: + application/json: + schema: + $ref: './external-shared.json#/components/schemas/ExternalNested' + ExternalMixedBody: + description: Request body with mixed external properties + content: + application/json: + schema: + type: object + properties: + id: + $ref: './external-shared.json#/components/schemas/ExternalSharedModel/properties/id' + name: + $ref: './external-shared.json#/components/schemas/ExternalSharedModel/properties/name' + uuid: + $ref: './external-shared.json#/components/schemas/ExternalSharedModelWithUuid' + deep: + $ref: './external-shared.json#/components/schemas/ExternalNested/properties/inner/properties/deep' + + # Responses using external references + responses: + ExternalModelResponse: + description: Response using external model + content: + application/json: + schema: + $ref: './external-shared.json#/components/schemas/ExternalSharedModel' + ExternalUuidResponse: + description: Response using external UUID + content: + application/json: + schema: + $ref: './external-shared.json#/components/schemas/ExternalSharedModelWithUuid' + ExternalNestedResponse: + description: Response using external nested object + content: + application/json: + schema: + $ref: './external-shared.json#/components/schemas/ExternalNested' + ExternalArrayResponse: + description: Response with array of external models + content: + application/json: + schema: + type: array + items: + $ref: './external-shared.json#/components/schemas/ExternalSharedModel' + ExternalUnionResponse: + description: Response with union of external types + content: + application/json: + schema: + oneOf: + - $ref: './external-shared.json#/components/schemas/ExternalSharedModel' + - $ref: './external-shared.json#/components/schemas/ExternalSharedModelWithUuid' + - $ref: './external-shared.json#/components/schemas/ExternalNested' + + # Headers using external references + headers: + ExternalIdHeader: + description: Header using external ID property + schema: + $ref: './external-shared.json#/components/schemas/ExternalSharedModel/properties/id' + ExternalUuidHeader: + description: Header using external UUID + schema: + $ref: './external-shared.json#/components/schemas/ExternalSharedModelWithUuid' + ExternalDeepHeader: + description: Header using external deep property + schema: + $ref: './external-shared.json#/components/schemas/ExternalNested/properties/inner/properties/deep' diff --git a/packages/openapi-ts-tests/specs/3.1.x/full.yaml b/packages/openapi-ts-tests/specs/3.1.x/full.yaml index a3fdaca88..fcf589175 100644 --- a/packages/openapi-ts-tests/specs/3.1.x/full.yaml +++ b/packages/openapi-ts-tests/specs/3.1.x/full.yaml @@ -1269,10 +1269,10 @@ components: schemas: ExternalRefA: description: External ref to shared model (A) - $ref: './external-shared.json#/ExternalSharedModel' + $ref: './external-shared.json#/components/schemas/ExternalSharedModel' ExternalRefB: description: External ref to shared model (B) - $ref: './external-shared.json#/ExternalSharedModel' + $ref: './external-shared.json#/components/schemas/ExternalSharedModel' '400': description: Model with number-only name type: string diff --git a/packages/openapi-ts-tests/zod/v3/__snapshots__/2.0.x/mini/default/zod.gen.ts b/packages/openapi-ts-tests/zod/v3/__snapshots__/2.0.x/mini/default/zod.gen.ts index cb368ca32..fac119ef0 100644 --- a/packages/openapi-ts-tests/zod/v3/__snapshots__/2.0.x/mini/default/zod.gen.ts +++ b/packages/openapi-ts-tests/zod/v3/__snapshots__/2.0.x/mini/default/zod.gen.ts @@ -2,15 +2,14 @@ import * as z from 'zod/v4-mini'; -/** - * External ref to shared model (A) - */ -export const zExternalRefA = z.object({ +export const zExternalSharedExternalSharedModel = z.object({ id: z.string(), name: z.optional(z.string()) }); -export const zExternalRefB = zExternalRefA; +export const zExternalRefA = zExternalSharedExternalSharedModel; + +export const zExternalRefB = zExternalSharedExternalSharedModel; /** * Testing multiline comments in string: First line diff --git a/packages/openapi-ts-tests/zod/v3/__snapshots__/2.0.x/v3/default/zod.gen.ts b/packages/openapi-ts-tests/zod/v3/__snapshots__/2.0.x/v3/default/zod.gen.ts index cb36aceab..199445536 100644 --- a/packages/openapi-ts-tests/zod/v3/__snapshots__/2.0.x/v3/default/zod.gen.ts +++ b/packages/openapi-ts-tests/zod/v3/__snapshots__/2.0.x/v3/default/zod.gen.ts @@ -2,15 +2,14 @@ import { z } from 'zod'; -/** - * External ref to shared model (A) - */ -export const zExternalRefA = z.object({ +export const zExternalSharedExternalSharedModel = z.object({ id: z.string(), name: z.string().optional() }); -export const zExternalRefB = zExternalRefA; +export const zExternalRefA = zExternalSharedExternalSharedModel; + +export const zExternalRefB = zExternalSharedExternalSharedModel; /** * Testing multiline comments in string: First line diff --git a/packages/openapi-ts-tests/zod/v3/__snapshots__/2.0.x/v4/default/zod.gen.ts b/packages/openapi-ts-tests/zod/v3/__snapshots__/2.0.x/v4/default/zod.gen.ts index a91f5d3a2..bd11e0d9e 100644 --- a/packages/openapi-ts-tests/zod/v3/__snapshots__/2.0.x/v4/default/zod.gen.ts +++ b/packages/openapi-ts-tests/zod/v3/__snapshots__/2.0.x/v4/default/zod.gen.ts @@ -2,15 +2,14 @@ import { z } from 'zod/v4'; -/** - * External ref to shared model (A) - */ -export const zExternalRefA = z.object({ +export const zExternalSharedExternalSharedModel = z.object({ id: z.string(), name: z.optional(z.string()) }); -export const zExternalRefB = zExternalRefA; +export const zExternalRefA = zExternalSharedExternalSharedModel; + +export const zExternalRefB = zExternalSharedExternalSharedModel; /** * Testing multiline comments in string: First line diff --git a/packages/openapi-ts-tests/zod/v3/__snapshots__/3.0.x/mini/default/zod.gen.ts b/packages/openapi-ts-tests/zod/v3/__snapshots__/3.0.x/mini/default/zod.gen.ts index 00db31941..94712ccd0 100644 --- a/packages/openapi-ts-tests/zod/v3/__snapshots__/3.0.x/mini/default/zod.gen.ts +++ b/packages/openapi-ts-tests/zod/v3/__snapshots__/3.0.x/mini/default/zod.gen.ts @@ -7,15 +7,14 @@ import * as z from 'zod/v4-mini'; */ export const z400 = z.string(); -/** - * External ref to shared model (A) - */ -export const zExternalRefA = z.object({ +export const zExternalSharedExternalSharedModel = z.object({ id: z.string(), name: z.optional(z.string()) }); -export const zExternalRefB = zExternalRefA; +export const zExternalRefA = zExternalSharedExternalSharedModel; + +export const zExternalRefB = zExternalSharedExternalSharedModel; /** * Testing multiline comments in string: First line diff --git a/packages/openapi-ts-tests/zod/v3/__snapshots__/3.0.x/v3/default/zod.gen.ts b/packages/openapi-ts-tests/zod/v3/__snapshots__/3.0.x/v3/default/zod.gen.ts index c20ab70d3..fa93133da 100644 --- a/packages/openapi-ts-tests/zod/v3/__snapshots__/3.0.x/v3/default/zod.gen.ts +++ b/packages/openapi-ts-tests/zod/v3/__snapshots__/3.0.x/v3/default/zod.gen.ts @@ -7,15 +7,14 @@ import { z } from 'zod'; */ export const z400 = z.string(); -/** - * External ref to shared model (A) - */ -export const zExternalRefA = z.object({ +export const zExternalSharedExternalSharedModel = z.object({ id: z.string(), name: z.string().optional() }); -export const zExternalRefB = zExternalRefA; +export const zExternalRefA = zExternalSharedExternalSharedModel; + +export const zExternalRefB = zExternalSharedExternalSharedModel; /** * Testing multiline comments in string: First line diff --git a/packages/openapi-ts-tests/zod/v3/__snapshots__/3.0.x/v4/default/zod.gen.ts b/packages/openapi-ts-tests/zod/v3/__snapshots__/3.0.x/v4/default/zod.gen.ts index 421e0aa85..5a6d90834 100644 --- a/packages/openapi-ts-tests/zod/v3/__snapshots__/3.0.x/v4/default/zod.gen.ts +++ b/packages/openapi-ts-tests/zod/v3/__snapshots__/3.0.x/v4/default/zod.gen.ts @@ -7,15 +7,14 @@ import { z } from 'zod/v4'; */ export const z400 = z.string(); -/** - * External ref to shared model (A) - */ -export const zExternalRefA = z.object({ +export const zExternalSharedExternalSharedModel = z.object({ id: z.string(), name: z.optional(z.string()) }); -export const zExternalRefB = zExternalRefA; +export const zExternalRefA = zExternalSharedExternalSharedModel; + +export const zExternalRefB = zExternalSharedExternalSharedModel; /** * Testing multiline comments in string: First line diff --git a/packages/openapi-ts-tests/zod/v3/__snapshots__/3.1.x/mini/default/zod.gen.ts b/packages/openapi-ts-tests/zod/v3/__snapshots__/3.1.x/mini/default/zod.gen.ts index 16a5124de..f292838d9 100644 --- a/packages/openapi-ts-tests/zod/v3/__snapshots__/3.1.x/mini/default/zod.gen.ts +++ b/packages/openapi-ts-tests/zod/v3/__snapshots__/3.1.x/mini/default/zod.gen.ts @@ -7,18 +7,20 @@ import * as z from 'zod/v4-mini'; */ export const z400 = z.string(); -/** - * External ref to shared model (A) - */ -export const zExternalRefA = z.object({ +export const zExternalSharedExternalSharedModel = z.object({ id: z.string(), name: z.optional(z.string()) }); +/** + * External ref to shared model (A) + */ +export const zExternalRefA = zExternalSharedExternalSharedModel; + /** * External ref to shared model (B) */ -export const zExternalRefB = zExternalRefA; +export const zExternalRefB = zExternalSharedExternalSharedModel; /** * Testing multiline comments in string: First line diff --git a/packages/openapi-ts-tests/zod/v3/__snapshots__/3.1.x/v3/default/zod.gen.ts b/packages/openapi-ts-tests/zod/v3/__snapshots__/3.1.x/v3/default/zod.gen.ts index f26162507..284af38ad 100644 --- a/packages/openapi-ts-tests/zod/v3/__snapshots__/3.1.x/v3/default/zod.gen.ts +++ b/packages/openapi-ts-tests/zod/v3/__snapshots__/3.1.x/v3/default/zod.gen.ts @@ -7,18 +7,20 @@ import { z } from 'zod'; */ export const z400 = z.string(); -/** - * External ref to shared model (A) - */ -export const zExternalRefA = z.object({ +export const zExternalSharedExternalSharedModel = z.object({ id: z.string(), name: z.string().optional() }); +/** + * External ref to shared model (A) + */ +export const zExternalRefA = zExternalSharedExternalSharedModel; + /** * External ref to shared model (B) */ -export const zExternalRefB = zExternalRefA; +export const zExternalRefB = zExternalSharedExternalSharedModel; /** * Testing multiline comments in string: First line diff --git a/packages/openapi-ts-tests/zod/v3/__snapshots__/3.1.x/v4/default/zod.gen.ts b/packages/openapi-ts-tests/zod/v3/__snapshots__/3.1.x/v4/default/zod.gen.ts index 58d7f2983..c6380f76b 100644 --- a/packages/openapi-ts-tests/zod/v3/__snapshots__/3.1.x/v4/default/zod.gen.ts +++ b/packages/openapi-ts-tests/zod/v3/__snapshots__/3.1.x/v4/default/zod.gen.ts @@ -7,18 +7,20 @@ import { z } from 'zod/v4'; */ export const z400 = z.string(); -/** - * External ref to shared model (A) - */ -export const zExternalRefA = z.object({ +export const zExternalSharedExternalSharedModel = z.object({ id: z.string(), name: z.optional(z.string()) }); +/** + * External ref to shared model (A) + */ +export const zExternalRefA = zExternalSharedExternalSharedModel; + /** * External ref to shared model (B) */ -export const zExternalRefB = zExternalRefA; +export const zExternalRefB = zExternalSharedExternalSharedModel; /** * Testing multiline comments in string: First line diff --git a/packages/openapi-ts-tests/zod/v4/__snapshots__/2.0.x/mini/default/zod.gen.ts b/packages/openapi-ts-tests/zod/v4/__snapshots__/2.0.x/mini/default/zod.gen.ts index 0f536bb70..b1217abc0 100644 --- a/packages/openapi-ts-tests/zod/v4/__snapshots__/2.0.x/mini/default/zod.gen.ts +++ b/packages/openapi-ts-tests/zod/v4/__snapshots__/2.0.x/mini/default/zod.gen.ts @@ -2,15 +2,14 @@ import * as z from 'zod/mini'; -/** - * External ref to shared model (A) - */ -export const zExternalRefA = z.object({ +export const zExternalSharedExternalSharedModel = z.object({ id: z.string(), name: z.optional(z.string()) }); -export const zExternalRefB = zExternalRefA; +export const zExternalRefA = zExternalSharedExternalSharedModel; + +export const zExternalRefB = zExternalSharedExternalSharedModel; /** * Testing multiline comments in string: First line diff --git a/packages/openapi-ts-tests/zod/v4/__snapshots__/2.0.x/v3/default/zod.gen.ts b/packages/openapi-ts-tests/zod/v4/__snapshots__/2.0.x/v3/default/zod.gen.ts index a7b39717f..ce259bece 100644 --- a/packages/openapi-ts-tests/zod/v4/__snapshots__/2.0.x/v3/default/zod.gen.ts +++ b/packages/openapi-ts-tests/zod/v4/__snapshots__/2.0.x/v3/default/zod.gen.ts @@ -2,15 +2,14 @@ import { z } from 'zod/v3'; -/** - * External ref to shared model (A) - */ -export const zExternalRefA = z.object({ +export const zExternalSharedExternalSharedModel = z.object({ id: z.string(), name: z.string().optional() }); -export const zExternalRefB = zExternalRefA; +export const zExternalRefA = zExternalSharedExternalSharedModel; + +export const zExternalRefB = zExternalSharedExternalSharedModel; /** * Testing multiline comments in string: First line diff --git a/packages/openapi-ts-tests/zod/v4/__snapshots__/2.0.x/v4/default/zod.gen.ts b/packages/openapi-ts-tests/zod/v4/__snapshots__/2.0.x/v4/default/zod.gen.ts index 851cea9c1..31b6dd3b8 100644 --- a/packages/openapi-ts-tests/zod/v4/__snapshots__/2.0.x/v4/default/zod.gen.ts +++ b/packages/openapi-ts-tests/zod/v4/__snapshots__/2.0.x/v4/default/zod.gen.ts @@ -2,15 +2,14 @@ import { z } from 'zod'; -/** - * External ref to shared model (A) - */ -export const zExternalRefA = z.object({ +export const zExternalSharedExternalSharedModel = z.object({ id: z.string(), name: z.optional(z.string()) }); -export const zExternalRefB = zExternalRefA; +export const zExternalRefA = zExternalSharedExternalSharedModel; + +export const zExternalRefB = zExternalSharedExternalSharedModel; /** * Testing multiline comments in string: First line diff --git a/packages/openapi-ts-tests/zod/v4/__snapshots__/3.0.x/mini/default/zod.gen.ts b/packages/openapi-ts-tests/zod/v4/__snapshots__/3.0.x/mini/default/zod.gen.ts index b31658b3b..315648e1b 100644 --- a/packages/openapi-ts-tests/zod/v4/__snapshots__/3.0.x/mini/default/zod.gen.ts +++ b/packages/openapi-ts-tests/zod/v4/__snapshots__/3.0.x/mini/default/zod.gen.ts @@ -7,15 +7,14 @@ import * as z from 'zod/mini'; */ export const z400 = z.string(); -/** - * External ref to shared model (A) - */ -export const zExternalRefA = z.object({ +export const zExternalSharedExternalSharedModel = z.object({ id: z.string(), name: z.optional(z.string()) }); -export const zExternalRefB = zExternalRefA; +export const zExternalRefA = zExternalSharedExternalSharedModel; + +export const zExternalRefB = zExternalSharedExternalSharedModel; /** * Testing multiline comments in string: First line diff --git a/packages/openapi-ts-tests/zod/v4/__snapshots__/3.0.x/v3/default/zod.gen.ts b/packages/openapi-ts-tests/zod/v4/__snapshots__/3.0.x/v3/default/zod.gen.ts index 668ef7ffc..83b4147f1 100644 --- a/packages/openapi-ts-tests/zod/v4/__snapshots__/3.0.x/v3/default/zod.gen.ts +++ b/packages/openapi-ts-tests/zod/v4/__snapshots__/3.0.x/v3/default/zod.gen.ts @@ -7,15 +7,14 @@ import { z } from 'zod/v3'; */ export const z400 = z.string(); -/** - * External ref to shared model (A) - */ -export const zExternalRefA = z.object({ +export const zExternalSharedExternalSharedModel = z.object({ id: z.string(), name: z.string().optional() }); -export const zExternalRefB = zExternalRefA; +export const zExternalRefA = zExternalSharedExternalSharedModel; + +export const zExternalRefB = zExternalSharedExternalSharedModel; /** * Testing multiline comments in string: First line diff --git a/packages/openapi-ts-tests/zod/v4/__snapshots__/3.0.x/v4/default/zod.gen.ts b/packages/openapi-ts-tests/zod/v4/__snapshots__/3.0.x/v4/default/zod.gen.ts index 234a81b11..be696c929 100644 --- a/packages/openapi-ts-tests/zod/v4/__snapshots__/3.0.x/v4/default/zod.gen.ts +++ b/packages/openapi-ts-tests/zod/v4/__snapshots__/3.0.x/v4/default/zod.gen.ts @@ -7,15 +7,14 @@ import { z } from 'zod'; */ export const z400 = z.string(); -/** - * External ref to shared model (A) - */ -export const zExternalRefA = z.object({ +export const zExternalSharedExternalSharedModel = z.object({ id: z.string(), name: z.optional(z.string()) }); -export const zExternalRefB = zExternalRefA; +export const zExternalRefA = zExternalSharedExternalSharedModel; + +export const zExternalRefB = zExternalSharedExternalSharedModel; /** * Testing multiline comments in string: First line diff --git a/packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/mini/default/zod.gen.ts b/packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/mini/default/zod.gen.ts index a03ea9370..03bb3d55e 100644 --- a/packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/mini/default/zod.gen.ts +++ b/packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/mini/default/zod.gen.ts @@ -7,18 +7,20 @@ import * as z from 'zod/mini'; */ export const z400 = z.string(); -/** - * External ref to shared model (A) - */ -export const zExternalRefA = z.object({ +export const zExternalSharedExternalSharedModel = z.object({ id: z.string(), name: z.optional(z.string()) }); +/** + * External ref to shared model (A) + */ +export const zExternalRefA = zExternalSharedExternalSharedModel; + /** * External ref to shared model (B) */ -export const zExternalRefB = zExternalRefA; +export const zExternalRefB = zExternalSharedExternalSharedModel; /** * Testing multiline comments in string: First line diff --git a/packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/v3/default/zod.gen.ts b/packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/v3/default/zod.gen.ts index fb5e064a9..1015dc00d 100644 --- a/packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/v3/default/zod.gen.ts +++ b/packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/v3/default/zod.gen.ts @@ -7,18 +7,20 @@ import { z } from 'zod/v3'; */ export const z400 = z.string(); -/** - * External ref to shared model (A) - */ -export const zExternalRefA = z.object({ +export const zExternalSharedExternalSharedModel = z.object({ id: z.string(), name: z.string().optional() }); +/** + * External ref to shared model (A) + */ +export const zExternalRefA = zExternalSharedExternalSharedModel; + /** * External ref to shared model (B) */ -export const zExternalRefB = zExternalRefA; +export const zExternalRefB = zExternalSharedExternalSharedModel; /** * Testing multiline comments in string: First line diff --git a/packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/v4/default/zod.gen.ts b/packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/v4/default/zod.gen.ts index c5ef40b21..f84bc5d09 100644 --- a/packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/v4/default/zod.gen.ts +++ b/packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/v4/default/zod.gen.ts @@ -7,18 +7,20 @@ import { z } from 'zod'; */ export const z400 = z.string(); -/** - * External ref to shared model (A) - */ -export const zExternalRefA = z.object({ +export const zExternalSharedExternalSharedModel = z.object({ id: z.string(), name: z.optional(z.string()) }); +/** + * External ref to shared model (A) + */ +export const zExternalRefA = zExternalSharedExternalSharedModel; + /** * External ref to shared model (B) */ -export const zExternalRefB = zExternalRefA; +export const zExternalRefB = zExternalSharedExternalSharedModel; /** * Testing multiline comments in string: First line diff --git a/packages/openapi-ts/package.json b/packages/openapi-ts/package.json index a91e20513..5afa8c1b8 100644 --- a/packages/openapi-ts/package.json +++ b/packages/openapi-ts/package.json @@ -89,7 +89,7 @@ }, "dependencies": { "@hey-api/codegen-core": "workspace:^0.0.1", - "@hey-api/json-schema-ref-parser": "1.0.7", + "@hey-api/json-schema-ref-parser": "1.0.9", "ansi-colors": "4.1.3", "c12": "2.0.1", "color-support": "1.1.3", -- 2.51.2 From b1a3658436fa71c2487c935052b8ec13b71492ed Mon Sep 17 00:00:00 2001 From: Fransis Young Date: Tue, 2 Sep 2025 14:42:10 -0400 Subject: [PATCH 13/46] test(client): updates snapshots refs: #2553 --- .../client/client.gen.ts | 31 +++++++++++++++---- .../2.0.x/form-data/client/client.gen.ts | 31 +++++++++++++++---- .../client/client.gen.ts | 31 +++++++++++++++---- .../sdk-nested-classes/client/client.gen.ts | 31 +++++++++++++++---- .../@hey-api/sdk/default/client/client.gen.ts | 31 +++++++++++++++---- .../sdk/instance/client/client.gen.ts | 31 +++++++++++++++---- .../sdk/throwOnError/client/client.gen.ts | 31 +++++++++++++++---- .../type-format-valibot/client/client.gen.ts | 31 +++++++++++++++---- .../type-format-zod/client/client.gen.ts | 31 +++++++++++++++---- .../client/client.gen.ts | 31 +++++++++++++++---- .../client/client.gen.ts | 31 +++++++++++++++---- .../@pinia/colada/fetch/client/client.gen.ts | 31 +++++++++++++++---- .../colada/group-by-tag/client/client.gen.ts | 31 +++++++++++++++---- .../asClass/client/client.gen.ts | 31 +++++++++++++++---- .../fetch/client/client.gen.ts | 31 +++++++++++++++---- .../name-builder/client/client.gen.ts | 31 +++++++++++++++---- .../react-query/asClass/client/client.gen.ts | 31 +++++++++++++++---- .../react-query/fetch/client/client.gen.ts | 31 +++++++++++++++---- .../name-builder/client/client.gen.ts | 31 +++++++++++++++---- .../solid-query/asClass/client/client.gen.ts | 31 +++++++++++++++---- .../solid-query/fetch/client/client.gen.ts | 31 +++++++++++++++---- .../name-builder/client/client.gen.ts | 31 +++++++++++++++---- .../svelte-query/asClass/client/client.gen.ts | 31 +++++++++++++++---- .../svelte-query/fetch/client/client.gen.ts | 31 +++++++++++++++---- .../name-builder/client/client.gen.ts | 31 +++++++++++++++---- .../vue-query/asClass/client/client.gen.ts | 31 +++++++++++++++---- .../vue-query/fetch/client/client.gen.ts | 31 +++++++++++++++---- .../name-builder/client/client.gen.ts | 31 +++++++++++++++---- .../2.0.x/schema-unknown/client/client.gen.ts | 31 +++++++++++++++---- .../security-api-key/client/client.gen.ts | 31 +++++++++++++++---- .../2.0.x/security-basic/client/client.gen.ts | 31 +++++++++++++++---- .../2.0.x/security-false/client/client.gen.ts | 31 +++++++++++++++---- .../security-oauth2/client/client.gen.ts | 31 +++++++++++++++---- .../servers-base-path/client/client.gen.ts | 31 +++++++++++++++---- .../2.0.x/servers-host/client/client.gen.ts | 31 +++++++++++++++---- .../2.0.x/servers/client/client.gen.ts | 31 +++++++++++++++---- .../client/client.gen.ts | 31 +++++++++++++++---- .../client/client.gen.ts | 31 +++++++++++++++---- .../client/client.gen.ts | 31 +++++++++++++++---- .../client/client.gen.ts | 31 +++++++++++++++---- .../client/client.gen.ts | 31 +++++++++++++++---- .../sdk-nested-classes/client/client.gen.ts | 31 +++++++++++++++---- .../@hey-api/sdk/default/client/client.gen.ts | 31 +++++++++++++++---- .../sdk/instance/client/client.gen.ts | 31 +++++++++++++++---- .../sdk/throwOnError/client/client.gen.ts | 31 +++++++++++++++---- .../type-format-valibot/client/client.gen.ts | 31 +++++++++++++++---- .../type-format-zod/client/client.gen.ts | 31 +++++++++++++++---- .../client/client.gen.ts | 31 +++++++++++++++---- .../client/client.gen.ts | 31 +++++++++++++++---- .../@pinia/colada/fetch/client/client.gen.ts | 31 +++++++++++++++---- .../colada/group-by-tag/client/client.gen.ts | 31 +++++++++++++++---- .../asClass/client/client.gen.ts | 31 +++++++++++++++---- .../fetch/client/client.gen.ts | 31 +++++++++++++++---- .../name-builder/client/client.gen.ts | 31 +++++++++++++++---- .../react-query/asClass/client/client.gen.ts | 31 +++++++++++++++---- .../react-query/fetch/client/client.gen.ts | 31 +++++++++++++++---- .../name-builder/client/client.gen.ts | 31 +++++++++++++++---- .../solid-query/asClass/client/client.gen.ts | 31 +++++++++++++++---- .../solid-query/fetch/client/client.gen.ts | 31 +++++++++++++++---- .../name-builder/client/client.gen.ts | 31 +++++++++++++++---- .../svelte-query/asClass/client/client.gen.ts | 31 +++++++++++++++---- .../svelte-query/fetch/client/client.gen.ts | 31 +++++++++++++++---- .../name-builder/client/client.gen.ts | 31 +++++++++++++++---- .../vue-query/asClass/client/client.gen.ts | 31 +++++++++++++++---- .../vue-query/fetch/client/client.gen.ts | 31 +++++++++++++++---- .../name-builder/client/client.gen.ts | 31 +++++++++++++++---- .../security-api-key/client/client.gen.ts | 31 +++++++++++++++---- .../3.0.x/security-false/client/client.gen.ts | 31 +++++++++++++++---- .../security-http-bearer/client/client.gen.ts | 31 +++++++++++++++---- .../security-oauth2/client/client.gen.ts | 31 +++++++++++++++---- .../client/client.gen.ts | 31 +++++++++++++++---- .../3.0.x/servers/client/client.gen.ts | 31 +++++++++++++++---- .../transformers-all-of/client/client.gen.ts | 31 +++++++++++++++---- .../client/client.gen.ts | 31 +++++++++++++++---- .../transformers-array/client/client.gen.ts | 31 +++++++++++++++---- .../client/client.gen.ts | 31 +++++++++++++++---- .../client/client.gen.ts | 31 +++++++++++++++---- .../base-url-false/client/client.gen.ts | 31 +++++++++++++++---- .../base-url-number/client/client.gen.ts | 31 +++++++++++++++---- .../base-url-strict/client/client.gen.ts | 31 +++++++++++++++---- .../base-url-string/client/client.gen.ts | 31 +++++++++++++++---- .../clean-false/client/client.gen.ts | 31 +++++++++++++++---- .../client-fetch/default/client/client.gen.ts | 31 +++++++++++++++---- .../sdk-client-optional/client/client.gen.ts | 31 +++++++++++++++---- .../sdk-client-required/client/client.gen.ts | 31 +++++++++++++++---- .../client/client.gen.ts | 31 +++++++++++++++---- .../base-url-false/client/client.gen.ts | 31 +++++++++++++++---- .../base-url-number/client/client.gen.ts | 31 +++++++++++++++---- .../base-url-strict/client/client.gen.ts | 31 +++++++++++++++---- .../base-url-string/client/client.gen.ts | 31 +++++++++++++++---- .../clean-false/client/client.gen.ts | 31 +++++++++++++++---- .../client-next/default/client/client.gen.ts | 31 +++++++++++++++---- .../sdk-client-optional/client/client.gen.ts | 31 +++++++++++++++---- .../sdk-client-required/client/client.gen.ts | 31 +++++++++++++++---- .../client/client.gen.ts | 31 +++++++++++++++---- .../3.1.x/headers/client/client.gen.ts | 31 +++++++++++++++---- .../client/client.gen.ts | 31 +++++++++++++++---- .../3.1.x/pagination-ref/client/client.gen.ts | 31 +++++++++++++++---- .../client/client.gen.ts | 31 +++++++++++++++---- .../client/client.gen.ts | 31 +++++++++++++++---- .../sdk-nested-classes/client/client.gen.ts | 31 +++++++++++++++---- .../@hey-api/sdk/default/client/client.gen.ts | 31 +++++++++++++++---- .../sdk/instance/client/client.gen.ts | 31 +++++++++++++++---- .../sdk/throwOnError/client/client.gen.ts | 31 +++++++++++++++---- .../type-format-valibot/client/client.gen.ts | 31 +++++++++++++++---- .../type-format-zod/client/client.gen.ts | 31 +++++++++++++++---- .../client/client.gen.ts | 31 +++++++++++++++---- .../client/client.gen.ts | 31 +++++++++++++++---- .../@pinia/colada/fetch/client/client.gen.ts | 31 +++++++++++++++---- .../colada/group-by-tag/client/client.gen.ts | 31 +++++++++++++++---- .../asClass/client/client.gen.ts | 31 +++++++++++++++---- .../fetch/client/client.gen.ts | 31 +++++++++++++++---- .../name-builder/client/client.gen.ts | 31 +++++++++++++++---- .../react-query/asClass/client/client.gen.ts | 31 +++++++++++++++---- .../react-query/fetch/client/client.gen.ts | 31 +++++++++++++++---- .../name-builder/client/client.gen.ts | 31 +++++++++++++++---- .../solid-query/asClass/client/client.gen.ts | 31 +++++++++++++++---- .../solid-query/fetch/client/client.gen.ts | 31 +++++++++++++++---- .../name-builder/client/client.gen.ts | 31 +++++++++++++++---- .../svelte-query/asClass/client/client.gen.ts | 31 +++++++++++++++---- .../svelte-query/fetch/client/client.gen.ts | 31 +++++++++++++++---- .../name-builder/client/client.gen.ts | 31 +++++++++++++++---- .../vue-query/asClass/client/client.gen.ts | 31 +++++++++++++++---- .../vue-query/fetch/client/client.gen.ts | 31 +++++++++++++++---- .../name-builder/client/client.gen.ts | 31 +++++++++++++++---- .../security-api-key/client/client.gen.ts | 31 +++++++++++++++---- .../3.1.x/security-false/client/client.gen.ts | 31 +++++++++++++++---- .../security-http-bearer/client/client.gen.ts | 31 +++++++++++++++---- .../security-oauth2/client/client.gen.ts | 31 +++++++++++++++---- .../client/client.gen.ts | 31 +++++++++++++++---- .../3.1.x/servers/client/client.gen.ts | 31 +++++++++++++++---- .../3.1.x/sse-fetch/client/client.gen.ts | 31 +++++++++++++++---- .../3.1.x/sse-next/client/client.gen.ts | 31 +++++++++++++++---- .../transformers-all-of/client/client.gen.ts | 31 +++++++++++++++---- .../client/client.gen.ts | 31 +++++++++++++++---- .../transformers-array/client/client.gen.ts | 31 +++++++++++++++---- .../client/client.gen.ts | 31 +++++++++++++++---- .../@tanstack/meta/client/client.gen.ts | 31 +++++++++++++++---- .../v3_no_index/client/client.gen.ts.snap | 31 +++++++++++++++---- 139 files changed, 3475 insertions(+), 834 deletions(-) diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/body-response-text-plain/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/body-response-text-plain/client/client.gen.ts index ff0238aec..ff7815f4d 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/body-response-text-plain/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/body-response-text-plain/client/client.gen.ts @@ -60,12 +60,15 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.body === undefined || opts.body === '') { + if ( + opts.body === undefined || + (opts.serializedBody !== undefined && opts.serializedBody === '') + ) { opts.headers.delete('Content-Type'); } @@ -80,12 +83,9 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, + body: getValidRequestBody(opts), }; - if (opts.serializedBody) { - requestInit.body = opts.serializedBody; - } - let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { @@ -215,6 +215,25 @@ export const createClient = (config: Config = {}): Client => { }; }; + function getValidRequestBody(options: ResolvedRequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + return null; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/form-data/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/form-data/client/client.gen.ts index ff0238aec..ff7815f4d 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/form-data/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/form-data/client/client.gen.ts @@ -60,12 +60,15 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.body === undefined || opts.body === '') { + if ( + opts.body === undefined || + (opts.serializedBody !== undefined && opts.serializedBody === '') + ) { opts.headers.delete('Content-Type'); } @@ -80,12 +83,9 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, + body: getValidRequestBody(opts), }; - if (opts.serializedBody) { - requestInit.body = opts.serializedBody; - } - let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { @@ -215,6 +215,25 @@ export const createClient = (config: Config = {}): Client => { }; }; + function getValidRequestBody(options: ResolvedRequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + return null; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/client-fetch/sdk-nested-classes-instance/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/client-fetch/sdk-nested-classes-instance/client/client.gen.ts index ff0238aec..ff7815f4d 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/client-fetch/sdk-nested-classes-instance/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/client-fetch/sdk-nested-classes-instance/client/client.gen.ts @@ -60,12 +60,15 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.body === undefined || opts.body === '') { + if ( + opts.body === undefined || + (opts.serializedBody !== undefined && opts.serializedBody === '') + ) { opts.headers.delete('Content-Type'); } @@ -80,12 +83,9 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, + body: getValidRequestBody(opts), }; - if (opts.serializedBody) { - requestInit.body = opts.serializedBody; - } - let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { @@ -215,6 +215,25 @@ export const createClient = (config: Config = {}): Client => { }; }; + function getValidRequestBody(options: ResolvedRequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + return null; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/client-fetch/sdk-nested-classes/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/client-fetch/sdk-nested-classes/client/client.gen.ts index ff0238aec..ff7815f4d 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/client-fetch/sdk-nested-classes/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/client-fetch/sdk-nested-classes/client/client.gen.ts @@ -60,12 +60,15 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.body === undefined || opts.body === '') { + if ( + opts.body === undefined || + (opts.serializedBody !== undefined && opts.serializedBody === '') + ) { opts.headers.delete('Content-Type'); } @@ -80,12 +83,9 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, + body: getValidRequestBody(opts), }; - if (opts.serializedBody) { - requestInit.body = opts.serializedBody; - } - let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { @@ -215,6 +215,25 @@ export const createClient = (config: Config = {}): Client => { }; }; + function getValidRequestBody(options: ResolvedRequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + return null; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/sdk/default/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/sdk/default/client/client.gen.ts index ff0238aec..ff7815f4d 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/sdk/default/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/sdk/default/client/client.gen.ts @@ -60,12 +60,15 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.body === undefined || opts.body === '') { + if ( + opts.body === undefined || + (opts.serializedBody !== undefined && opts.serializedBody === '') + ) { opts.headers.delete('Content-Type'); } @@ -80,12 +83,9 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, + body: getValidRequestBody(opts), }; - if (opts.serializedBody) { - requestInit.body = opts.serializedBody; - } - let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { @@ -215,6 +215,25 @@ export const createClient = (config: Config = {}): Client => { }; }; + function getValidRequestBody(options: ResolvedRequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + return null; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/sdk/instance/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/sdk/instance/client/client.gen.ts index ff0238aec..ff7815f4d 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/sdk/instance/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/sdk/instance/client/client.gen.ts @@ -60,12 +60,15 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.body === undefined || opts.body === '') { + if ( + opts.body === undefined || + (opts.serializedBody !== undefined && opts.serializedBody === '') + ) { opts.headers.delete('Content-Type'); } @@ -80,12 +83,9 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, + body: getValidRequestBody(opts), }; - if (opts.serializedBody) { - requestInit.body = opts.serializedBody; - } - let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { @@ -215,6 +215,25 @@ export const createClient = (config: Config = {}): Client => { }; }; + function getValidRequestBody(options: ResolvedRequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + return null; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/sdk/throwOnError/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/sdk/throwOnError/client/client.gen.ts index ff0238aec..ff7815f4d 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/sdk/throwOnError/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/sdk/throwOnError/client/client.gen.ts @@ -60,12 +60,15 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.body === undefined || opts.body === '') { + if ( + opts.body === undefined || + (opts.serializedBody !== undefined && opts.serializedBody === '') + ) { opts.headers.delete('Content-Type'); } @@ -80,12 +83,9 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, + body: getValidRequestBody(opts), }; - if (opts.serializedBody) { - requestInit.body = opts.serializedBody; - } - let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { @@ -215,6 +215,25 @@ export const createClient = (config: Config = {}): Client => { }; }; + function getValidRequestBody(options: ResolvedRequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + return null; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/transformers/type-format-valibot/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/transformers/type-format-valibot/client/client.gen.ts index ff0238aec..ff7815f4d 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/transformers/type-format-valibot/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/transformers/type-format-valibot/client/client.gen.ts @@ -60,12 +60,15 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.body === undefined || opts.body === '') { + if ( + opts.body === undefined || + (opts.serializedBody !== undefined && opts.serializedBody === '') + ) { opts.headers.delete('Content-Type'); } @@ -80,12 +83,9 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, + body: getValidRequestBody(opts), }; - if (opts.serializedBody) { - requestInit.body = opts.serializedBody; - } - let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { @@ -215,6 +215,25 @@ export const createClient = (config: Config = {}): Client => { }; }; + function getValidRequestBody(options: ResolvedRequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + return null; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/transformers/type-format-zod/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/transformers/type-format-zod/client/client.gen.ts index ff0238aec..ff7815f4d 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/transformers/type-format-zod/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/transformers/type-format-zod/client/client.gen.ts @@ -60,12 +60,15 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.body === undefined || opts.body === '') { + if ( + opts.body === undefined || + (opts.serializedBody !== undefined && opts.serializedBody === '') + ) { opts.headers.delete('Content-Type'); } @@ -80,12 +83,9 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, + body: getValidRequestBody(opts), }; - if (opts.serializedBody) { - requestInit.body = opts.serializedBody; - } - let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { @@ -215,6 +215,25 @@ export const createClient = (config: Config = {}): Client => { }; }; + function getValidRequestBody(options: ResolvedRequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + return null; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/typescript/transforms-read-write-custom-name/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/typescript/transforms-read-write-custom-name/client/client.gen.ts index ff0238aec..ff7815f4d 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/typescript/transforms-read-write-custom-name/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/typescript/transforms-read-write-custom-name/client/client.gen.ts @@ -60,12 +60,15 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.body === undefined || opts.body === '') { + if ( + opts.body === undefined || + (opts.serializedBody !== undefined && opts.serializedBody === '') + ) { opts.headers.delete('Content-Type'); } @@ -80,12 +83,9 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, + body: getValidRequestBody(opts), }; - if (opts.serializedBody) { - requestInit.body = opts.serializedBody; - } - let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { @@ -215,6 +215,25 @@ export const createClient = (config: Config = {}): Client => { }; }; + function getValidRequestBody(options: ResolvedRequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + return null; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/typescript/transforms-read-write-ignore/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/typescript/transforms-read-write-ignore/client/client.gen.ts index ff0238aec..ff7815f4d 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/typescript/transforms-read-write-ignore/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/typescript/transforms-read-write-ignore/client/client.gen.ts @@ -60,12 +60,15 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.body === undefined || opts.body === '') { + if ( + opts.body === undefined || + (opts.serializedBody !== undefined && opts.serializedBody === '') + ) { opts.headers.delete('Content-Type'); } @@ -80,12 +83,9 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, + body: getValidRequestBody(opts), }; - if (opts.serializedBody) { - requestInit.body = opts.serializedBody; - } - let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { @@ -215,6 +215,25 @@ export const createClient = (config: Config = {}): Client => { }; }; + function getValidRequestBody(options: ResolvedRequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + return null; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@pinia/colada/fetch/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@pinia/colada/fetch/client/client.gen.ts index ff0238aec..ff7815f4d 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@pinia/colada/fetch/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@pinia/colada/fetch/client/client.gen.ts @@ -60,12 +60,15 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.body === undefined || opts.body === '') { + if ( + opts.body === undefined || + (opts.serializedBody !== undefined && opts.serializedBody === '') + ) { opts.headers.delete('Content-Type'); } @@ -80,12 +83,9 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, + body: getValidRequestBody(opts), }; - if (opts.serializedBody) { - requestInit.body = opts.serializedBody; - } - let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { @@ -215,6 +215,25 @@ export const createClient = (config: Config = {}): Client => { }; }; + function getValidRequestBody(options: ResolvedRequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + return null; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@pinia/colada/group-by-tag/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@pinia/colada/group-by-tag/client/client.gen.ts index ff0238aec..ff7815f4d 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@pinia/colada/group-by-tag/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@pinia/colada/group-by-tag/client/client.gen.ts @@ -60,12 +60,15 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.body === undefined || opts.body === '') { + if ( + opts.body === undefined || + (opts.serializedBody !== undefined && opts.serializedBody === '') + ) { opts.headers.delete('Content-Type'); } @@ -80,12 +83,9 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, + body: getValidRequestBody(opts), }; - if (opts.serializedBody) { - requestInit.body = opts.serializedBody; - } - let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { @@ -215,6 +215,25 @@ export const createClient = (config: Config = {}): Client => { }; }; + function getValidRequestBody(options: ResolvedRequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + return null; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/asClass/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/asClass/client/client.gen.ts index ff0238aec..ff7815f4d 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/asClass/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/asClass/client/client.gen.ts @@ -60,12 +60,15 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.body === undefined || opts.body === '') { + if ( + opts.body === undefined || + (opts.serializedBody !== undefined && opts.serializedBody === '') + ) { opts.headers.delete('Content-Type'); } @@ -80,12 +83,9 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, + body: getValidRequestBody(opts), }; - if (opts.serializedBody) { - requestInit.body = opts.serializedBody; - } - let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { @@ -215,6 +215,25 @@ export const createClient = (config: Config = {}): Client => { }; }; + function getValidRequestBody(options: ResolvedRequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + return null; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/fetch/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/fetch/client/client.gen.ts index ff0238aec..ff7815f4d 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/fetch/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/fetch/client/client.gen.ts @@ -60,12 +60,15 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.body === undefined || opts.body === '') { + if ( + opts.body === undefined || + (opts.serializedBody !== undefined && opts.serializedBody === '') + ) { opts.headers.delete('Content-Type'); } @@ -80,12 +83,9 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, + body: getValidRequestBody(opts), }; - if (opts.serializedBody) { - requestInit.body = opts.serializedBody; - } - let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { @@ -215,6 +215,25 @@ export const createClient = (config: Config = {}): Client => { }; }; + function getValidRequestBody(options: ResolvedRequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + return null; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/name-builder/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/name-builder/client/client.gen.ts index ff0238aec..ff7815f4d 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/name-builder/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/name-builder/client/client.gen.ts @@ -60,12 +60,15 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.body === undefined || opts.body === '') { + if ( + opts.body === undefined || + (opts.serializedBody !== undefined && opts.serializedBody === '') + ) { opts.headers.delete('Content-Type'); } @@ -80,12 +83,9 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, + body: getValidRequestBody(opts), }; - if (opts.serializedBody) { - requestInit.body = opts.serializedBody; - } - let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { @@ -215,6 +215,25 @@ export const createClient = (config: Config = {}): Client => { }; }; + function getValidRequestBody(options: ResolvedRequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + return null; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/react-query/asClass/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/react-query/asClass/client/client.gen.ts index ff0238aec..ff7815f4d 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/react-query/asClass/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/react-query/asClass/client/client.gen.ts @@ -60,12 +60,15 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.body === undefined || opts.body === '') { + if ( + opts.body === undefined || + (opts.serializedBody !== undefined && opts.serializedBody === '') + ) { opts.headers.delete('Content-Type'); } @@ -80,12 +83,9 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, + body: getValidRequestBody(opts), }; - if (opts.serializedBody) { - requestInit.body = opts.serializedBody; - } - let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { @@ -215,6 +215,25 @@ export const createClient = (config: Config = {}): Client => { }; }; + function getValidRequestBody(options: ResolvedRequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + return null; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/react-query/fetch/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/react-query/fetch/client/client.gen.ts index ff0238aec..ff7815f4d 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/react-query/fetch/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/react-query/fetch/client/client.gen.ts @@ -60,12 +60,15 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.body === undefined || opts.body === '') { + if ( + opts.body === undefined || + (opts.serializedBody !== undefined && opts.serializedBody === '') + ) { opts.headers.delete('Content-Type'); } @@ -80,12 +83,9 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, + body: getValidRequestBody(opts), }; - if (opts.serializedBody) { - requestInit.body = opts.serializedBody; - } - let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { @@ -215,6 +215,25 @@ export const createClient = (config: Config = {}): Client => { }; }; + function getValidRequestBody(options: ResolvedRequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + return null; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/react-query/name-builder/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/react-query/name-builder/client/client.gen.ts index ff0238aec..ff7815f4d 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/react-query/name-builder/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/react-query/name-builder/client/client.gen.ts @@ -60,12 +60,15 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.body === undefined || opts.body === '') { + if ( + opts.body === undefined || + (opts.serializedBody !== undefined && opts.serializedBody === '') + ) { opts.headers.delete('Content-Type'); } @@ -80,12 +83,9 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, + body: getValidRequestBody(opts), }; - if (opts.serializedBody) { - requestInit.body = opts.serializedBody; - } - let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { @@ -215,6 +215,25 @@ export const createClient = (config: Config = {}): Client => { }; }; + function getValidRequestBody(options: ResolvedRequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + return null; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/solid-query/asClass/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/solid-query/asClass/client/client.gen.ts index ff0238aec..ff7815f4d 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/solid-query/asClass/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/solid-query/asClass/client/client.gen.ts @@ -60,12 +60,15 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.body === undefined || opts.body === '') { + if ( + opts.body === undefined || + (opts.serializedBody !== undefined && opts.serializedBody === '') + ) { opts.headers.delete('Content-Type'); } @@ -80,12 +83,9 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, + body: getValidRequestBody(opts), }; - if (opts.serializedBody) { - requestInit.body = opts.serializedBody; - } - let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { @@ -215,6 +215,25 @@ export const createClient = (config: Config = {}): Client => { }; }; + function getValidRequestBody(options: ResolvedRequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + return null; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/solid-query/fetch/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/solid-query/fetch/client/client.gen.ts index ff0238aec..ff7815f4d 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/solid-query/fetch/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/solid-query/fetch/client/client.gen.ts @@ -60,12 +60,15 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.body === undefined || opts.body === '') { + if ( + opts.body === undefined || + (opts.serializedBody !== undefined && opts.serializedBody === '') + ) { opts.headers.delete('Content-Type'); } @@ -80,12 +83,9 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, + body: getValidRequestBody(opts), }; - if (opts.serializedBody) { - requestInit.body = opts.serializedBody; - } - let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { @@ -215,6 +215,25 @@ export const createClient = (config: Config = {}): Client => { }; }; + function getValidRequestBody(options: ResolvedRequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + return null; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/solid-query/name-builder/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/solid-query/name-builder/client/client.gen.ts index ff0238aec..ff7815f4d 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/solid-query/name-builder/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/solid-query/name-builder/client/client.gen.ts @@ -60,12 +60,15 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.body === undefined || opts.body === '') { + if ( + opts.body === undefined || + (opts.serializedBody !== undefined && opts.serializedBody === '') + ) { opts.headers.delete('Content-Type'); } @@ -80,12 +83,9 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, + body: getValidRequestBody(opts), }; - if (opts.serializedBody) { - requestInit.body = opts.serializedBody; - } - let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { @@ -215,6 +215,25 @@ export const createClient = (config: Config = {}): Client => { }; }; + function getValidRequestBody(options: ResolvedRequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + return null; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/svelte-query/asClass/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/svelte-query/asClass/client/client.gen.ts index ff0238aec..ff7815f4d 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/svelte-query/asClass/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/svelte-query/asClass/client/client.gen.ts @@ -60,12 +60,15 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.body === undefined || opts.body === '') { + if ( + opts.body === undefined || + (opts.serializedBody !== undefined && opts.serializedBody === '') + ) { opts.headers.delete('Content-Type'); } @@ -80,12 +83,9 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, + body: getValidRequestBody(opts), }; - if (opts.serializedBody) { - requestInit.body = opts.serializedBody; - } - let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { @@ -215,6 +215,25 @@ export const createClient = (config: Config = {}): Client => { }; }; + function getValidRequestBody(options: ResolvedRequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + return null; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/svelte-query/fetch/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/svelte-query/fetch/client/client.gen.ts index ff0238aec..ff7815f4d 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/svelte-query/fetch/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/svelte-query/fetch/client/client.gen.ts @@ -60,12 +60,15 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.body === undefined || opts.body === '') { + if ( + opts.body === undefined || + (opts.serializedBody !== undefined && opts.serializedBody === '') + ) { opts.headers.delete('Content-Type'); } @@ -80,12 +83,9 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, + body: getValidRequestBody(opts), }; - if (opts.serializedBody) { - requestInit.body = opts.serializedBody; - } - let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { @@ -215,6 +215,25 @@ export const createClient = (config: Config = {}): Client => { }; }; + function getValidRequestBody(options: ResolvedRequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + return null; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/svelte-query/name-builder/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/svelte-query/name-builder/client/client.gen.ts index ff0238aec..ff7815f4d 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/svelte-query/name-builder/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/svelte-query/name-builder/client/client.gen.ts @@ -60,12 +60,15 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.body === undefined || opts.body === '') { + if ( + opts.body === undefined || + (opts.serializedBody !== undefined && opts.serializedBody === '') + ) { opts.headers.delete('Content-Type'); } @@ -80,12 +83,9 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, + body: getValidRequestBody(opts), }; - if (opts.serializedBody) { - requestInit.body = opts.serializedBody; - } - let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { @@ -215,6 +215,25 @@ export const createClient = (config: Config = {}): Client => { }; }; + function getValidRequestBody(options: ResolvedRequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + return null; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/vue-query/asClass/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/vue-query/asClass/client/client.gen.ts index ff0238aec..ff7815f4d 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/vue-query/asClass/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/vue-query/asClass/client/client.gen.ts @@ -60,12 +60,15 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.body === undefined || opts.body === '') { + if ( + opts.body === undefined || + (opts.serializedBody !== undefined && opts.serializedBody === '') + ) { opts.headers.delete('Content-Type'); } @@ -80,12 +83,9 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, + body: getValidRequestBody(opts), }; - if (opts.serializedBody) { - requestInit.body = opts.serializedBody; - } - let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { @@ -215,6 +215,25 @@ export const createClient = (config: Config = {}): Client => { }; }; + function getValidRequestBody(options: ResolvedRequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + return null; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/vue-query/fetch/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/vue-query/fetch/client/client.gen.ts index ff0238aec..ff7815f4d 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/vue-query/fetch/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/vue-query/fetch/client/client.gen.ts @@ -60,12 +60,15 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.body === undefined || opts.body === '') { + if ( + opts.body === undefined || + (opts.serializedBody !== undefined && opts.serializedBody === '') + ) { opts.headers.delete('Content-Type'); } @@ -80,12 +83,9 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, + body: getValidRequestBody(opts), }; - if (opts.serializedBody) { - requestInit.body = opts.serializedBody; - } - let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { @@ -215,6 +215,25 @@ export const createClient = (config: Config = {}): Client => { }; }; + function getValidRequestBody(options: ResolvedRequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + return null; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/vue-query/name-builder/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/vue-query/name-builder/client/client.gen.ts index ff0238aec..ff7815f4d 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/vue-query/name-builder/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/vue-query/name-builder/client/client.gen.ts @@ -60,12 +60,15 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.body === undefined || opts.body === '') { + if ( + opts.body === undefined || + (opts.serializedBody !== undefined && opts.serializedBody === '') + ) { opts.headers.delete('Content-Type'); } @@ -80,12 +83,9 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, + body: getValidRequestBody(opts), }; - if (opts.serializedBody) { - requestInit.body = opts.serializedBody; - } - let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { @@ -215,6 +215,25 @@ export const createClient = (config: Config = {}): Client => { }; }; + function getValidRequestBody(options: ResolvedRequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + return null; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/schema-unknown/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/schema-unknown/client/client.gen.ts index ff0238aec..ff7815f4d 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/schema-unknown/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/schema-unknown/client/client.gen.ts @@ -60,12 +60,15 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.body === undefined || opts.body === '') { + if ( + opts.body === undefined || + (opts.serializedBody !== undefined && opts.serializedBody === '') + ) { opts.headers.delete('Content-Type'); } @@ -80,12 +83,9 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, + body: getValidRequestBody(opts), }; - if (opts.serializedBody) { - requestInit.body = opts.serializedBody; - } - let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { @@ -215,6 +215,25 @@ export const createClient = (config: Config = {}): Client => { }; }; + function getValidRequestBody(options: ResolvedRequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + return null; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-api-key/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-api-key/client/client.gen.ts index ff0238aec..ff7815f4d 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-api-key/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-api-key/client/client.gen.ts @@ -60,12 +60,15 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.body === undefined || opts.body === '') { + if ( + opts.body === undefined || + (opts.serializedBody !== undefined && opts.serializedBody === '') + ) { opts.headers.delete('Content-Type'); } @@ -80,12 +83,9 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, + body: getValidRequestBody(opts), }; - if (opts.serializedBody) { - requestInit.body = opts.serializedBody; - } - let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { @@ -215,6 +215,25 @@ export const createClient = (config: Config = {}): Client => { }; }; + function getValidRequestBody(options: ResolvedRequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + return null; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-basic/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-basic/client/client.gen.ts index ff0238aec..ff7815f4d 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-basic/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-basic/client/client.gen.ts @@ -60,12 +60,15 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.body === undefined || opts.body === '') { + if ( + opts.body === undefined || + (opts.serializedBody !== undefined && opts.serializedBody === '') + ) { opts.headers.delete('Content-Type'); } @@ -80,12 +83,9 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, + body: getValidRequestBody(opts), }; - if (opts.serializedBody) { - requestInit.body = opts.serializedBody; - } - let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { @@ -215,6 +215,25 @@ export const createClient = (config: Config = {}): Client => { }; }; + function getValidRequestBody(options: ResolvedRequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + return null; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-false/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-false/client/client.gen.ts index ff0238aec..ff7815f4d 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-false/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-false/client/client.gen.ts @@ -60,12 +60,15 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.body === undefined || opts.body === '') { + if ( + opts.body === undefined || + (opts.serializedBody !== undefined && opts.serializedBody === '') + ) { opts.headers.delete('Content-Type'); } @@ -80,12 +83,9 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, + body: getValidRequestBody(opts), }; - if (opts.serializedBody) { - requestInit.body = opts.serializedBody; - } - let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { @@ -215,6 +215,25 @@ export const createClient = (config: Config = {}): Client => { }; }; + function getValidRequestBody(options: ResolvedRequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + return null; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-oauth2/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-oauth2/client/client.gen.ts index ff0238aec..ff7815f4d 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-oauth2/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-oauth2/client/client.gen.ts @@ -60,12 +60,15 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.body === undefined || opts.body === '') { + if ( + opts.body === undefined || + (opts.serializedBody !== undefined && opts.serializedBody === '') + ) { opts.headers.delete('Content-Type'); } @@ -80,12 +83,9 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, + body: getValidRequestBody(opts), }; - if (opts.serializedBody) { - requestInit.body = opts.serializedBody; - } - let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { @@ -215,6 +215,25 @@ export const createClient = (config: Config = {}): Client => { }; }; + function getValidRequestBody(options: ResolvedRequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + return null; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/servers-base-path/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/servers-base-path/client/client.gen.ts index ff0238aec..ff7815f4d 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/servers-base-path/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/servers-base-path/client/client.gen.ts @@ -60,12 +60,15 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.body === undefined || opts.body === '') { + if ( + opts.body === undefined || + (opts.serializedBody !== undefined && opts.serializedBody === '') + ) { opts.headers.delete('Content-Type'); } @@ -80,12 +83,9 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, + body: getValidRequestBody(opts), }; - if (opts.serializedBody) { - requestInit.body = opts.serializedBody; - } - let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { @@ -215,6 +215,25 @@ export const createClient = (config: Config = {}): Client => { }; }; + function getValidRequestBody(options: ResolvedRequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + return null; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/servers-host/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/servers-host/client/client.gen.ts index ff0238aec..ff7815f4d 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/servers-host/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/servers-host/client/client.gen.ts @@ -60,12 +60,15 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.body === undefined || opts.body === '') { + if ( + opts.body === undefined || + (opts.serializedBody !== undefined && opts.serializedBody === '') + ) { opts.headers.delete('Content-Type'); } @@ -80,12 +83,9 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, + body: getValidRequestBody(opts), }; - if (opts.serializedBody) { - requestInit.body = opts.serializedBody; - } - let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { @@ -215,6 +215,25 @@ export const createClient = (config: Config = {}): Client => { }; }; + function getValidRequestBody(options: ResolvedRequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + return null; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/servers/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/servers/client/client.gen.ts index ff0238aec..ff7815f4d 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/servers/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/servers/client/client.gen.ts @@ -60,12 +60,15 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.body === undefined || opts.body === '') { + if ( + opts.body === undefined || + (opts.serializedBody !== undefined && opts.serializedBody === '') + ) { opts.headers.delete('Content-Type'); } @@ -80,12 +83,9 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, + body: getValidRequestBody(opts), }; - if (opts.serializedBody) { - requestInit.body = opts.serializedBody; - } - let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { @@ -215,6 +215,25 @@ export const createClient = (config: Config = {}): Client => { }; }; + function getValidRequestBody(options: ResolvedRequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + return null; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/transforms-read-write/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/transforms-read-write/client/client.gen.ts index ff0238aec..ff7815f4d 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/transforms-read-write/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/transforms-read-write/client/client.gen.ts @@ -60,12 +60,15 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.body === undefined || opts.body === '') { + if ( + opts.body === undefined || + (opts.serializedBody !== undefined && opts.serializedBody === '') + ) { opts.headers.delete('Content-Type'); } @@ -80,12 +83,9 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, + body: getValidRequestBody(opts), }; - if (opts.serializedBody) { - requestInit.body = opts.serializedBody; - } - let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { @@ -215,6 +215,25 @@ export const createClient = (config: Config = {}): Client => { }; }; + function getValidRequestBody(options: ResolvedRequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + return null; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/body-response-text-plain/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/body-response-text-plain/client/client.gen.ts index ff0238aec..ff7815f4d 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/body-response-text-plain/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/body-response-text-plain/client/client.gen.ts @@ -60,12 +60,15 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.body === undefined || opts.body === '') { + if ( + opts.body === undefined || + (opts.serializedBody !== undefined && opts.serializedBody === '') + ) { opts.headers.delete('Content-Type'); } @@ -80,12 +83,9 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, + body: getValidRequestBody(opts), }; - if (opts.serializedBody) { - requestInit.body = opts.serializedBody; - } - let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { @@ -215,6 +215,25 @@ export const createClient = (config: Config = {}): Client => { }; }; + function getValidRequestBody(options: ResolvedRequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + return null; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/internal-name-conflict/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/internal-name-conflict/client/client.gen.ts index ff0238aec..ff7815f4d 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/internal-name-conflict/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/internal-name-conflict/client/client.gen.ts @@ -60,12 +60,15 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.body === undefined || opts.body === '') { + if ( + opts.body === undefined || + (opts.serializedBody !== undefined && opts.serializedBody === '') + ) { opts.headers.delete('Content-Type'); } @@ -80,12 +83,9 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, + body: getValidRequestBody(opts), }; - if (opts.serializedBody) { - requestInit.body = opts.serializedBody; - } - let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { @@ -215,6 +215,25 @@ export const createClient = (config: Config = {}): Client => { }; }; + function getValidRequestBody(options: ResolvedRequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + return null; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/parameter-explode-false/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/parameter-explode-false/client/client.gen.ts index ff0238aec..ff7815f4d 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/parameter-explode-false/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/parameter-explode-false/client/client.gen.ts @@ -60,12 +60,15 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.body === undefined || opts.body === '') { + if ( + opts.body === undefined || + (opts.serializedBody !== undefined && opts.serializedBody === '') + ) { opts.headers.delete('Content-Type'); } @@ -80,12 +83,9 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, + body: getValidRequestBody(opts), }; - if (opts.serializedBody) { - requestInit.body = opts.serializedBody; - } - let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { @@ -215,6 +215,25 @@ export const createClient = (config: Config = {}): Client => { }; }; + function getValidRequestBody(options: ResolvedRequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + return null; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/client-fetch/sdk-nested-classes-instance/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/client-fetch/sdk-nested-classes-instance/client/client.gen.ts index ff0238aec..ff7815f4d 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/client-fetch/sdk-nested-classes-instance/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/client-fetch/sdk-nested-classes-instance/client/client.gen.ts @@ -60,12 +60,15 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.body === undefined || opts.body === '') { + if ( + opts.body === undefined || + (opts.serializedBody !== undefined && opts.serializedBody === '') + ) { opts.headers.delete('Content-Type'); } @@ -80,12 +83,9 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, + body: getValidRequestBody(opts), }; - if (opts.serializedBody) { - requestInit.body = opts.serializedBody; - } - let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { @@ -215,6 +215,25 @@ export const createClient = (config: Config = {}): Client => { }; }; + function getValidRequestBody(options: ResolvedRequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + return null; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/client-fetch/sdk-nested-classes/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/client-fetch/sdk-nested-classes/client/client.gen.ts index ff0238aec..ff7815f4d 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/client-fetch/sdk-nested-classes/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/client-fetch/sdk-nested-classes/client/client.gen.ts @@ -60,12 +60,15 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.body === undefined || opts.body === '') { + if ( + opts.body === undefined || + (opts.serializedBody !== undefined && opts.serializedBody === '') + ) { opts.headers.delete('Content-Type'); } @@ -80,12 +83,9 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, + body: getValidRequestBody(opts), }; - if (opts.serializedBody) { - requestInit.body = opts.serializedBody; - } - let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { @@ -215,6 +215,25 @@ export const createClient = (config: Config = {}): Client => { }; }; + function getValidRequestBody(options: ResolvedRequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + return null; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/sdk/default/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/sdk/default/client/client.gen.ts index ff0238aec..ff7815f4d 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/sdk/default/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/sdk/default/client/client.gen.ts @@ -60,12 +60,15 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.body === undefined || opts.body === '') { + if ( + opts.body === undefined || + (opts.serializedBody !== undefined && opts.serializedBody === '') + ) { opts.headers.delete('Content-Type'); } @@ -80,12 +83,9 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, + body: getValidRequestBody(opts), }; - if (opts.serializedBody) { - requestInit.body = opts.serializedBody; - } - let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { @@ -215,6 +215,25 @@ export const createClient = (config: Config = {}): Client => { }; }; + function getValidRequestBody(options: ResolvedRequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + return null; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/sdk/instance/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/sdk/instance/client/client.gen.ts index ff0238aec..ff7815f4d 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/sdk/instance/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/sdk/instance/client/client.gen.ts @@ -60,12 +60,15 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.body === undefined || opts.body === '') { + if ( + opts.body === undefined || + (opts.serializedBody !== undefined && opts.serializedBody === '') + ) { opts.headers.delete('Content-Type'); } @@ -80,12 +83,9 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, + body: getValidRequestBody(opts), }; - if (opts.serializedBody) { - requestInit.body = opts.serializedBody; - } - let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { @@ -215,6 +215,25 @@ export const createClient = (config: Config = {}): Client => { }; }; + function getValidRequestBody(options: ResolvedRequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + return null; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/sdk/throwOnError/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/sdk/throwOnError/client/client.gen.ts index ff0238aec..ff7815f4d 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/sdk/throwOnError/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/sdk/throwOnError/client/client.gen.ts @@ -60,12 +60,15 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.body === undefined || opts.body === '') { + if ( + opts.body === undefined || + (opts.serializedBody !== undefined && opts.serializedBody === '') + ) { opts.headers.delete('Content-Type'); } @@ -80,12 +83,9 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, + body: getValidRequestBody(opts), }; - if (opts.serializedBody) { - requestInit.body = opts.serializedBody; - } - let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { @@ -215,6 +215,25 @@ export const createClient = (config: Config = {}): Client => { }; }; + function getValidRequestBody(options: ResolvedRequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + return null; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/transformers/type-format-valibot/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/transformers/type-format-valibot/client/client.gen.ts index ff0238aec..ff7815f4d 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/transformers/type-format-valibot/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/transformers/type-format-valibot/client/client.gen.ts @@ -60,12 +60,15 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.body === undefined || opts.body === '') { + if ( + opts.body === undefined || + (opts.serializedBody !== undefined && opts.serializedBody === '') + ) { opts.headers.delete('Content-Type'); } @@ -80,12 +83,9 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, + body: getValidRequestBody(opts), }; - if (opts.serializedBody) { - requestInit.body = opts.serializedBody; - } - let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { @@ -215,6 +215,25 @@ export const createClient = (config: Config = {}): Client => { }; }; + function getValidRequestBody(options: ResolvedRequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + return null; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/transformers/type-format-zod/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/transformers/type-format-zod/client/client.gen.ts index ff0238aec..ff7815f4d 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/transformers/type-format-zod/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/transformers/type-format-zod/client/client.gen.ts @@ -60,12 +60,15 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.body === undefined || opts.body === '') { + if ( + opts.body === undefined || + (opts.serializedBody !== undefined && opts.serializedBody === '') + ) { opts.headers.delete('Content-Type'); } @@ -80,12 +83,9 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, + body: getValidRequestBody(opts), }; - if (opts.serializedBody) { - requestInit.body = opts.serializedBody; - } - let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { @@ -215,6 +215,25 @@ export const createClient = (config: Config = {}): Client => { }; }; + function getValidRequestBody(options: ResolvedRequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + return null; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/typescript/transforms-read-write-custom-name/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/typescript/transforms-read-write-custom-name/client/client.gen.ts index ff0238aec..ff7815f4d 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/typescript/transforms-read-write-custom-name/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/typescript/transforms-read-write-custom-name/client/client.gen.ts @@ -60,12 +60,15 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.body === undefined || opts.body === '') { + if ( + opts.body === undefined || + (opts.serializedBody !== undefined && opts.serializedBody === '') + ) { opts.headers.delete('Content-Type'); } @@ -80,12 +83,9 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, + body: getValidRequestBody(opts), }; - if (opts.serializedBody) { - requestInit.body = opts.serializedBody; - } - let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { @@ -215,6 +215,25 @@ export const createClient = (config: Config = {}): Client => { }; }; + function getValidRequestBody(options: ResolvedRequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + return null; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/typescript/transforms-read-write-ignore/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/typescript/transforms-read-write-ignore/client/client.gen.ts index ff0238aec..ff7815f4d 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/typescript/transforms-read-write-ignore/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/typescript/transforms-read-write-ignore/client/client.gen.ts @@ -60,12 +60,15 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.body === undefined || opts.body === '') { + if ( + opts.body === undefined || + (opts.serializedBody !== undefined && opts.serializedBody === '') + ) { opts.headers.delete('Content-Type'); } @@ -80,12 +83,9 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, + body: getValidRequestBody(opts), }; - if (opts.serializedBody) { - requestInit.body = opts.serializedBody; - } - let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { @@ -215,6 +215,25 @@ export const createClient = (config: Config = {}): Client => { }; }; + function getValidRequestBody(options: ResolvedRequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + return null; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@pinia/colada/fetch/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@pinia/colada/fetch/client/client.gen.ts index ff0238aec..ff7815f4d 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@pinia/colada/fetch/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@pinia/colada/fetch/client/client.gen.ts @@ -60,12 +60,15 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.body === undefined || opts.body === '') { + if ( + opts.body === undefined || + (opts.serializedBody !== undefined && opts.serializedBody === '') + ) { opts.headers.delete('Content-Type'); } @@ -80,12 +83,9 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, + body: getValidRequestBody(opts), }; - if (opts.serializedBody) { - requestInit.body = opts.serializedBody; - } - let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { @@ -215,6 +215,25 @@ export const createClient = (config: Config = {}): Client => { }; }; + function getValidRequestBody(options: ResolvedRequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + return null; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@pinia/colada/group-by-tag/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@pinia/colada/group-by-tag/client/client.gen.ts index ff0238aec..ff7815f4d 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@pinia/colada/group-by-tag/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@pinia/colada/group-by-tag/client/client.gen.ts @@ -60,12 +60,15 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.body === undefined || opts.body === '') { + if ( + opts.body === undefined || + (opts.serializedBody !== undefined && opts.serializedBody === '') + ) { opts.headers.delete('Content-Type'); } @@ -80,12 +83,9 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, + body: getValidRequestBody(opts), }; - if (opts.serializedBody) { - requestInit.body = opts.serializedBody; - } - let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { @@ -215,6 +215,25 @@ export const createClient = (config: Config = {}): Client => { }; }; + function getValidRequestBody(options: ResolvedRequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + return null; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/angular-query-experimental/asClass/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/angular-query-experimental/asClass/client/client.gen.ts index ff0238aec..ff7815f4d 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/angular-query-experimental/asClass/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/angular-query-experimental/asClass/client/client.gen.ts @@ -60,12 +60,15 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.body === undefined || opts.body === '') { + if ( + opts.body === undefined || + (opts.serializedBody !== undefined && opts.serializedBody === '') + ) { opts.headers.delete('Content-Type'); } @@ -80,12 +83,9 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, + body: getValidRequestBody(opts), }; - if (opts.serializedBody) { - requestInit.body = opts.serializedBody; - } - let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { @@ -215,6 +215,25 @@ export const createClient = (config: Config = {}): Client => { }; }; + function getValidRequestBody(options: ResolvedRequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + return null; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/angular-query-experimental/fetch/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/angular-query-experimental/fetch/client/client.gen.ts index ff0238aec..ff7815f4d 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/angular-query-experimental/fetch/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/angular-query-experimental/fetch/client/client.gen.ts @@ -60,12 +60,15 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.body === undefined || opts.body === '') { + if ( + opts.body === undefined || + (opts.serializedBody !== undefined && opts.serializedBody === '') + ) { opts.headers.delete('Content-Type'); } @@ -80,12 +83,9 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, + body: getValidRequestBody(opts), }; - if (opts.serializedBody) { - requestInit.body = opts.serializedBody; - } - let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { @@ -215,6 +215,25 @@ export const createClient = (config: Config = {}): Client => { }; }; + function getValidRequestBody(options: ResolvedRequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + return null; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/angular-query-experimental/name-builder/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/angular-query-experimental/name-builder/client/client.gen.ts index ff0238aec..ff7815f4d 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/angular-query-experimental/name-builder/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/angular-query-experimental/name-builder/client/client.gen.ts @@ -60,12 +60,15 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.body === undefined || opts.body === '') { + if ( + opts.body === undefined || + (opts.serializedBody !== undefined && opts.serializedBody === '') + ) { opts.headers.delete('Content-Type'); } @@ -80,12 +83,9 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, + body: getValidRequestBody(opts), }; - if (opts.serializedBody) { - requestInit.body = opts.serializedBody; - } - let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { @@ -215,6 +215,25 @@ export const createClient = (config: Config = {}): Client => { }; }; + function getValidRequestBody(options: ResolvedRequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + return null; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/react-query/asClass/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/react-query/asClass/client/client.gen.ts index ff0238aec..ff7815f4d 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/react-query/asClass/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/react-query/asClass/client/client.gen.ts @@ -60,12 +60,15 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.body === undefined || opts.body === '') { + if ( + opts.body === undefined || + (opts.serializedBody !== undefined && opts.serializedBody === '') + ) { opts.headers.delete('Content-Type'); } @@ -80,12 +83,9 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, + body: getValidRequestBody(opts), }; - if (opts.serializedBody) { - requestInit.body = opts.serializedBody; - } - let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { @@ -215,6 +215,25 @@ export const createClient = (config: Config = {}): Client => { }; }; + function getValidRequestBody(options: ResolvedRequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + return null; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/react-query/fetch/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/react-query/fetch/client/client.gen.ts index ff0238aec..ff7815f4d 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/react-query/fetch/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/react-query/fetch/client/client.gen.ts @@ -60,12 +60,15 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.body === undefined || opts.body === '') { + if ( + opts.body === undefined || + (opts.serializedBody !== undefined && opts.serializedBody === '') + ) { opts.headers.delete('Content-Type'); } @@ -80,12 +83,9 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, + body: getValidRequestBody(opts), }; - if (opts.serializedBody) { - requestInit.body = opts.serializedBody; - } - let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { @@ -215,6 +215,25 @@ export const createClient = (config: Config = {}): Client => { }; }; + function getValidRequestBody(options: ResolvedRequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + return null; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/react-query/name-builder/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/react-query/name-builder/client/client.gen.ts index ff0238aec..ff7815f4d 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/react-query/name-builder/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/react-query/name-builder/client/client.gen.ts @@ -60,12 +60,15 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.body === undefined || opts.body === '') { + if ( + opts.body === undefined || + (opts.serializedBody !== undefined && opts.serializedBody === '') + ) { opts.headers.delete('Content-Type'); } @@ -80,12 +83,9 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, + body: getValidRequestBody(opts), }; - if (opts.serializedBody) { - requestInit.body = opts.serializedBody; - } - let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { @@ -215,6 +215,25 @@ export const createClient = (config: Config = {}): Client => { }; }; + function getValidRequestBody(options: ResolvedRequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + return null; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/solid-query/asClass/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/solid-query/asClass/client/client.gen.ts index ff0238aec..ff7815f4d 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/solid-query/asClass/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/solid-query/asClass/client/client.gen.ts @@ -60,12 +60,15 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.body === undefined || opts.body === '') { + if ( + opts.body === undefined || + (opts.serializedBody !== undefined && opts.serializedBody === '') + ) { opts.headers.delete('Content-Type'); } @@ -80,12 +83,9 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, + body: getValidRequestBody(opts), }; - if (opts.serializedBody) { - requestInit.body = opts.serializedBody; - } - let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { @@ -215,6 +215,25 @@ export const createClient = (config: Config = {}): Client => { }; }; + function getValidRequestBody(options: ResolvedRequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + return null; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/solid-query/fetch/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/solid-query/fetch/client/client.gen.ts index ff0238aec..ff7815f4d 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/solid-query/fetch/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/solid-query/fetch/client/client.gen.ts @@ -60,12 +60,15 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.body === undefined || opts.body === '') { + if ( + opts.body === undefined || + (opts.serializedBody !== undefined && opts.serializedBody === '') + ) { opts.headers.delete('Content-Type'); } @@ -80,12 +83,9 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, + body: getValidRequestBody(opts), }; - if (opts.serializedBody) { - requestInit.body = opts.serializedBody; - } - let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { @@ -215,6 +215,25 @@ export const createClient = (config: Config = {}): Client => { }; }; + function getValidRequestBody(options: ResolvedRequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + return null; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/solid-query/name-builder/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/solid-query/name-builder/client/client.gen.ts index ff0238aec..ff7815f4d 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/solid-query/name-builder/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/solid-query/name-builder/client/client.gen.ts @@ -60,12 +60,15 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.body === undefined || opts.body === '') { + if ( + opts.body === undefined || + (opts.serializedBody !== undefined && opts.serializedBody === '') + ) { opts.headers.delete('Content-Type'); } @@ -80,12 +83,9 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, + body: getValidRequestBody(opts), }; - if (opts.serializedBody) { - requestInit.body = opts.serializedBody; - } - let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { @@ -215,6 +215,25 @@ export const createClient = (config: Config = {}): Client => { }; }; + function getValidRequestBody(options: ResolvedRequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + return null; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/svelte-query/asClass/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/svelte-query/asClass/client/client.gen.ts index ff0238aec..ff7815f4d 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/svelte-query/asClass/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/svelte-query/asClass/client/client.gen.ts @@ -60,12 +60,15 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.body === undefined || opts.body === '') { + if ( + opts.body === undefined || + (opts.serializedBody !== undefined && opts.serializedBody === '') + ) { opts.headers.delete('Content-Type'); } @@ -80,12 +83,9 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, + body: getValidRequestBody(opts), }; - if (opts.serializedBody) { - requestInit.body = opts.serializedBody; - } - let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { @@ -215,6 +215,25 @@ export const createClient = (config: Config = {}): Client => { }; }; + function getValidRequestBody(options: ResolvedRequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + return null; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/svelte-query/fetch/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/svelte-query/fetch/client/client.gen.ts index ff0238aec..ff7815f4d 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/svelte-query/fetch/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/svelte-query/fetch/client/client.gen.ts @@ -60,12 +60,15 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.body === undefined || opts.body === '') { + if ( + opts.body === undefined || + (opts.serializedBody !== undefined && opts.serializedBody === '') + ) { opts.headers.delete('Content-Type'); } @@ -80,12 +83,9 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, + body: getValidRequestBody(opts), }; - if (opts.serializedBody) { - requestInit.body = opts.serializedBody; - } - let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { @@ -215,6 +215,25 @@ export const createClient = (config: Config = {}): Client => { }; }; + function getValidRequestBody(options: ResolvedRequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + return null; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/svelte-query/name-builder/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/svelte-query/name-builder/client/client.gen.ts index ff0238aec..ff7815f4d 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/svelte-query/name-builder/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/svelte-query/name-builder/client/client.gen.ts @@ -60,12 +60,15 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.body === undefined || opts.body === '') { + if ( + opts.body === undefined || + (opts.serializedBody !== undefined && opts.serializedBody === '') + ) { opts.headers.delete('Content-Type'); } @@ -80,12 +83,9 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, + body: getValidRequestBody(opts), }; - if (opts.serializedBody) { - requestInit.body = opts.serializedBody; - } - let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { @@ -215,6 +215,25 @@ export const createClient = (config: Config = {}): Client => { }; }; + function getValidRequestBody(options: ResolvedRequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + return null; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/vue-query/asClass/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/vue-query/asClass/client/client.gen.ts index ff0238aec..ff7815f4d 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/vue-query/asClass/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/vue-query/asClass/client/client.gen.ts @@ -60,12 +60,15 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.body === undefined || opts.body === '') { + if ( + opts.body === undefined || + (opts.serializedBody !== undefined && opts.serializedBody === '') + ) { opts.headers.delete('Content-Type'); } @@ -80,12 +83,9 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, + body: getValidRequestBody(opts), }; - if (opts.serializedBody) { - requestInit.body = opts.serializedBody; - } - let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { @@ -215,6 +215,25 @@ export const createClient = (config: Config = {}): Client => { }; }; + function getValidRequestBody(options: ResolvedRequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + return null; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/vue-query/fetch/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/vue-query/fetch/client/client.gen.ts index ff0238aec..ff7815f4d 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/vue-query/fetch/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/vue-query/fetch/client/client.gen.ts @@ -60,12 +60,15 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.body === undefined || opts.body === '') { + if ( + opts.body === undefined || + (opts.serializedBody !== undefined && opts.serializedBody === '') + ) { opts.headers.delete('Content-Type'); } @@ -80,12 +83,9 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, + body: getValidRequestBody(opts), }; - if (opts.serializedBody) { - requestInit.body = opts.serializedBody; - } - let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { @@ -215,6 +215,25 @@ export const createClient = (config: Config = {}): Client => { }; }; + function getValidRequestBody(options: ResolvedRequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + return null; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/vue-query/name-builder/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/vue-query/name-builder/client/client.gen.ts index ff0238aec..ff7815f4d 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/vue-query/name-builder/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/vue-query/name-builder/client/client.gen.ts @@ -60,12 +60,15 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.body === undefined || opts.body === '') { + if ( + opts.body === undefined || + (opts.serializedBody !== undefined && opts.serializedBody === '') + ) { opts.headers.delete('Content-Type'); } @@ -80,12 +83,9 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, + body: getValidRequestBody(opts), }; - if (opts.serializedBody) { - requestInit.body = opts.serializedBody; - } - let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { @@ -215,6 +215,25 @@ export const createClient = (config: Config = {}): Client => { }; }; + function getValidRequestBody(options: ResolvedRequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + return null; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-api-key/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-api-key/client/client.gen.ts index ff0238aec..ff7815f4d 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-api-key/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-api-key/client/client.gen.ts @@ -60,12 +60,15 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.body === undefined || opts.body === '') { + if ( + opts.body === undefined || + (opts.serializedBody !== undefined && opts.serializedBody === '') + ) { opts.headers.delete('Content-Type'); } @@ -80,12 +83,9 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, + body: getValidRequestBody(opts), }; - if (opts.serializedBody) { - requestInit.body = opts.serializedBody; - } - let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { @@ -215,6 +215,25 @@ export const createClient = (config: Config = {}): Client => { }; }; + function getValidRequestBody(options: ResolvedRequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + return null; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-false/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-false/client/client.gen.ts index ff0238aec..ff7815f4d 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-false/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-false/client/client.gen.ts @@ -60,12 +60,15 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.body === undefined || opts.body === '') { + if ( + opts.body === undefined || + (opts.serializedBody !== undefined && opts.serializedBody === '') + ) { opts.headers.delete('Content-Type'); } @@ -80,12 +83,9 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, + body: getValidRequestBody(opts), }; - if (opts.serializedBody) { - requestInit.body = opts.serializedBody; - } - let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { @@ -215,6 +215,25 @@ export const createClient = (config: Config = {}): Client => { }; }; + function getValidRequestBody(options: ResolvedRequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + return null; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-http-bearer/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-http-bearer/client/client.gen.ts index ff0238aec..ff7815f4d 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-http-bearer/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-http-bearer/client/client.gen.ts @@ -60,12 +60,15 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.body === undefined || opts.body === '') { + if ( + opts.body === undefined || + (opts.serializedBody !== undefined && opts.serializedBody === '') + ) { opts.headers.delete('Content-Type'); } @@ -80,12 +83,9 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, + body: getValidRequestBody(opts), }; - if (opts.serializedBody) { - requestInit.body = opts.serializedBody; - } - let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { @@ -215,6 +215,25 @@ export const createClient = (config: Config = {}): Client => { }; }; + function getValidRequestBody(options: ResolvedRequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + return null; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-oauth2/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-oauth2/client/client.gen.ts index ff0238aec..ff7815f4d 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-oauth2/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-oauth2/client/client.gen.ts @@ -60,12 +60,15 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.body === undefined || opts.body === '') { + if ( + opts.body === undefined || + (opts.serializedBody !== undefined && opts.serializedBody === '') + ) { opts.headers.delete('Content-Type'); } @@ -80,12 +83,9 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, + body: getValidRequestBody(opts), }; - if (opts.serializedBody) { - requestInit.body = opts.serializedBody; - } - let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { @@ -215,6 +215,25 @@ export const createClient = (config: Config = {}): Client => { }; }; + function getValidRequestBody(options: ResolvedRequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + return null; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-open-id-connect/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-open-id-connect/client/client.gen.ts index ff0238aec..ff7815f4d 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-open-id-connect/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-open-id-connect/client/client.gen.ts @@ -60,12 +60,15 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.body === undefined || opts.body === '') { + if ( + opts.body === undefined || + (opts.serializedBody !== undefined && opts.serializedBody === '') + ) { opts.headers.delete('Content-Type'); } @@ -80,12 +83,9 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, + body: getValidRequestBody(opts), }; - if (opts.serializedBody) { - requestInit.body = opts.serializedBody; - } - let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { @@ -215,6 +215,25 @@ export const createClient = (config: Config = {}): Client => { }; }; + function getValidRequestBody(options: ResolvedRequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + return null; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/servers/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/servers/client/client.gen.ts index ff0238aec..ff7815f4d 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/servers/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/servers/client/client.gen.ts @@ -60,12 +60,15 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.body === undefined || opts.body === '') { + if ( + opts.body === undefined || + (opts.serializedBody !== undefined && opts.serializedBody === '') + ) { opts.headers.delete('Content-Type'); } @@ -80,12 +83,9 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, + body: getValidRequestBody(opts), }; - if (opts.serializedBody) { - requestInit.body = opts.serializedBody; - } - let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { @@ -215,6 +215,25 @@ export const createClient = (config: Config = {}): Client => { }; }; + function getValidRequestBody(options: ResolvedRequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + return null; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transformers-all-of/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transformers-all-of/client/client.gen.ts index ff0238aec..ff7815f4d 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transformers-all-of/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transformers-all-of/client/client.gen.ts @@ -60,12 +60,15 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.body === undefined || opts.body === '') { + if ( + opts.body === undefined || + (opts.serializedBody !== undefined && opts.serializedBody === '') + ) { opts.headers.delete('Content-Type'); } @@ -80,12 +83,9 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, + body: getValidRequestBody(opts), }; - if (opts.serializedBody) { - requestInit.body = opts.serializedBody; - } - let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { @@ -215,6 +215,25 @@ export const createClient = (config: Config = {}): Client => { }; }; + function getValidRequestBody(options: ResolvedRequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + return null; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transformers-any-of-null/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transformers-any-of-null/client/client.gen.ts index ff0238aec..ff7815f4d 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transformers-any-of-null/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transformers-any-of-null/client/client.gen.ts @@ -60,12 +60,15 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.body === undefined || opts.body === '') { + if ( + opts.body === undefined || + (opts.serializedBody !== undefined && opts.serializedBody === '') + ) { opts.headers.delete('Content-Type'); } @@ -80,12 +83,9 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, + body: getValidRequestBody(opts), }; - if (opts.serializedBody) { - requestInit.body = opts.serializedBody; - } - let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { @@ -215,6 +215,25 @@ export const createClient = (config: Config = {}): Client => { }; }; + function getValidRequestBody(options: ResolvedRequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + return null; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transformers-array/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transformers-array/client/client.gen.ts index ff0238aec..ff7815f4d 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transformers-array/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transformers-array/client/client.gen.ts @@ -60,12 +60,15 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.body === undefined || opts.body === '') { + if ( + opts.body === undefined || + (opts.serializedBody !== undefined && opts.serializedBody === '') + ) { opts.headers.delete('Content-Type'); } @@ -80,12 +83,9 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, + body: getValidRequestBody(opts), }; - if (opts.serializedBody) { - requestInit.body = opts.serializedBody; - } - let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { @@ -215,6 +215,25 @@ export const createClient = (config: Config = {}): Client => { }; }; + function getValidRequestBody(options: ResolvedRequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + return null; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transforms-read-write/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transforms-read-write/client/client.gen.ts index ff0238aec..ff7815f4d 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transforms-read-write/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transforms-read-write/client/client.gen.ts @@ -60,12 +60,15 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.body === undefined || opts.body === '') { + if ( + opts.body === undefined || + (opts.serializedBody !== undefined && opts.serializedBody === '') + ) { opts.headers.delete('Content-Type'); } @@ -80,12 +83,9 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, + body: getValidRequestBody(opts), }; - if (opts.serializedBody) { - requestInit.body = opts.serializedBody; - } - let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { @@ -215,6 +215,25 @@ export const createClient = (config: Config = {}): Client => { }; }; + function getValidRequestBody(options: ResolvedRequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + return null; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/body-response-text-plain/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/body-response-text-plain/client/client.gen.ts index ff0238aec..ff7815f4d 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/body-response-text-plain/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/body-response-text-plain/client/client.gen.ts @@ -60,12 +60,15 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.body === undefined || opts.body === '') { + if ( + opts.body === undefined || + (opts.serializedBody !== undefined && opts.serializedBody === '') + ) { opts.headers.delete('Content-Type'); } @@ -80,12 +83,9 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, + body: getValidRequestBody(opts), }; - if (opts.serializedBody) { - requestInit.body = opts.serializedBody; - } - let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { @@ -215,6 +215,25 @@ export const createClient = (config: Config = {}): Client => { }; }; + function getValidRequestBody(options: ResolvedRequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + return null; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-false/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-false/client/client.gen.ts index ff0238aec..ff7815f4d 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-false/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-false/client/client.gen.ts @@ -60,12 +60,15 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.body === undefined || opts.body === '') { + if ( + opts.body === undefined || + (opts.serializedBody !== undefined && opts.serializedBody === '') + ) { opts.headers.delete('Content-Type'); } @@ -80,12 +83,9 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, + body: getValidRequestBody(opts), }; - if (opts.serializedBody) { - requestInit.body = opts.serializedBody; - } - let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { @@ -215,6 +215,25 @@ export const createClient = (config: Config = {}): Client => { }; }; + function getValidRequestBody(options: ResolvedRequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + return null; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-number/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-number/client/client.gen.ts index ff0238aec..ff7815f4d 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-number/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-number/client/client.gen.ts @@ -60,12 +60,15 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.body === undefined || opts.body === '') { + if ( + opts.body === undefined || + (opts.serializedBody !== undefined && opts.serializedBody === '') + ) { opts.headers.delete('Content-Type'); } @@ -80,12 +83,9 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, + body: getValidRequestBody(opts), }; - if (opts.serializedBody) { - requestInit.body = opts.serializedBody; - } - let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { @@ -215,6 +215,25 @@ export const createClient = (config: Config = {}): Client => { }; }; + function getValidRequestBody(options: ResolvedRequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + return null; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-strict/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-strict/client/client.gen.ts index ff0238aec..ff7815f4d 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-strict/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-strict/client/client.gen.ts @@ -60,12 +60,15 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.body === undefined || opts.body === '') { + if ( + opts.body === undefined || + (opts.serializedBody !== undefined && opts.serializedBody === '') + ) { opts.headers.delete('Content-Type'); } @@ -80,12 +83,9 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, + body: getValidRequestBody(opts), }; - if (opts.serializedBody) { - requestInit.body = opts.serializedBody; - } - let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { @@ -215,6 +215,25 @@ export const createClient = (config: Config = {}): Client => { }; }; + function getValidRequestBody(options: ResolvedRequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + return null; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-string/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-string/client/client.gen.ts index ff0238aec..ff7815f4d 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-string/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-string/client/client.gen.ts @@ -60,12 +60,15 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.body === undefined || opts.body === '') { + if ( + opts.body === undefined || + (opts.serializedBody !== undefined && opts.serializedBody === '') + ) { opts.headers.delete('Content-Type'); } @@ -80,12 +83,9 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, + body: getValidRequestBody(opts), }; - if (opts.serializedBody) { - requestInit.body = opts.serializedBody; - } - let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { @@ -215,6 +215,25 @@ export const createClient = (config: Config = {}): Client => { }; }; + function getValidRequestBody(options: ResolvedRequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + return null; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/clean-false/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/clean-false/client/client.gen.ts index ff0238aec..ff7815f4d 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/clean-false/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/clean-false/client/client.gen.ts @@ -60,12 +60,15 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.body === undefined || opts.body === '') { + if ( + opts.body === undefined || + (opts.serializedBody !== undefined && opts.serializedBody === '') + ) { opts.headers.delete('Content-Type'); } @@ -80,12 +83,9 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, + body: getValidRequestBody(opts), }; - if (opts.serializedBody) { - requestInit.body = opts.serializedBody; - } - let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { @@ -215,6 +215,25 @@ export const createClient = (config: Config = {}): Client => { }; }; + function getValidRequestBody(options: ResolvedRequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + return null; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/default/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/default/client/client.gen.ts index ff0238aec..ff7815f4d 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/default/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/default/client/client.gen.ts @@ -60,12 +60,15 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.body === undefined || opts.body === '') { + if ( + opts.body === undefined || + (opts.serializedBody !== undefined && opts.serializedBody === '') + ) { opts.headers.delete('Content-Type'); } @@ -80,12 +83,9 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, + body: getValidRequestBody(opts), }; - if (opts.serializedBody) { - requestInit.body = opts.serializedBody; - } - let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { @@ -215,6 +215,25 @@ export const createClient = (config: Config = {}): Client => { }; }; + function getValidRequestBody(options: ResolvedRequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + return null; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/sdk-client-optional/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/sdk-client-optional/client/client.gen.ts index ff0238aec..ff7815f4d 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/sdk-client-optional/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/sdk-client-optional/client/client.gen.ts @@ -60,12 +60,15 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.body === undefined || opts.body === '') { + if ( + opts.body === undefined || + (opts.serializedBody !== undefined && opts.serializedBody === '') + ) { opts.headers.delete('Content-Type'); } @@ -80,12 +83,9 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, + body: getValidRequestBody(opts), }; - if (opts.serializedBody) { - requestInit.body = opts.serializedBody; - } - let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { @@ -215,6 +215,25 @@ export const createClient = (config: Config = {}): Client => { }; }; + function getValidRequestBody(options: ResolvedRequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + return null; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/sdk-client-required/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/sdk-client-required/client/client.gen.ts index ff0238aec..ff7815f4d 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/sdk-client-required/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/sdk-client-required/client/client.gen.ts @@ -60,12 +60,15 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.body === undefined || opts.body === '') { + if ( + opts.body === undefined || + (opts.serializedBody !== undefined && opts.serializedBody === '') + ) { opts.headers.delete('Content-Type'); } @@ -80,12 +83,9 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, + body: getValidRequestBody(opts), }; - if (opts.serializedBody) { - requestInit.body = opts.serializedBody; - } - let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { @@ -215,6 +215,25 @@ export const createClient = (config: Config = {}): Client => { }; }; + function getValidRequestBody(options: ResolvedRequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + return null; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/tsconfig-nodenext-sdk/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/tsconfig-nodenext-sdk/client/client.gen.ts index 55d5140a5..ca4eebad6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/tsconfig-nodenext-sdk/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/tsconfig-nodenext-sdk/client/client.gen.ts @@ -60,12 +60,15 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.body === undefined || opts.body === '') { + if ( + opts.body === undefined || + (opts.serializedBody !== undefined && opts.serializedBody === '') + ) { opts.headers.delete('Content-Type'); } @@ -80,12 +83,9 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, + body: getValidRequestBody(opts), }; - if (opts.serializedBody) { - requestInit.body = opts.serializedBody; - } - let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { @@ -215,6 +215,25 @@ export const createClient = (config: Config = {}): Client => { }; }; + function getValidRequestBody(options: ResolvedRequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + return null; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-false/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-false/client/client.gen.ts index 17450b9b5..06cae5956 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-false/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-false/client/client.gen.ts @@ -59,12 +59,15 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.body === undefined || opts.body === '') { + if ( + opts.body === undefined || + (opts.serializedBody !== undefined && opts.serializedBody === '') + ) { opts.headers.delete('Content-Type'); } @@ -89,12 +92,9 @@ export const createClient = (config: Config = {}): Client => { const _fetch = opts.fetch!; const requestInit: ReqInit = { ...opts, + body: getValidRequestBody(opts), }; - if (opts.serializedBody) { - requestInit.body = opts.serializedBody; - } - let response = await _fetch(url, requestInit); for (const fn of interceptors.response._fns) { @@ -203,6 +203,25 @@ export const createClient = (config: Config = {}): Client => { }; }; + function getValidRequestBody(options: ResolvedRequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + return null; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-number/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-number/client/client.gen.ts index 17450b9b5..06cae5956 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-number/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-number/client/client.gen.ts @@ -59,12 +59,15 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.body === undefined || opts.body === '') { + if ( + opts.body === undefined || + (opts.serializedBody !== undefined && opts.serializedBody === '') + ) { opts.headers.delete('Content-Type'); } @@ -89,12 +92,9 @@ export const createClient = (config: Config = {}): Client => { const _fetch = opts.fetch!; const requestInit: ReqInit = { ...opts, + body: getValidRequestBody(opts), }; - if (opts.serializedBody) { - requestInit.body = opts.serializedBody; - } - let response = await _fetch(url, requestInit); for (const fn of interceptors.response._fns) { @@ -203,6 +203,25 @@ export const createClient = (config: Config = {}): Client => { }; }; + function getValidRequestBody(options: ResolvedRequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + return null; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-strict/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-strict/client/client.gen.ts index 17450b9b5..06cae5956 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-strict/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-strict/client/client.gen.ts @@ -59,12 +59,15 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.body === undefined || opts.body === '') { + if ( + opts.body === undefined || + (opts.serializedBody !== undefined && opts.serializedBody === '') + ) { opts.headers.delete('Content-Type'); } @@ -89,12 +92,9 @@ export const createClient = (config: Config = {}): Client => { const _fetch = opts.fetch!; const requestInit: ReqInit = { ...opts, + body: getValidRequestBody(opts), }; - if (opts.serializedBody) { - requestInit.body = opts.serializedBody; - } - let response = await _fetch(url, requestInit); for (const fn of interceptors.response._fns) { @@ -203,6 +203,25 @@ export const createClient = (config: Config = {}): Client => { }; }; + function getValidRequestBody(options: ResolvedRequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + return null; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-string/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-string/client/client.gen.ts index 17450b9b5..06cae5956 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-string/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-string/client/client.gen.ts @@ -59,12 +59,15 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.body === undefined || opts.body === '') { + if ( + opts.body === undefined || + (opts.serializedBody !== undefined && opts.serializedBody === '') + ) { opts.headers.delete('Content-Type'); } @@ -89,12 +92,9 @@ export const createClient = (config: Config = {}): Client => { const _fetch = opts.fetch!; const requestInit: ReqInit = { ...opts, + body: getValidRequestBody(opts), }; - if (opts.serializedBody) { - requestInit.body = opts.serializedBody; - } - let response = await _fetch(url, requestInit); for (const fn of interceptors.response._fns) { @@ -203,6 +203,25 @@ export const createClient = (config: Config = {}): Client => { }; }; + function getValidRequestBody(options: ResolvedRequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + return null; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/clean-false/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/clean-false/client/client.gen.ts index 17450b9b5..06cae5956 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/clean-false/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/clean-false/client/client.gen.ts @@ -59,12 +59,15 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.body === undefined || opts.body === '') { + if ( + opts.body === undefined || + (opts.serializedBody !== undefined && opts.serializedBody === '') + ) { opts.headers.delete('Content-Type'); } @@ -89,12 +92,9 @@ export const createClient = (config: Config = {}): Client => { const _fetch = opts.fetch!; const requestInit: ReqInit = { ...opts, + body: getValidRequestBody(opts), }; - if (opts.serializedBody) { - requestInit.body = opts.serializedBody; - } - let response = await _fetch(url, requestInit); for (const fn of interceptors.response._fns) { @@ -203,6 +203,25 @@ export const createClient = (config: Config = {}): Client => { }; }; + function getValidRequestBody(options: ResolvedRequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + return null; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/default/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/default/client/client.gen.ts index 17450b9b5..06cae5956 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/default/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/default/client/client.gen.ts @@ -59,12 +59,15 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.body === undefined || opts.body === '') { + if ( + opts.body === undefined || + (opts.serializedBody !== undefined && opts.serializedBody === '') + ) { opts.headers.delete('Content-Type'); } @@ -89,12 +92,9 @@ export const createClient = (config: Config = {}): Client => { const _fetch = opts.fetch!; const requestInit: ReqInit = { ...opts, + body: getValidRequestBody(opts), }; - if (opts.serializedBody) { - requestInit.body = opts.serializedBody; - } - let response = await _fetch(url, requestInit); for (const fn of interceptors.response._fns) { @@ -203,6 +203,25 @@ export const createClient = (config: Config = {}): Client => { }; }; + function getValidRequestBody(options: ResolvedRequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + return null; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/sdk-client-optional/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/sdk-client-optional/client/client.gen.ts index 17450b9b5..06cae5956 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/sdk-client-optional/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/sdk-client-optional/client/client.gen.ts @@ -59,12 +59,15 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.body === undefined || opts.body === '') { + if ( + opts.body === undefined || + (opts.serializedBody !== undefined && opts.serializedBody === '') + ) { opts.headers.delete('Content-Type'); } @@ -89,12 +92,9 @@ export const createClient = (config: Config = {}): Client => { const _fetch = opts.fetch!; const requestInit: ReqInit = { ...opts, + body: getValidRequestBody(opts), }; - if (opts.serializedBody) { - requestInit.body = opts.serializedBody; - } - let response = await _fetch(url, requestInit); for (const fn of interceptors.response._fns) { @@ -203,6 +203,25 @@ export const createClient = (config: Config = {}): Client => { }; }; + function getValidRequestBody(options: ResolvedRequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + return null; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/sdk-client-required/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/sdk-client-required/client/client.gen.ts index 17450b9b5..06cae5956 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/sdk-client-required/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/sdk-client-required/client/client.gen.ts @@ -59,12 +59,15 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.body === undefined || opts.body === '') { + if ( + opts.body === undefined || + (opts.serializedBody !== undefined && opts.serializedBody === '') + ) { opts.headers.delete('Content-Type'); } @@ -89,12 +92,9 @@ export const createClient = (config: Config = {}): Client => { const _fetch = opts.fetch!; const requestInit: ReqInit = { ...opts, + body: getValidRequestBody(opts), }; - if (opts.serializedBody) { - requestInit.body = opts.serializedBody; - } - let response = await _fetch(url, requestInit); for (const fn of interceptors.response._fns) { @@ -203,6 +203,25 @@ export const createClient = (config: Config = {}): Client => { }; }; + function getValidRequestBody(options: ResolvedRequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + return null; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/tsconfig-nodenext-sdk/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/tsconfig-nodenext-sdk/client/client.gen.ts index 1b6204c57..6579f7ab6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/tsconfig-nodenext-sdk/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/tsconfig-nodenext-sdk/client/client.gen.ts @@ -59,12 +59,15 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.body === undefined || opts.body === '') { + if ( + opts.body === undefined || + (opts.serializedBody !== undefined && opts.serializedBody === '') + ) { opts.headers.delete('Content-Type'); } @@ -89,12 +92,9 @@ export const createClient = (config: Config = {}): Client => { const _fetch = opts.fetch!; const requestInit: ReqInit = { ...opts, + body: getValidRequestBody(opts), }; - if (opts.serializedBody) { - requestInit.body = opts.serializedBody; - } - let response = await _fetch(url, requestInit); for (const fn of interceptors.response._fns) { @@ -203,6 +203,25 @@ export const createClient = (config: Config = {}): Client => { }; }; + function getValidRequestBody(options: ResolvedRequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + return null; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/headers/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/headers/client/client.gen.ts index ff0238aec..ff7815f4d 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/headers/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/headers/client/client.gen.ts @@ -60,12 +60,15 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.body === undefined || opts.body === '') { + if ( + opts.body === undefined || + (opts.serializedBody !== undefined && opts.serializedBody === '') + ) { opts.headers.delete('Content-Type'); } @@ -80,12 +83,9 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, + body: getValidRequestBody(opts), }; - if (opts.serializedBody) { - requestInit.body = opts.serializedBody; - } - let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { @@ -215,6 +215,25 @@ export const createClient = (config: Config = {}): Client => { }; }; + function getValidRequestBody(options: ResolvedRequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + return null; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/internal-name-conflict/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/internal-name-conflict/client/client.gen.ts index ff0238aec..ff7815f4d 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/internal-name-conflict/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/internal-name-conflict/client/client.gen.ts @@ -60,12 +60,15 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.body === undefined || opts.body === '') { + if ( + opts.body === undefined || + (opts.serializedBody !== undefined && opts.serializedBody === '') + ) { opts.headers.delete('Content-Type'); } @@ -80,12 +83,9 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, + body: getValidRequestBody(opts), }; - if (opts.serializedBody) { - requestInit.body = opts.serializedBody; - } - let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { @@ -215,6 +215,25 @@ export const createClient = (config: Config = {}): Client => { }; }; + function getValidRequestBody(options: ResolvedRequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + return null; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/pagination-ref/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/pagination-ref/client/client.gen.ts index ff0238aec..ff7815f4d 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/pagination-ref/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/pagination-ref/client/client.gen.ts @@ -60,12 +60,15 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.body === undefined || opts.body === '') { + if ( + opts.body === undefined || + (opts.serializedBody !== undefined && opts.serializedBody === '') + ) { opts.headers.delete('Content-Type'); } @@ -80,12 +83,9 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, + body: getValidRequestBody(opts), }; - if (opts.serializedBody) { - requestInit.body = opts.serializedBody; - } - let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { @@ -215,6 +215,25 @@ export const createClient = (config: Config = {}): Client => { }; }; + function getValidRequestBody(options: ResolvedRequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + return null; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/parameter-explode-false/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/parameter-explode-false/client/client.gen.ts index ff0238aec..ff7815f4d 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/parameter-explode-false/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/parameter-explode-false/client/client.gen.ts @@ -60,12 +60,15 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.body === undefined || opts.body === '') { + if ( + opts.body === undefined || + (opts.serializedBody !== undefined && opts.serializedBody === '') + ) { opts.headers.delete('Content-Type'); } @@ -80,12 +83,9 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, + body: getValidRequestBody(opts), }; - if (opts.serializedBody) { - requestInit.body = opts.serializedBody; - } - let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { @@ -215,6 +215,25 @@ export const createClient = (config: Config = {}): Client => { }; }; + function getValidRequestBody(options: ResolvedRequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + return null; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/client-fetch/sdk-nested-classes-instance/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/client-fetch/sdk-nested-classes-instance/client/client.gen.ts index ff0238aec..ff7815f4d 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/client-fetch/sdk-nested-classes-instance/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/client-fetch/sdk-nested-classes-instance/client/client.gen.ts @@ -60,12 +60,15 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.body === undefined || opts.body === '') { + if ( + opts.body === undefined || + (opts.serializedBody !== undefined && opts.serializedBody === '') + ) { opts.headers.delete('Content-Type'); } @@ -80,12 +83,9 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, + body: getValidRequestBody(opts), }; - if (opts.serializedBody) { - requestInit.body = opts.serializedBody; - } - let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { @@ -215,6 +215,25 @@ export const createClient = (config: Config = {}): Client => { }; }; + function getValidRequestBody(options: ResolvedRequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + return null; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/client-fetch/sdk-nested-classes/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/client-fetch/sdk-nested-classes/client/client.gen.ts index ff0238aec..ff7815f4d 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/client-fetch/sdk-nested-classes/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/client-fetch/sdk-nested-classes/client/client.gen.ts @@ -60,12 +60,15 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.body === undefined || opts.body === '') { + if ( + opts.body === undefined || + (opts.serializedBody !== undefined && opts.serializedBody === '') + ) { opts.headers.delete('Content-Type'); } @@ -80,12 +83,9 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, + body: getValidRequestBody(opts), }; - if (opts.serializedBody) { - requestInit.body = opts.serializedBody; - } - let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { @@ -215,6 +215,25 @@ export const createClient = (config: Config = {}): Client => { }; }; + function getValidRequestBody(options: ResolvedRequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + return null; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/sdk/default/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/sdk/default/client/client.gen.ts index ff0238aec..ff7815f4d 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/sdk/default/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/sdk/default/client/client.gen.ts @@ -60,12 +60,15 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.body === undefined || opts.body === '') { + if ( + opts.body === undefined || + (opts.serializedBody !== undefined && opts.serializedBody === '') + ) { opts.headers.delete('Content-Type'); } @@ -80,12 +83,9 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, + body: getValidRequestBody(opts), }; - if (opts.serializedBody) { - requestInit.body = opts.serializedBody; - } - let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { @@ -215,6 +215,25 @@ export const createClient = (config: Config = {}): Client => { }; }; + function getValidRequestBody(options: ResolvedRequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + return null; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/sdk/instance/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/sdk/instance/client/client.gen.ts index ff0238aec..ff7815f4d 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/sdk/instance/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/sdk/instance/client/client.gen.ts @@ -60,12 +60,15 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.body === undefined || opts.body === '') { + if ( + opts.body === undefined || + (opts.serializedBody !== undefined && opts.serializedBody === '') + ) { opts.headers.delete('Content-Type'); } @@ -80,12 +83,9 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, + body: getValidRequestBody(opts), }; - if (opts.serializedBody) { - requestInit.body = opts.serializedBody; - } - let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { @@ -215,6 +215,25 @@ export const createClient = (config: Config = {}): Client => { }; }; + function getValidRequestBody(options: ResolvedRequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + return null; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/sdk/throwOnError/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/sdk/throwOnError/client/client.gen.ts index ff0238aec..ff7815f4d 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/sdk/throwOnError/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/sdk/throwOnError/client/client.gen.ts @@ -60,12 +60,15 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.body === undefined || opts.body === '') { + if ( + opts.body === undefined || + (opts.serializedBody !== undefined && opts.serializedBody === '') + ) { opts.headers.delete('Content-Type'); } @@ -80,12 +83,9 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, + body: getValidRequestBody(opts), }; - if (opts.serializedBody) { - requestInit.body = opts.serializedBody; - } - let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { @@ -215,6 +215,25 @@ export const createClient = (config: Config = {}): Client => { }; }; + function getValidRequestBody(options: ResolvedRequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + return null; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/transformers/type-format-valibot/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/transformers/type-format-valibot/client/client.gen.ts index ff0238aec..ff7815f4d 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/transformers/type-format-valibot/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/transformers/type-format-valibot/client/client.gen.ts @@ -60,12 +60,15 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.body === undefined || opts.body === '') { + if ( + opts.body === undefined || + (opts.serializedBody !== undefined && opts.serializedBody === '') + ) { opts.headers.delete('Content-Type'); } @@ -80,12 +83,9 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, + body: getValidRequestBody(opts), }; - if (opts.serializedBody) { - requestInit.body = opts.serializedBody; - } - let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { @@ -215,6 +215,25 @@ export const createClient = (config: Config = {}): Client => { }; }; + function getValidRequestBody(options: ResolvedRequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + return null; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/transformers/type-format-zod/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/transformers/type-format-zod/client/client.gen.ts index ff0238aec..ff7815f4d 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/transformers/type-format-zod/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/transformers/type-format-zod/client/client.gen.ts @@ -60,12 +60,15 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.body === undefined || opts.body === '') { + if ( + opts.body === undefined || + (opts.serializedBody !== undefined && opts.serializedBody === '') + ) { opts.headers.delete('Content-Type'); } @@ -80,12 +83,9 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, + body: getValidRequestBody(opts), }; - if (opts.serializedBody) { - requestInit.body = opts.serializedBody; - } - let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { @@ -215,6 +215,25 @@ export const createClient = (config: Config = {}): Client => { }; }; + function getValidRequestBody(options: ResolvedRequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + return null; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/typescript/transforms-read-write-custom-name/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/typescript/transforms-read-write-custom-name/client/client.gen.ts index ff0238aec..ff7815f4d 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/typescript/transforms-read-write-custom-name/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/typescript/transforms-read-write-custom-name/client/client.gen.ts @@ -60,12 +60,15 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.body === undefined || opts.body === '') { + if ( + opts.body === undefined || + (opts.serializedBody !== undefined && opts.serializedBody === '') + ) { opts.headers.delete('Content-Type'); } @@ -80,12 +83,9 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, + body: getValidRequestBody(opts), }; - if (opts.serializedBody) { - requestInit.body = opts.serializedBody; - } - let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { @@ -215,6 +215,25 @@ export const createClient = (config: Config = {}): Client => { }; }; + function getValidRequestBody(options: ResolvedRequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + return null; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/typescript/transforms-read-write-ignore/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/typescript/transforms-read-write-ignore/client/client.gen.ts index ff0238aec..ff7815f4d 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/typescript/transforms-read-write-ignore/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/typescript/transforms-read-write-ignore/client/client.gen.ts @@ -60,12 +60,15 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.body === undefined || opts.body === '') { + if ( + opts.body === undefined || + (opts.serializedBody !== undefined && opts.serializedBody === '') + ) { opts.headers.delete('Content-Type'); } @@ -80,12 +83,9 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, + body: getValidRequestBody(opts), }; - if (opts.serializedBody) { - requestInit.body = opts.serializedBody; - } - let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { @@ -215,6 +215,25 @@ export const createClient = (config: Config = {}): Client => { }; }; + function getValidRequestBody(options: ResolvedRequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + return null; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@pinia/colada/fetch/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@pinia/colada/fetch/client/client.gen.ts index ff0238aec..ff7815f4d 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@pinia/colada/fetch/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@pinia/colada/fetch/client/client.gen.ts @@ -60,12 +60,15 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.body === undefined || opts.body === '') { + if ( + opts.body === undefined || + (opts.serializedBody !== undefined && opts.serializedBody === '') + ) { opts.headers.delete('Content-Type'); } @@ -80,12 +83,9 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, + body: getValidRequestBody(opts), }; - if (opts.serializedBody) { - requestInit.body = opts.serializedBody; - } - let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { @@ -215,6 +215,25 @@ export const createClient = (config: Config = {}): Client => { }; }; + function getValidRequestBody(options: ResolvedRequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + return null; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@pinia/colada/group-by-tag/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@pinia/colada/group-by-tag/client/client.gen.ts index ff0238aec..ff7815f4d 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@pinia/colada/group-by-tag/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@pinia/colada/group-by-tag/client/client.gen.ts @@ -60,12 +60,15 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.body === undefined || opts.body === '') { + if ( + opts.body === undefined || + (opts.serializedBody !== undefined && opts.serializedBody === '') + ) { opts.headers.delete('Content-Type'); } @@ -80,12 +83,9 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, + body: getValidRequestBody(opts), }; - if (opts.serializedBody) { - requestInit.body = opts.serializedBody; - } - let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { @@ -215,6 +215,25 @@ export const createClient = (config: Config = {}): Client => { }; }; + function getValidRequestBody(options: ResolvedRequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + return null; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/angular-query-experimental/asClass/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/angular-query-experimental/asClass/client/client.gen.ts index ff0238aec..ff7815f4d 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/angular-query-experimental/asClass/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/angular-query-experimental/asClass/client/client.gen.ts @@ -60,12 +60,15 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.body === undefined || opts.body === '') { + if ( + opts.body === undefined || + (opts.serializedBody !== undefined && opts.serializedBody === '') + ) { opts.headers.delete('Content-Type'); } @@ -80,12 +83,9 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, + body: getValidRequestBody(opts), }; - if (opts.serializedBody) { - requestInit.body = opts.serializedBody; - } - let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { @@ -215,6 +215,25 @@ export const createClient = (config: Config = {}): Client => { }; }; + function getValidRequestBody(options: ResolvedRequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + return null; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/angular-query-experimental/fetch/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/angular-query-experimental/fetch/client/client.gen.ts index ff0238aec..ff7815f4d 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/angular-query-experimental/fetch/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/angular-query-experimental/fetch/client/client.gen.ts @@ -60,12 +60,15 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.body === undefined || opts.body === '') { + if ( + opts.body === undefined || + (opts.serializedBody !== undefined && opts.serializedBody === '') + ) { opts.headers.delete('Content-Type'); } @@ -80,12 +83,9 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, + body: getValidRequestBody(opts), }; - if (opts.serializedBody) { - requestInit.body = opts.serializedBody; - } - let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { @@ -215,6 +215,25 @@ export const createClient = (config: Config = {}): Client => { }; }; + function getValidRequestBody(options: ResolvedRequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + return null; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/angular-query-experimental/name-builder/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/angular-query-experimental/name-builder/client/client.gen.ts index ff0238aec..ff7815f4d 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/angular-query-experimental/name-builder/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/angular-query-experimental/name-builder/client/client.gen.ts @@ -60,12 +60,15 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.body === undefined || opts.body === '') { + if ( + opts.body === undefined || + (opts.serializedBody !== undefined && opts.serializedBody === '') + ) { opts.headers.delete('Content-Type'); } @@ -80,12 +83,9 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, + body: getValidRequestBody(opts), }; - if (opts.serializedBody) { - requestInit.body = opts.serializedBody; - } - let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { @@ -215,6 +215,25 @@ export const createClient = (config: Config = {}): Client => { }; }; + function getValidRequestBody(options: ResolvedRequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + return null; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/react-query/asClass/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/react-query/asClass/client/client.gen.ts index ff0238aec..ff7815f4d 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/react-query/asClass/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/react-query/asClass/client/client.gen.ts @@ -60,12 +60,15 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.body === undefined || opts.body === '') { + if ( + opts.body === undefined || + (opts.serializedBody !== undefined && opts.serializedBody === '') + ) { opts.headers.delete('Content-Type'); } @@ -80,12 +83,9 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, + body: getValidRequestBody(opts), }; - if (opts.serializedBody) { - requestInit.body = opts.serializedBody; - } - let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { @@ -215,6 +215,25 @@ export const createClient = (config: Config = {}): Client => { }; }; + function getValidRequestBody(options: ResolvedRequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + return null; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/react-query/fetch/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/react-query/fetch/client/client.gen.ts index ff0238aec..ff7815f4d 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/react-query/fetch/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/react-query/fetch/client/client.gen.ts @@ -60,12 +60,15 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.body === undefined || opts.body === '') { + if ( + opts.body === undefined || + (opts.serializedBody !== undefined && opts.serializedBody === '') + ) { opts.headers.delete('Content-Type'); } @@ -80,12 +83,9 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, + body: getValidRequestBody(opts), }; - if (opts.serializedBody) { - requestInit.body = opts.serializedBody; - } - let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { @@ -215,6 +215,25 @@ export const createClient = (config: Config = {}): Client => { }; }; + function getValidRequestBody(options: ResolvedRequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + return null; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/react-query/name-builder/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/react-query/name-builder/client/client.gen.ts index ff0238aec..ff7815f4d 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/react-query/name-builder/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/react-query/name-builder/client/client.gen.ts @@ -60,12 +60,15 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.body === undefined || opts.body === '') { + if ( + opts.body === undefined || + (opts.serializedBody !== undefined && opts.serializedBody === '') + ) { opts.headers.delete('Content-Type'); } @@ -80,12 +83,9 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, + body: getValidRequestBody(opts), }; - if (opts.serializedBody) { - requestInit.body = opts.serializedBody; - } - let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { @@ -215,6 +215,25 @@ export const createClient = (config: Config = {}): Client => { }; }; + function getValidRequestBody(options: ResolvedRequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + return null; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/solid-query/asClass/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/solid-query/asClass/client/client.gen.ts index ff0238aec..ff7815f4d 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/solid-query/asClass/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/solid-query/asClass/client/client.gen.ts @@ -60,12 +60,15 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.body === undefined || opts.body === '') { + if ( + opts.body === undefined || + (opts.serializedBody !== undefined && opts.serializedBody === '') + ) { opts.headers.delete('Content-Type'); } @@ -80,12 +83,9 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, + body: getValidRequestBody(opts), }; - if (opts.serializedBody) { - requestInit.body = opts.serializedBody; - } - let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { @@ -215,6 +215,25 @@ export const createClient = (config: Config = {}): Client => { }; }; + function getValidRequestBody(options: ResolvedRequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + return null; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/solid-query/fetch/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/solid-query/fetch/client/client.gen.ts index ff0238aec..ff7815f4d 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/solid-query/fetch/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/solid-query/fetch/client/client.gen.ts @@ -60,12 +60,15 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.body === undefined || opts.body === '') { + if ( + opts.body === undefined || + (opts.serializedBody !== undefined && opts.serializedBody === '') + ) { opts.headers.delete('Content-Type'); } @@ -80,12 +83,9 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, + body: getValidRequestBody(opts), }; - if (opts.serializedBody) { - requestInit.body = opts.serializedBody; - } - let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { @@ -215,6 +215,25 @@ export const createClient = (config: Config = {}): Client => { }; }; + function getValidRequestBody(options: ResolvedRequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + return null; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/solid-query/name-builder/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/solid-query/name-builder/client/client.gen.ts index ff0238aec..ff7815f4d 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/solid-query/name-builder/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/solid-query/name-builder/client/client.gen.ts @@ -60,12 +60,15 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.body === undefined || opts.body === '') { + if ( + opts.body === undefined || + (opts.serializedBody !== undefined && opts.serializedBody === '') + ) { opts.headers.delete('Content-Type'); } @@ -80,12 +83,9 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, + body: getValidRequestBody(opts), }; - if (opts.serializedBody) { - requestInit.body = opts.serializedBody; - } - let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { @@ -215,6 +215,25 @@ export const createClient = (config: Config = {}): Client => { }; }; + function getValidRequestBody(options: ResolvedRequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + return null; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/svelte-query/asClass/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/svelte-query/asClass/client/client.gen.ts index ff0238aec..ff7815f4d 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/svelte-query/asClass/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/svelte-query/asClass/client/client.gen.ts @@ -60,12 +60,15 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.body === undefined || opts.body === '') { + if ( + opts.body === undefined || + (opts.serializedBody !== undefined && opts.serializedBody === '') + ) { opts.headers.delete('Content-Type'); } @@ -80,12 +83,9 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, + body: getValidRequestBody(opts), }; - if (opts.serializedBody) { - requestInit.body = opts.serializedBody; - } - let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { @@ -215,6 +215,25 @@ export const createClient = (config: Config = {}): Client => { }; }; + function getValidRequestBody(options: ResolvedRequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + return null; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/svelte-query/fetch/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/svelte-query/fetch/client/client.gen.ts index ff0238aec..ff7815f4d 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/svelte-query/fetch/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/svelte-query/fetch/client/client.gen.ts @@ -60,12 +60,15 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.body === undefined || opts.body === '') { + if ( + opts.body === undefined || + (opts.serializedBody !== undefined && opts.serializedBody === '') + ) { opts.headers.delete('Content-Type'); } @@ -80,12 +83,9 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, + body: getValidRequestBody(opts), }; - if (opts.serializedBody) { - requestInit.body = opts.serializedBody; - } - let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { @@ -215,6 +215,25 @@ export const createClient = (config: Config = {}): Client => { }; }; + function getValidRequestBody(options: ResolvedRequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + return null; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/svelte-query/name-builder/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/svelte-query/name-builder/client/client.gen.ts index ff0238aec..ff7815f4d 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/svelte-query/name-builder/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/svelte-query/name-builder/client/client.gen.ts @@ -60,12 +60,15 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.body === undefined || opts.body === '') { + if ( + opts.body === undefined || + (opts.serializedBody !== undefined && opts.serializedBody === '') + ) { opts.headers.delete('Content-Type'); } @@ -80,12 +83,9 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, + body: getValidRequestBody(opts), }; - if (opts.serializedBody) { - requestInit.body = opts.serializedBody; - } - let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { @@ -215,6 +215,25 @@ export const createClient = (config: Config = {}): Client => { }; }; + function getValidRequestBody(options: ResolvedRequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + return null; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/vue-query/asClass/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/vue-query/asClass/client/client.gen.ts index ff0238aec..ff7815f4d 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/vue-query/asClass/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/vue-query/asClass/client/client.gen.ts @@ -60,12 +60,15 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.body === undefined || opts.body === '') { + if ( + opts.body === undefined || + (opts.serializedBody !== undefined && opts.serializedBody === '') + ) { opts.headers.delete('Content-Type'); } @@ -80,12 +83,9 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, + body: getValidRequestBody(opts), }; - if (opts.serializedBody) { - requestInit.body = opts.serializedBody; - } - let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { @@ -215,6 +215,25 @@ export const createClient = (config: Config = {}): Client => { }; }; + function getValidRequestBody(options: ResolvedRequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + return null; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/vue-query/fetch/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/vue-query/fetch/client/client.gen.ts index ff0238aec..ff7815f4d 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/vue-query/fetch/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/vue-query/fetch/client/client.gen.ts @@ -60,12 +60,15 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.body === undefined || opts.body === '') { + if ( + opts.body === undefined || + (opts.serializedBody !== undefined && opts.serializedBody === '') + ) { opts.headers.delete('Content-Type'); } @@ -80,12 +83,9 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, + body: getValidRequestBody(opts), }; - if (opts.serializedBody) { - requestInit.body = opts.serializedBody; - } - let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { @@ -215,6 +215,25 @@ export const createClient = (config: Config = {}): Client => { }; }; + function getValidRequestBody(options: ResolvedRequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + return null; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/vue-query/name-builder/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/vue-query/name-builder/client/client.gen.ts index ff0238aec..ff7815f4d 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/vue-query/name-builder/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/vue-query/name-builder/client/client.gen.ts @@ -60,12 +60,15 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.body === undefined || opts.body === '') { + if ( + opts.body === undefined || + (opts.serializedBody !== undefined && opts.serializedBody === '') + ) { opts.headers.delete('Content-Type'); } @@ -80,12 +83,9 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, + body: getValidRequestBody(opts), }; - if (opts.serializedBody) { - requestInit.body = opts.serializedBody; - } - let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { @@ -215,6 +215,25 @@ export const createClient = (config: Config = {}): Client => { }; }; + function getValidRequestBody(options: ResolvedRequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + return null; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-api-key/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-api-key/client/client.gen.ts index ff0238aec..ff7815f4d 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-api-key/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-api-key/client/client.gen.ts @@ -60,12 +60,15 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.body === undefined || opts.body === '') { + if ( + opts.body === undefined || + (opts.serializedBody !== undefined && opts.serializedBody === '') + ) { opts.headers.delete('Content-Type'); } @@ -80,12 +83,9 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, + body: getValidRequestBody(opts), }; - if (opts.serializedBody) { - requestInit.body = opts.serializedBody; - } - let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { @@ -215,6 +215,25 @@ export const createClient = (config: Config = {}): Client => { }; }; + function getValidRequestBody(options: ResolvedRequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + return null; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-false/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-false/client/client.gen.ts index ff0238aec..ff7815f4d 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-false/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-false/client/client.gen.ts @@ -60,12 +60,15 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.body === undefined || opts.body === '') { + if ( + opts.body === undefined || + (opts.serializedBody !== undefined && opts.serializedBody === '') + ) { opts.headers.delete('Content-Type'); } @@ -80,12 +83,9 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, + body: getValidRequestBody(opts), }; - if (opts.serializedBody) { - requestInit.body = opts.serializedBody; - } - let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { @@ -215,6 +215,25 @@ export const createClient = (config: Config = {}): Client => { }; }; + function getValidRequestBody(options: ResolvedRequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + return null; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-http-bearer/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-http-bearer/client/client.gen.ts index ff0238aec..ff7815f4d 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-http-bearer/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-http-bearer/client/client.gen.ts @@ -60,12 +60,15 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.body === undefined || opts.body === '') { + if ( + opts.body === undefined || + (opts.serializedBody !== undefined && opts.serializedBody === '') + ) { opts.headers.delete('Content-Type'); } @@ -80,12 +83,9 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, + body: getValidRequestBody(opts), }; - if (opts.serializedBody) { - requestInit.body = opts.serializedBody; - } - let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { @@ -215,6 +215,25 @@ export const createClient = (config: Config = {}): Client => { }; }; + function getValidRequestBody(options: ResolvedRequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + return null; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-oauth2/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-oauth2/client/client.gen.ts index ff0238aec..ff7815f4d 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-oauth2/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-oauth2/client/client.gen.ts @@ -60,12 +60,15 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.body === undefined || opts.body === '') { + if ( + opts.body === undefined || + (opts.serializedBody !== undefined && opts.serializedBody === '') + ) { opts.headers.delete('Content-Type'); } @@ -80,12 +83,9 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, + body: getValidRequestBody(opts), }; - if (opts.serializedBody) { - requestInit.body = opts.serializedBody; - } - let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { @@ -215,6 +215,25 @@ export const createClient = (config: Config = {}): Client => { }; }; + function getValidRequestBody(options: ResolvedRequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + return null; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-open-id-connect/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-open-id-connect/client/client.gen.ts index ff0238aec..ff7815f4d 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-open-id-connect/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-open-id-connect/client/client.gen.ts @@ -60,12 +60,15 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.body === undefined || opts.body === '') { + if ( + opts.body === undefined || + (opts.serializedBody !== undefined && opts.serializedBody === '') + ) { opts.headers.delete('Content-Type'); } @@ -80,12 +83,9 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, + body: getValidRequestBody(opts), }; - if (opts.serializedBody) { - requestInit.body = opts.serializedBody; - } - let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { @@ -215,6 +215,25 @@ export const createClient = (config: Config = {}): Client => { }; }; + function getValidRequestBody(options: ResolvedRequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + return null; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/servers/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/servers/client/client.gen.ts index ff0238aec..ff7815f4d 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/servers/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/servers/client/client.gen.ts @@ -60,12 +60,15 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.body === undefined || opts.body === '') { + if ( + opts.body === undefined || + (opts.serializedBody !== undefined && opts.serializedBody === '') + ) { opts.headers.delete('Content-Type'); } @@ -80,12 +83,9 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, + body: getValidRequestBody(opts), }; - if (opts.serializedBody) { - requestInit.body = opts.serializedBody; - } - let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { @@ -215,6 +215,25 @@ export const createClient = (config: Config = {}): Client => { }; }; + function getValidRequestBody(options: ResolvedRequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + return null; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-fetch/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-fetch/client/client.gen.ts index ff0238aec..ff7815f4d 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-fetch/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-fetch/client/client.gen.ts @@ -60,12 +60,15 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.body === undefined || opts.body === '') { + if ( + opts.body === undefined || + (opts.serializedBody !== undefined && opts.serializedBody === '') + ) { opts.headers.delete('Content-Type'); } @@ -80,12 +83,9 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, + body: getValidRequestBody(opts), }; - if (opts.serializedBody) { - requestInit.body = opts.serializedBody; - } - let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { @@ -215,6 +215,25 @@ export const createClient = (config: Config = {}): Client => { }; }; + function getValidRequestBody(options: ResolvedRequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + return null; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-next/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-next/client/client.gen.ts index 17450b9b5..06cae5956 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-next/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-next/client/client.gen.ts @@ -59,12 +59,15 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.body === undefined || opts.body === '') { + if ( + opts.body === undefined || + (opts.serializedBody !== undefined && opts.serializedBody === '') + ) { opts.headers.delete('Content-Type'); } @@ -89,12 +92,9 @@ export const createClient = (config: Config = {}): Client => { const _fetch = opts.fetch!; const requestInit: ReqInit = { ...opts, + body: getValidRequestBody(opts), }; - if (opts.serializedBody) { - requestInit.body = opts.serializedBody; - } - let response = await _fetch(url, requestInit); for (const fn of interceptors.response._fns) { @@ -203,6 +203,25 @@ export const createClient = (config: Config = {}): Client => { }; }; + function getValidRequestBody(options: ResolvedRequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + return null; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-all-of/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-all-of/client/client.gen.ts index ff0238aec..ff7815f4d 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-all-of/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-all-of/client/client.gen.ts @@ -60,12 +60,15 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.body === undefined || opts.body === '') { + if ( + opts.body === undefined || + (opts.serializedBody !== undefined && opts.serializedBody === '') + ) { opts.headers.delete('Content-Type'); } @@ -80,12 +83,9 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, + body: getValidRequestBody(opts), }; - if (opts.serializedBody) { - requestInit.body = opts.serializedBody; - } - let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { @@ -215,6 +215,25 @@ export const createClient = (config: Config = {}): Client => { }; }; + function getValidRequestBody(options: ResolvedRequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + return null; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-any-of-null/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-any-of-null/client/client.gen.ts index ff0238aec..ff7815f4d 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-any-of-null/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-any-of-null/client/client.gen.ts @@ -60,12 +60,15 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.body === undefined || opts.body === '') { + if ( + opts.body === undefined || + (opts.serializedBody !== undefined && opts.serializedBody === '') + ) { opts.headers.delete('Content-Type'); } @@ -80,12 +83,9 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, + body: getValidRequestBody(opts), }; - if (opts.serializedBody) { - requestInit.body = opts.serializedBody; - } - let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { @@ -215,6 +215,25 @@ export const createClient = (config: Config = {}): Client => { }; }; + function getValidRequestBody(options: ResolvedRequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + return null; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-array/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-array/client/client.gen.ts index ff0238aec..ff7815f4d 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-array/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-array/client/client.gen.ts @@ -60,12 +60,15 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.body === undefined || opts.body === '') { + if ( + opts.body === undefined || + (opts.serializedBody !== undefined && opts.serializedBody === '') + ) { opts.headers.delete('Content-Type'); } @@ -80,12 +83,9 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, + body: getValidRequestBody(opts), }; - if (opts.serializedBody) { - requestInit.body = opts.serializedBody; - } - let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { @@ -215,6 +215,25 @@ export const createClient = (config: Config = {}): Client => { }; }; + function getValidRequestBody(options: ResolvedRequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + return null; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transforms-read-write/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transforms-read-write/client/client.gen.ts index ff0238aec..ff7815f4d 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transforms-read-write/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transforms-read-write/client/client.gen.ts @@ -60,12 +60,15 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.body === undefined || opts.body === '') { + if ( + opts.body === undefined || + (opts.serializedBody !== undefined && opts.serializedBody === '') + ) { opts.headers.delete('Content-Type'); } @@ -80,12 +83,9 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, + body: getValidRequestBody(opts), }; - if (opts.serializedBody) { - requestInit.body = opts.serializedBody; - } - let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { @@ -215,6 +215,25 @@ export const createClient = (config: Config = {}): Client => { }; }; + function getValidRequestBody(options: ResolvedRequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + return null; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/plugins/@tanstack/meta/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/plugins/@tanstack/meta/client/client.gen.ts index ff0238aec..ff7815f4d 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/plugins/@tanstack/meta/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/plugins/@tanstack/meta/client/client.gen.ts @@ -60,12 +60,15 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.body === undefined || opts.body === '') { + if ( + opts.body === undefined || + (opts.serializedBody !== undefined && opts.serializedBody === '') + ) { opts.headers.delete('Content-Type'); } @@ -80,12 +83,9 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, + body: getValidRequestBody(opts), }; - if (opts.serializedBody) { - requestInit.body = opts.serializedBody; - } - let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { @@ -215,6 +215,25 @@ export const createClient = (config: Config = {}): Client => { }; }; + function getValidRequestBody(options: ResolvedRequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + return null; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/test/generated/v3_no_index/client/client.gen.ts.snap b/packages/openapi-ts-tests/main/test/__snapshots__/test/generated/v3_no_index/client/client.gen.ts.snap index ff0238aec..ff7815f4d 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/test/generated/v3_no_index/client/client.gen.ts.snap +++ b/packages/openapi-ts-tests/main/test/__snapshots__/test/generated/v3_no_index/client/client.gen.ts.snap @@ -60,12 +60,15 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.body === undefined || opts.body === '') { + if ( + opts.body === undefined || + (opts.serializedBody !== undefined && opts.serializedBody === '') + ) { opts.headers.delete('Content-Type'); } @@ -80,12 +83,9 @@ export const createClient = (config: Config = {}): Client => { const requestInit: ReqInit = { redirect: 'follow', ...opts, + body: getValidRequestBody(opts), }; - if (opts.serializedBody) { - requestInit.body = opts.serializedBody; - } - let request = new Request(url, requestInit); for (const fn of interceptors.request._fns) { @@ -215,6 +215,25 @@ export const createClient = (config: Config = {}): Client => { }; }; + function getValidRequestBody(options: ResolvedRequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + return null; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); -- 2.51.2 From 244304d65552c900a0ec743e2d69a55a8507b910 Mon Sep 17 00:00:00 2001 From: Fransis Young Date: Tue, 2 Sep 2025 20:48:57 -0400 Subject: [PATCH 14/46] chore(client-fetch,client-nuxt): removes redundant delete header condition --- .../src/plugins/@hey-api/client-fetch/bundle/client.ts | 5 +---- .../src/plugins/@hey-api/client-next/bundle/client.ts | 5 +---- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/packages/openapi-ts/src/plugins/@hey-api/client-fetch/bundle/client.ts b/packages/openapi-ts/src/plugins/@hey-api/client-fetch/bundle/client.ts index 7373139c9..3e59d949a 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/client-fetch/bundle/client.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/client-fetch/bundle/client.ts @@ -63,10 +63,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if ( - opts.body === undefined || - (opts.serializedBody !== undefined && opts.serializedBody === '') - ) { + if (opts.body === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); } diff --git a/packages/openapi-ts/src/plugins/@hey-api/client-next/bundle/client.ts b/packages/openapi-ts/src/plugins/@hey-api/client-next/bundle/client.ts index 18ec4bca8..3cf237b6e 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/client-next/bundle/client.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/client-next/bundle/client.ts @@ -62,10 +62,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if ( - opts.body === undefined || - (opts.serializedBody !== undefined && opts.serializedBody === '') - ) { + if (opts.body === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); } -- 2.51.2 From 65c87631e3b03411921d7602b0a96c748f7e9cbb Mon Sep 17 00:00:00 2001 From: Fransis Young Date: Tue, 2 Sep 2025 20:56:25 -0400 Subject: [PATCH 15/46] chore(client): updates snapshots --- .../2.0.x/body-response-text-plain/client/client.gen.ts | 5 +---- .../test/__snapshots__/2.0.x/form-data/client/client.gen.ts | 5 +---- .../sdk-nested-classes-instance/client/client.gen.ts | 5 +---- .../client-fetch/sdk-nested-classes/client/client.gen.ts | 5 +---- .../2.0.x/plugins/@hey-api/sdk/default/client/client.gen.ts | 5 +---- .../2.0.x/plugins/@hey-api/sdk/instance/client/client.gen.ts | 5 +---- .../plugins/@hey-api/sdk/throwOnError/client/client.gen.ts | 5 +---- .../transformers/type-format-valibot/client/client.gen.ts | 5 +---- .../transformers/type-format-zod/client/client.gen.ts | 5 +---- .../transforms-read-write-custom-name/client/client.gen.ts | 5 +---- .../transforms-read-write-ignore/client/client.gen.ts | 5 +---- .../2.0.x/plugins/@pinia/colada/fetch/client/client.gen.ts | 5 +---- .../plugins/@pinia/colada/group-by-tag/client/client.gen.ts | 5 +---- .../angular-query-experimental/asClass/client/client.gen.ts | 5 +---- .../angular-query-experimental/fetch/client/client.gen.ts | 5 +---- .../name-builder/client/client.gen.ts | 5 +---- .../@tanstack/react-query/asClass/client/client.gen.ts | 5 +---- .../plugins/@tanstack/react-query/fetch/client/client.gen.ts | 5 +---- .../@tanstack/react-query/name-builder/client/client.gen.ts | 5 +---- .../@tanstack/solid-query/asClass/client/client.gen.ts | 5 +---- .../plugins/@tanstack/solid-query/fetch/client/client.gen.ts | 5 +---- .../@tanstack/solid-query/name-builder/client/client.gen.ts | 5 +---- .../@tanstack/svelte-query/asClass/client/client.gen.ts | 5 +---- .../@tanstack/svelte-query/fetch/client/client.gen.ts | 5 +---- .../@tanstack/svelte-query/name-builder/client/client.gen.ts | 5 +---- .../plugins/@tanstack/vue-query/asClass/client/client.gen.ts | 5 +---- .../plugins/@tanstack/vue-query/fetch/client/client.gen.ts | 5 +---- .../@tanstack/vue-query/name-builder/client/client.gen.ts | 5 +---- .../__snapshots__/2.0.x/schema-unknown/client/client.gen.ts | 5 +---- .../2.0.x/security-api-key/client/client.gen.ts | 5 +---- .../__snapshots__/2.0.x/security-basic/client/client.gen.ts | 5 +---- .../__snapshots__/2.0.x/security-false/client/client.gen.ts | 5 +---- .../__snapshots__/2.0.x/security-oauth2/client/client.gen.ts | 5 +---- .../2.0.x/servers-base-path/client/client.gen.ts | 5 +---- .../__snapshots__/2.0.x/servers-host/client/client.gen.ts | 5 +---- .../test/__snapshots__/2.0.x/servers/client/client.gen.ts | 5 +---- .../2.0.x/transforms-read-write/client/client.gen.ts | 5 +---- .../3.0.x/body-response-text-plain/client/client.gen.ts | 5 +---- .../3.0.x/internal-name-conflict/client/client.gen.ts | 5 +---- .../3.0.x/parameter-explode-false/client/client.gen.ts | 5 +---- .../sdk-nested-classes-instance/client/client.gen.ts | 5 +---- .../client-fetch/sdk-nested-classes/client/client.gen.ts | 5 +---- .../3.0.x/plugins/@hey-api/sdk/default/client/client.gen.ts | 5 +---- .../3.0.x/plugins/@hey-api/sdk/instance/client/client.gen.ts | 5 +---- .../plugins/@hey-api/sdk/throwOnError/client/client.gen.ts | 5 +---- .../transformers/type-format-valibot/client/client.gen.ts | 5 +---- .../transformers/type-format-zod/client/client.gen.ts | 5 +---- .../transforms-read-write-custom-name/client/client.gen.ts | 5 +---- .../transforms-read-write-ignore/client/client.gen.ts | 5 +---- .../3.0.x/plugins/@pinia/colada/fetch/client/client.gen.ts | 5 +---- .../plugins/@pinia/colada/group-by-tag/client/client.gen.ts | 5 +---- .../angular-query-experimental/asClass/client/client.gen.ts | 5 +---- .../angular-query-experimental/fetch/client/client.gen.ts | 5 +---- .../name-builder/client/client.gen.ts | 5 +---- .../@tanstack/react-query/asClass/client/client.gen.ts | 5 +---- .../plugins/@tanstack/react-query/fetch/client/client.gen.ts | 5 +---- .../@tanstack/react-query/name-builder/client/client.gen.ts | 5 +---- .../@tanstack/solid-query/asClass/client/client.gen.ts | 5 +---- .../plugins/@tanstack/solid-query/fetch/client/client.gen.ts | 5 +---- .../@tanstack/solid-query/name-builder/client/client.gen.ts | 5 +---- .../@tanstack/svelte-query/asClass/client/client.gen.ts | 5 +---- .../@tanstack/svelte-query/fetch/client/client.gen.ts | 5 +---- .../@tanstack/svelte-query/name-builder/client/client.gen.ts | 5 +---- .../plugins/@tanstack/vue-query/asClass/client/client.gen.ts | 5 +---- .../plugins/@tanstack/vue-query/fetch/client/client.gen.ts | 5 +---- .../@tanstack/vue-query/name-builder/client/client.gen.ts | 5 +---- .../3.0.x/security-api-key/client/client.gen.ts | 5 +---- .../__snapshots__/3.0.x/security-false/client/client.gen.ts | 5 +---- .../3.0.x/security-http-bearer/client/client.gen.ts | 5 +---- .../__snapshots__/3.0.x/security-oauth2/client/client.gen.ts | 5 +---- .../3.0.x/security-open-id-connect/client/client.gen.ts | 5 +---- .../test/__snapshots__/3.0.x/servers/client/client.gen.ts | 5 +---- .../3.0.x/transformers-all-of/client/client.gen.ts | 5 +---- .../3.0.x/transformers-any-of-null/client/client.gen.ts | 5 +---- .../3.0.x/transformers-array/client/client.gen.ts | 5 +---- .../3.0.x/transforms-read-write/client/client.gen.ts | 5 +---- .../3.1.x/body-response-text-plain/client/client.gen.ts | 5 +---- .../client-fetch/base-url-false/client/client.gen.ts | 5 +---- .../client-fetch/base-url-number/client/client.gen.ts | 5 +---- .../client-fetch/base-url-strict/client/client.gen.ts | 5 +---- .../client-fetch/base-url-string/client/client.gen.ts | 5 +---- .../@hey-api/client-fetch/clean-false/client/client.gen.ts | 5 +---- .../@hey-api/client-fetch/default/client/client.gen.ts | 5 +---- .../client-fetch/sdk-client-optional/client/client.gen.ts | 5 +---- .../client-fetch/sdk-client-required/client/client.gen.ts | 5 +---- .../client-fetch/tsconfig-nodenext-sdk/client/client.gen.ts | 5 +---- .../@hey-api/client-next/base-url-false/client/client.gen.ts | 5 +---- .../client-next/base-url-number/client/client.gen.ts | 5 +---- .../client-next/base-url-strict/client/client.gen.ts | 5 +---- .../client-next/base-url-string/client/client.gen.ts | 5 +---- .../@hey-api/client-next/clean-false/client/client.gen.ts | 5 +---- .../@hey-api/client-next/default/client/client.gen.ts | 5 +---- .../client-next/sdk-client-optional/client/client.gen.ts | 5 +---- .../client-next/sdk-client-required/client/client.gen.ts | 5 +---- .../client-next/tsconfig-nodenext-sdk/client/client.gen.ts | 5 +---- .../test/__snapshots__/3.1.x/headers/client/client.gen.ts | 5 +---- .../3.1.x/internal-name-conflict/client/client.gen.ts | 5 +---- .../__snapshots__/3.1.x/pagination-ref/client/client.gen.ts | 5 +---- .../3.1.x/parameter-explode-false/client/client.gen.ts | 5 +---- .../sdk-nested-classes-instance/client/client.gen.ts | 5 +---- .../client-fetch/sdk-nested-classes/client/client.gen.ts | 5 +---- .../3.1.x/plugins/@hey-api/sdk/default/client/client.gen.ts | 5 +---- .../3.1.x/plugins/@hey-api/sdk/instance/client/client.gen.ts | 5 +---- .../plugins/@hey-api/sdk/throwOnError/client/client.gen.ts | 5 +---- .../transformers/type-format-valibot/client/client.gen.ts | 5 +---- .../transformers/type-format-zod/client/client.gen.ts | 5 +---- .../transforms-read-write-custom-name/client/client.gen.ts | 5 +---- .../transforms-read-write-ignore/client/client.gen.ts | 5 +---- .../3.1.x/plugins/@pinia/colada/fetch/client/client.gen.ts | 5 +---- .../plugins/@pinia/colada/group-by-tag/client/client.gen.ts | 5 +---- .../angular-query-experimental/asClass/client/client.gen.ts | 5 +---- .../angular-query-experimental/fetch/client/client.gen.ts | 5 +---- .../name-builder/client/client.gen.ts | 5 +---- .../@tanstack/react-query/asClass/client/client.gen.ts | 5 +---- .../plugins/@tanstack/react-query/fetch/client/client.gen.ts | 5 +---- .../@tanstack/react-query/name-builder/client/client.gen.ts | 5 +---- .../@tanstack/solid-query/asClass/client/client.gen.ts | 5 +---- .../plugins/@tanstack/solid-query/fetch/client/client.gen.ts | 5 +---- .../@tanstack/solid-query/name-builder/client/client.gen.ts | 5 +---- .../@tanstack/svelte-query/asClass/client/client.gen.ts | 5 +---- .../@tanstack/svelte-query/fetch/client/client.gen.ts | 5 +---- .../@tanstack/svelte-query/name-builder/client/client.gen.ts | 5 +---- .../plugins/@tanstack/vue-query/asClass/client/client.gen.ts | 5 +---- .../plugins/@tanstack/vue-query/fetch/client/client.gen.ts | 5 +---- .../@tanstack/vue-query/name-builder/client/client.gen.ts | 5 +---- .../3.1.x/security-api-key/client/client.gen.ts | 5 +---- .../__snapshots__/3.1.x/security-false/client/client.gen.ts | 5 +---- .../3.1.x/security-http-bearer/client/client.gen.ts | 5 +---- .../__snapshots__/3.1.x/security-oauth2/client/client.gen.ts | 5 +---- .../3.1.x/security-open-id-connect/client/client.gen.ts | 5 +---- .../test/__snapshots__/3.1.x/servers/client/client.gen.ts | 5 +---- .../test/__snapshots__/3.1.x/sse-fetch/client/client.gen.ts | 5 +---- .../test/__snapshots__/3.1.x/sse-next/client/client.gen.ts | 5 +---- .../3.1.x/transformers-all-of/client/client.gen.ts | 5 +---- .../3.1.x/transformers-any-of-null/client/client.gen.ts | 5 +---- .../3.1.x/transformers-array/client/client.gen.ts | 5 +---- .../3.1.x/transforms-read-write/client/client.gen.ts | 5 +---- .../plugins/@tanstack/meta/client/client.gen.ts | 5 +---- .../test/generated/v3_no_index/client/client.gen.ts.snap | 5 +---- 139 files changed, 139 insertions(+), 556 deletions(-) diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/body-response-text-plain/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/body-response-text-plain/client/client.gen.ts index ff7815f4d..d98de0bc6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/body-response-text-plain/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/body-response-text-plain/client/client.gen.ts @@ -65,10 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if ( - opts.body === undefined || - (opts.serializedBody !== undefined && opts.serializedBody === '') - ) { + if (opts.body === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/form-data/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/form-data/client/client.gen.ts index ff7815f4d..d98de0bc6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/form-data/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/form-data/client/client.gen.ts @@ -65,10 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if ( - opts.body === undefined || - (opts.serializedBody !== undefined && opts.serializedBody === '') - ) { + if (opts.body === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/client-fetch/sdk-nested-classes-instance/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/client-fetch/sdk-nested-classes-instance/client/client.gen.ts index ff7815f4d..d98de0bc6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/client-fetch/sdk-nested-classes-instance/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/client-fetch/sdk-nested-classes-instance/client/client.gen.ts @@ -65,10 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if ( - opts.body === undefined || - (opts.serializedBody !== undefined && opts.serializedBody === '') - ) { + if (opts.body === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/client-fetch/sdk-nested-classes/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/client-fetch/sdk-nested-classes/client/client.gen.ts index ff7815f4d..d98de0bc6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/client-fetch/sdk-nested-classes/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/client-fetch/sdk-nested-classes/client/client.gen.ts @@ -65,10 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if ( - opts.body === undefined || - (opts.serializedBody !== undefined && opts.serializedBody === '') - ) { + if (opts.body === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/sdk/default/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/sdk/default/client/client.gen.ts index ff7815f4d..d98de0bc6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/sdk/default/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/sdk/default/client/client.gen.ts @@ -65,10 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if ( - opts.body === undefined || - (opts.serializedBody !== undefined && opts.serializedBody === '') - ) { + if (opts.body === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/sdk/instance/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/sdk/instance/client/client.gen.ts index ff7815f4d..d98de0bc6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/sdk/instance/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/sdk/instance/client/client.gen.ts @@ -65,10 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if ( - opts.body === undefined || - (opts.serializedBody !== undefined && opts.serializedBody === '') - ) { + if (opts.body === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/sdk/throwOnError/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/sdk/throwOnError/client/client.gen.ts index ff7815f4d..d98de0bc6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/sdk/throwOnError/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/sdk/throwOnError/client/client.gen.ts @@ -65,10 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if ( - opts.body === undefined || - (opts.serializedBody !== undefined && opts.serializedBody === '') - ) { + if (opts.body === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/transformers/type-format-valibot/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/transformers/type-format-valibot/client/client.gen.ts index ff7815f4d..d98de0bc6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/transformers/type-format-valibot/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/transformers/type-format-valibot/client/client.gen.ts @@ -65,10 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if ( - opts.body === undefined || - (opts.serializedBody !== undefined && opts.serializedBody === '') - ) { + if (opts.body === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/transformers/type-format-zod/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/transformers/type-format-zod/client/client.gen.ts index ff7815f4d..d98de0bc6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/transformers/type-format-zod/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/transformers/type-format-zod/client/client.gen.ts @@ -65,10 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if ( - opts.body === undefined || - (opts.serializedBody !== undefined && opts.serializedBody === '') - ) { + if (opts.body === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/typescript/transforms-read-write-custom-name/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/typescript/transforms-read-write-custom-name/client/client.gen.ts index ff7815f4d..d98de0bc6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/typescript/transforms-read-write-custom-name/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/typescript/transforms-read-write-custom-name/client/client.gen.ts @@ -65,10 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if ( - opts.body === undefined || - (opts.serializedBody !== undefined && opts.serializedBody === '') - ) { + if (opts.body === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/typescript/transforms-read-write-ignore/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/typescript/transforms-read-write-ignore/client/client.gen.ts index ff7815f4d..d98de0bc6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/typescript/transforms-read-write-ignore/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/typescript/transforms-read-write-ignore/client/client.gen.ts @@ -65,10 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if ( - opts.body === undefined || - (opts.serializedBody !== undefined && opts.serializedBody === '') - ) { + if (opts.body === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@pinia/colada/fetch/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@pinia/colada/fetch/client/client.gen.ts index ff7815f4d..d98de0bc6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@pinia/colada/fetch/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@pinia/colada/fetch/client/client.gen.ts @@ -65,10 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if ( - opts.body === undefined || - (opts.serializedBody !== undefined && opts.serializedBody === '') - ) { + if (opts.body === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@pinia/colada/group-by-tag/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@pinia/colada/group-by-tag/client/client.gen.ts index ff7815f4d..d98de0bc6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@pinia/colada/group-by-tag/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@pinia/colada/group-by-tag/client/client.gen.ts @@ -65,10 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if ( - opts.body === undefined || - (opts.serializedBody !== undefined && opts.serializedBody === '') - ) { + if (opts.body === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/asClass/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/asClass/client/client.gen.ts index ff7815f4d..d98de0bc6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/asClass/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/asClass/client/client.gen.ts @@ -65,10 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if ( - opts.body === undefined || - (opts.serializedBody !== undefined && opts.serializedBody === '') - ) { + if (opts.body === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/fetch/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/fetch/client/client.gen.ts index ff7815f4d..d98de0bc6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/fetch/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/fetch/client/client.gen.ts @@ -65,10 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if ( - opts.body === undefined || - (opts.serializedBody !== undefined && opts.serializedBody === '') - ) { + if (opts.body === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/name-builder/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/name-builder/client/client.gen.ts index ff7815f4d..d98de0bc6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/name-builder/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/name-builder/client/client.gen.ts @@ -65,10 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if ( - opts.body === undefined || - (opts.serializedBody !== undefined && opts.serializedBody === '') - ) { + if (opts.body === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/react-query/asClass/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/react-query/asClass/client/client.gen.ts index ff7815f4d..d98de0bc6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/react-query/asClass/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/react-query/asClass/client/client.gen.ts @@ -65,10 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if ( - opts.body === undefined || - (opts.serializedBody !== undefined && opts.serializedBody === '') - ) { + if (opts.body === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/react-query/fetch/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/react-query/fetch/client/client.gen.ts index ff7815f4d..d98de0bc6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/react-query/fetch/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/react-query/fetch/client/client.gen.ts @@ -65,10 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if ( - opts.body === undefined || - (opts.serializedBody !== undefined && opts.serializedBody === '') - ) { + if (opts.body === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/react-query/name-builder/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/react-query/name-builder/client/client.gen.ts index ff7815f4d..d98de0bc6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/react-query/name-builder/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/react-query/name-builder/client/client.gen.ts @@ -65,10 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if ( - opts.body === undefined || - (opts.serializedBody !== undefined && opts.serializedBody === '') - ) { + if (opts.body === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/solid-query/asClass/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/solid-query/asClass/client/client.gen.ts index ff7815f4d..d98de0bc6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/solid-query/asClass/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/solid-query/asClass/client/client.gen.ts @@ -65,10 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if ( - opts.body === undefined || - (opts.serializedBody !== undefined && opts.serializedBody === '') - ) { + if (opts.body === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/solid-query/fetch/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/solid-query/fetch/client/client.gen.ts index ff7815f4d..d98de0bc6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/solid-query/fetch/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/solid-query/fetch/client/client.gen.ts @@ -65,10 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if ( - opts.body === undefined || - (opts.serializedBody !== undefined && opts.serializedBody === '') - ) { + if (opts.body === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/solid-query/name-builder/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/solid-query/name-builder/client/client.gen.ts index ff7815f4d..d98de0bc6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/solid-query/name-builder/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/solid-query/name-builder/client/client.gen.ts @@ -65,10 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if ( - opts.body === undefined || - (opts.serializedBody !== undefined && opts.serializedBody === '') - ) { + if (opts.body === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/svelte-query/asClass/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/svelte-query/asClass/client/client.gen.ts index ff7815f4d..d98de0bc6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/svelte-query/asClass/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/svelte-query/asClass/client/client.gen.ts @@ -65,10 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if ( - opts.body === undefined || - (opts.serializedBody !== undefined && opts.serializedBody === '') - ) { + if (opts.body === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/svelte-query/fetch/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/svelte-query/fetch/client/client.gen.ts index ff7815f4d..d98de0bc6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/svelte-query/fetch/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/svelte-query/fetch/client/client.gen.ts @@ -65,10 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if ( - opts.body === undefined || - (opts.serializedBody !== undefined && opts.serializedBody === '') - ) { + if (opts.body === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/svelte-query/name-builder/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/svelte-query/name-builder/client/client.gen.ts index ff7815f4d..d98de0bc6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/svelte-query/name-builder/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/svelte-query/name-builder/client/client.gen.ts @@ -65,10 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if ( - opts.body === undefined || - (opts.serializedBody !== undefined && opts.serializedBody === '') - ) { + if (opts.body === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/vue-query/asClass/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/vue-query/asClass/client/client.gen.ts index ff7815f4d..d98de0bc6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/vue-query/asClass/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/vue-query/asClass/client/client.gen.ts @@ -65,10 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if ( - opts.body === undefined || - (opts.serializedBody !== undefined && opts.serializedBody === '') - ) { + if (opts.body === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/vue-query/fetch/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/vue-query/fetch/client/client.gen.ts index ff7815f4d..d98de0bc6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/vue-query/fetch/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/vue-query/fetch/client/client.gen.ts @@ -65,10 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if ( - opts.body === undefined || - (opts.serializedBody !== undefined && opts.serializedBody === '') - ) { + if (opts.body === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/vue-query/name-builder/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/vue-query/name-builder/client/client.gen.ts index ff7815f4d..d98de0bc6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/vue-query/name-builder/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/vue-query/name-builder/client/client.gen.ts @@ -65,10 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if ( - opts.body === undefined || - (opts.serializedBody !== undefined && opts.serializedBody === '') - ) { + if (opts.body === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/schema-unknown/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/schema-unknown/client/client.gen.ts index ff7815f4d..d98de0bc6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/schema-unknown/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/schema-unknown/client/client.gen.ts @@ -65,10 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if ( - opts.body === undefined || - (opts.serializedBody !== undefined && opts.serializedBody === '') - ) { + if (opts.body === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-api-key/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-api-key/client/client.gen.ts index ff7815f4d..d98de0bc6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-api-key/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-api-key/client/client.gen.ts @@ -65,10 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if ( - opts.body === undefined || - (opts.serializedBody !== undefined && opts.serializedBody === '') - ) { + if (opts.body === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-basic/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-basic/client/client.gen.ts index ff7815f4d..d98de0bc6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-basic/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-basic/client/client.gen.ts @@ -65,10 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if ( - opts.body === undefined || - (opts.serializedBody !== undefined && opts.serializedBody === '') - ) { + if (opts.body === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-false/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-false/client/client.gen.ts index ff7815f4d..d98de0bc6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-false/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-false/client/client.gen.ts @@ -65,10 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if ( - opts.body === undefined || - (opts.serializedBody !== undefined && opts.serializedBody === '') - ) { + if (opts.body === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-oauth2/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-oauth2/client/client.gen.ts index ff7815f4d..d98de0bc6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-oauth2/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-oauth2/client/client.gen.ts @@ -65,10 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if ( - opts.body === undefined || - (opts.serializedBody !== undefined && opts.serializedBody === '') - ) { + if (opts.body === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/servers-base-path/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/servers-base-path/client/client.gen.ts index ff7815f4d..d98de0bc6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/servers-base-path/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/servers-base-path/client/client.gen.ts @@ -65,10 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if ( - opts.body === undefined || - (opts.serializedBody !== undefined && opts.serializedBody === '') - ) { + if (opts.body === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/servers-host/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/servers-host/client/client.gen.ts index ff7815f4d..d98de0bc6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/servers-host/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/servers-host/client/client.gen.ts @@ -65,10 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if ( - opts.body === undefined || - (opts.serializedBody !== undefined && opts.serializedBody === '') - ) { + if (opts.body === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/servers/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/servers/client/client.gen.ts index ff7815f4d..d98de0bc6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/servers/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/servers/client/client.gen.ts @@ -65,10 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if ( - opts.body === undefined || - (opts.serializedBody !== undefined && opts.serializedBody === '') - ) { + if (opts.body === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/transforms-read-write/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/transforms-read-write/client/client.gen.ts index ff7815f4d..d98de0bc6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/transforms-read-write/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/transforms-read-write/client/client.gen.ts @@ -65,10 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if ( - opts.body === undefined || - (opts.serializedBody !== undefined && opts.serializedBody === '') - ) { + if (opts.body === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/body-response-text-plain/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/body-response-text-plain/client/client.gen.ts index ff7815f4d..d98de0bc6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/body-response-text-plain/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/body-response-text-plain/client/client.gen.ts @@ -65,10 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if ( - opts.body === undefined || - (opts.serializedBody !== undefined && opts.serializedBody === '') - ) { + if (opts.body === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/internal-name-conflict/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/internal-name-conflict/client/client.gen.ts index ff7815f4d..d98de0bc6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/internal-name-conflict/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/internal-name-conflict/client/client.gen.ts @@ -65,10 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if ( - opts.body === undefined || - (opts.serializedBody !== undefined && opts.serializedBody === '') - ) { + if (opts.body === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/parameter-explode-false/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/parameter-explode-false/client/client.gen.ts index ff7815f4d..d98de0bc6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/parameter-explode-false/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/parameter-explode-false/client/client.gen.ts @@ -65,10 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if ( - opts.body === undefined || - (opts.serializedBody !== undefined && opts.serializedBody === '') - ) { + if (opts.body === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/client-fetch/sdk-nested-classes-instance/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/client-fetch/sdk-nested-classes-instance/client/client.gen.ts index ff7815f4d..d98de0bc6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/client-fetch/sdk-nested-classes-instance/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/client-fetch/sdk-nested-classes-instance/client/client.gen.ts @@ -65,10 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if ( - opts.body === undefined || - (opts.serializedBody !== undefined && opts.serializedBody === '') - ) { + if (opts.body === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/client-fetch/sdk-nested-classes/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/client-fetch/sdk-nested-classes/client/client.gen.ts index ff7815f4d..d98de0bc6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/client-fetch/sdk-nested-classes/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/client-fetch/sdk-nested-classes/client/client.gen.ts @@ -65,10 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if ( - opts.body === undefined || - (opts.serializedBody !== undefined && opts.serializedBody === '') - ) { + if (opts.body === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/sdk/default/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/sdk/default/client/client.gen.ts index ff7815f4d..d98de0bc6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/sdk/default/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/sdk/default/client/client.gen.ts @@ -65,10 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if ( - opts.body === undefined || - (opts.serializedBody !== undefined && opts.serializedBody === '') - ) { + if (opts.body === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/sdk/instance/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/sdk/instance/client/client.gen.ts index ff7815f4d..d98de0bc6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/sdk/instance/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/sdk/instance/client/client.gen.ts @@ -65,10 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if ( - opts.body === undefined || - (opts.serializedBody !== undefined && opts.serializedBody === '') - ) { + if (opts.body === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/sdk/throwOnError/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/sdk/throwOnError/client/client.gen.ts index ff7815f4d..d98de0bc6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/sdk/throwOnError/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/sdk/throwOnError/client/client.gen.ts @@ -65,10 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if ( - opts.body === undefined || - (opts.serializedBody !== undefined && opts.serializedBody === '') - ) { + if (opts.body === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/transformers/type-format-valibot/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/transformers/type-format-valibot/client/client.gen.ts index ff7815f4d..d98de0bc6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/transformers/type-format-valibot/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/transformers/type-format-valibot/client/client.gen.ts @@ -65,10 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if ( - opts.body === undefined || - (opts.serializedBody !== undefined && opts.serializedBody === '') - ) { + if (opts.body === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/transformers/type-format-zod/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/transformers/type-format-zod/client/client.gen.ts index ff7815f4d..d98de0bc6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/transformers/type-format-zod/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/transformers/type-format-zod/client/client.gen.ts @@ -65,10 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if ( - opts.body === undefined || - (opts.serializedBody !== undefined && opts.serializedBody === '') - ) { + if (opts.body === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/typescript/transforms-read-write-custom-name/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/typescript/transforms-read-write-custom-name/client/client.gen.ts index ff7815f4d..d98de0bc6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/typescript/transforms-read-write-custom-name/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/typescript/transforms-read-write-custom-name/client/client.gen.ts @@ -65,10 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if ( - opts.body === undefined || - (opts.serializedBody !== undefined && opts.serializedBody === '') - ) { + if (opts.body === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/typescript/transforms-read-write-ignore/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/typescript/transforms-read-write-ignore/client/client.gen.ts index ff7815f4d..d98de0bc6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/typescript/transforms-read-write-ignore/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/typescript/transforms-read-write-ignore/client/client.gen.ts @@ -65,10 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if ( - opts.body === undefined || - (opts.serializedBody !== undefined && opts.serializedBody === '') - ) { + if (opts.body === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@pinia/colada/fetch/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@pinia/colada/fetch/client/client.gen.ts index ff7815f4d..d98de0bc6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@pinia/colada/fetch/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@pinia/colada/fetch/client/client.gen.ts @@ -65,10 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if ( - opts.body === undefined || - (opts.serializedBody !== undefined && opts.serializedBody === '') - ) { + if (opts.body === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@pinia/colada/group-by-tag/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@pinia/colada/group-by-tag/client/client.gen.ts index ff7815f4d..d98de0bc6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@pinia/colada/group-by-tag/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@pinia/colada/group-by-tag/client/client.gen.ts @@ -65,10 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if ( - opts.body === undefined || - (opts.serializedBody !== undefined && opts.serializedBody === '') - ) { + if (opts.body === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/angular-query-experimental/asClass/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/angular-query-experimental/asClass/client/client.gen.ts index ff7815f4d..d98de0bc6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/angular-query-experimental/asClass/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/angular-query-experimental/asClass/client/client.gen.ts @@ -65,10 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if ( - opts.body === undefined || - (opts.serializedBody !== undefined && opts.serializedBody === '') - ) { + if (opts.body === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/angular-query-experimental/fetch/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/angular-query-experimental/fetch/client/client.gen.ts index ff7815f4d..d98de0bc6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/angular-query-experimental/fetch/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/angular-query-experimental/fetch/client/client.gen.ts @@ -65,10 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if ( - opts.body === undefined || - (opts.serializedBody !== undefined && opts.serializedBody === '') - ) { + if (opts.body === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/angular-query-experimental/name-builder/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/angular-query-experimental/name-builder/client/client.gen.ts index ff7815f4d..d98de0bc6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/angular-query-experimental/name-builder/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/angular-query-experimental/name-builder/client/client.gen.ts @@ -65,10 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if ( - opts.body === undefined || - (opts.serializedBody !== undefined && opts.serializedBody === '') - ) { + if (opts.body === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/react-query/asClass/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/react-query/asClass/client/client.gen.ts index ff7815f4d..d98de0bc6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/react-query/asClass/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/react-query/asClass/client/client.gen.ts @@ -65,10 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if ( - opts.body === undefined || - (opts.serializedBody !== undefined && opts.serializedBody === '') - ) { + if (opts.body === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/react-query/fetch/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/react-query/fetch/client/client.gen.ts index ff7815f4d..d98de0bc6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/react-query/fetch/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/react-query/fetch/client/client.gen.ts @@ -65,10 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if ( - opts.body === undefined || - (opts.serializedBody !== undefined && opts.serializedBody === '') - ) { + if (opts.body === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/react-query/name-builder/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/react-query/name-builder/client/client.gen.ts index ff7815f4d..d98de0bc6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/react-query/name-builder/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/react-query/name-builder/client/client.gen.ts @@ -65,10 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if ( - opts.body === undefined || - (opts.serializedBody !== undefined && opts.serializedBody === '') - ) { + if (opts.body === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/solid-query/asClass/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/solid-query/asClass/client/client.gen.ts index ff7815f4d..d98de0bc6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/solid-query/asClass/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/solid-query/asClass/client/client.gen.ts @@ -65,10 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if ( - opts.body === undefined || - (opts.serializedBody !== undefined && opts.serializedBody === '') - ) { + if (opts.body === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/solid-query/fetch/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/solid-query/fetch/client/client.gen.ts index ff7815f4d..d98de0bc6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/solid-query/fetch/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/solid-query/fetch/client/client.gen.ts @@ -65,10 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if ( - opts.body === undefined || - (opts.serializedBody !== undefined && opts.serializedBody === '') - ) { + if (opts.body === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/solid-query/name-builder/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/solid-query/name-builder/client/client.gen.ts index ff7815f4d..d98de0bc6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/solid-query/name-builder/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/solid-query/name-builder/client/client.gen.ts @@ -65,10 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if ( - opts.body === undefined || - (opts.serializedBody !== undefined && opts.serializedBody === '') - ) { + if (opts.body === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/svelte-query/asClass/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/svelte-query/asClass/client/client.gen.ts index ff7815f4d..d98de0bc6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/svelte-query/asClass/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/svelte-query/asClass/client/client.gen.ts @@ -65,10 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if ( - opts.body === undefined || - (opts.serializedBody !== undefined && opts.serializedBody === '') - ) { + if (opts.body === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/svelte-query/fetch/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/svelte-query/fetch/client/client.gen.ts index ff7815f4d..d98de0bc6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/svelte-query/fetch/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/svelte-query/fetch/client/client.gen.ts @@ -65,10 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if ( - opts.body === undefined || - (opts.serializedBody !== undefined && opts.serializedBody === '') - ) { + if (opts.body === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/svelte-query/name-builder/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/svelte-query/name-builder/client/client.gen.ts index ff7815f4d..d98de0bc6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/svelte-query/name-builder/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/svelte-query/name-builder/client/client.gen.ts @@ -65,10 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if ( - opts.body === undefined || - (opts.serializedBody !== undefined && opts.serializedBody === '') - ) { + if (opts.body === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/vue-query/asClass/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/vue-query/asClass/client/client.gen.ts index ff7815f4d..d98de0bc6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/vue-query/asClass/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/vue-query/asClass/client/client.gen.ts @@ -65,10 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if ( - opts.body === undefined || - (opts.serializedBody !== undefined && opts.serializedBody === '') - ) { + if (opts.body === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/vue-query/fetch/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/vue-query/fetch/client/client.gen.ts index ff7815f4d..d98de0bc6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/vue-query/fetch/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/vue-query/fetch/client/client.gen.ts @@ -65,10 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if ( - opts.body === undefined || - (opts.serializedBody !== undefined && opts.serializedBody === '') - ) { + if (opts.body === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/vue-query/name-builder/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/vue-query/name-builder/client/client.gen.ts index ff7815f4d..d98de0bc6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/vue-query/name-builder/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/vue-query/name-builder/client/client.gen.ts @@ -65,10 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if ( - opts.body === undefined || - (opts.serializedBody !== undefined && opts.serializedBody === '') - ) { + if (opts.body === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-api-key/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-api-key/client/client.gen.ts index ff7815f4d..d98de0bc6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-api-key/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-api-key/client/client.gen.ts @@ -65,10 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if ( - opts.body === undefined || - (opts.serializedBody !== undefined && opts.serializedBody === '') - ) { + if (opts.body === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-false/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-false/client/client.gen.ts index ff7815f4d..d98de0bc6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-false/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-false/client/client.gen.ts @@ -65,10 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if ( - opts.body === undefined || - (opts.serializedBody !== undefined && opts.serializedBody === '') - ) { + if (opts.body === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-http-bearer/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-http-bearer/client/client.gen.ts index ff7815f4d..d98de0bc6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-http-bearer/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-http-bearer/client/client.gen.ts @@ -65,10 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if ( - opts.body === undefined || - (opts.serializedBody !== undefined && opts.serializedBody === '') - ) { + if (opts.body === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-oauth2/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-oauth2/client/client.gen.ts index ff7815f4d..d98de0bc6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-oauth2/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-oauth2/client/client.gen.ts @@ -65,10 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if ( - opts.body === undefined || - (opts.serializedBody !== undefined && opts.serializedBody === '') - ) { + if (opts.body === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-open-id-connect/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-open-id-connect/client/client.gen.ts index ff7815f4d..d98de0bc6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-open-id-connect/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-open-id-connect/client/client.gen.ts @@ -65,10 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if ( - opts.body === undefined || - (opts.serializedBody !== undefined && opts.serializedBody === '') - ) { + if (opts.body === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/servers/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/servers/client/client.gen.ts index ff7815f4d..d98de0bc6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/servers/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/servers/client/client.gen.ts @@ -65,10 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if ( - opts.body === undefined || - (opts.serializedBody !== undefined && opts.serializedBody === '') - ) { + if (opts.body === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transformers-all-of/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transformers-all-of/client/client.gen.ts index ff7815f4d..d98de0bc6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transformers-all-of/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transformers-all-of/client/client.gen.ts @@ -65,10 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if ( - opts.body === undefined || - (opts.serializedBody !== undefined && opts.serializedBody === '') - ) { + if (opts.body === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transformers-any-of-null/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transformers-any-of-null/client/client.gen.ts index ff7815f4d..d98de0bc6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transformers-any-of-null/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transformers-any-of-null/client/client.gen.ts @@ -65,10 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if ( - opts.body === undefined || - (opts.serializedBody !== undefined && opts.serializedBody === '') - ) { + if (opts.body === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transformers-array/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transformers-array/client/client.gen.ts index ff7815f4d..d98de0bc6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transformers-array/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transformers-array/client/client.gen.ts @@ -65,10 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if ( - opts.body === undefined || - (opts.serializedBody !== undefined && opts.serializedBody === '') - ) { + if (opts.body === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transforms-read-write/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transforms-read-write/client/client.gen.ts index ff7815f4d..d98de0bc6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transforms-read-write/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transforms-read-write/client/client.gen.ts @@ -65,10 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if ( - opts.body === undefined || - (opts.serializedBody !== undefined && opts.serializedBody === '') - ) { + if (opts.body === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/body-response-text-plain/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/body-response-text-plain/client/client.gen.ts index ff7815f4d..d98de0bc6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/body-response-text-plain/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/body-response-text-plain/client/client.gen.ts @@ -65,10 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if ( - opts.body === undefined || - (opts.serializedBody !== undefined && opts.serializedBody === '') - ) { + if (opts.body === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-false/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-false/client/client.gen.ts index ff7815f4d..d98de0bc6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-false/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-false/client/client.gen.ts @@ -65,10 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if ( - opts.body === undefined || - (opts.serializedBody !== undefined && opts.serializedBody === '') - ) { + if (opts.body === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-number/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-number/client/client.gen.ts index ff7815f4d..d98de0bc6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-number/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-number/client/client.gen.ts @@ -65,10 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if ( - opts.body === undefined || - (opts.serializedBody !== undefined && opts.serializedBody === '') - ) { + if (opts.body === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-strict/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-strict/client/client.gen.ts index ff7815f4d..d98de0bc6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-strict/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-strict/client/client.gen.ts @@ -65,10 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if ( - opts.body === undefined || - (opts.serializedBody !== undefined && opts.serializedBody === '') - ) { + if (opts.body === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-string/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-string/client/client.gen.ts index ff7815f4d..d98de0bc6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-string/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-string/client/client.gen.ts @@ -65,10 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if ( - opts.body === undefined || - (opts.serializedBody !== undefined && opts.serializedBody === '') - ) { + if (opts.body === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/clean-false/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/clean-false/client/client.gen.ts index ff7815f4d..d98de0bc6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/clean-false/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/clean-false/client/client.gen.ts @@ -65,10 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if ( - opts.body === undefined || - (opts.serializedBody !== undefined && opts.serializedBody === '') - ) { + if (opts.body === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/default/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/default/client/client.gen.ts index ff7815f4d..d98de0bc6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/default/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/default/client/client.gen.ts @@ -65,10 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if ( - opts.body === undefined || - (opts.serializedBody !== undefined && opts.serializedBody === '') - ) { + if (opts.body === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/sdk-client-optional/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/sdk-client-optional/client/client.gen.ts index ff7815f4d..d98de0bc6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/sdk-client-optional/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/sdk-client-optional/client/client.gen.ts @@ -65,10 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if ( - opts.body === undefined || - (opts.serializedBody !== undefined && opts.serializedBody === '') - ) { + if (opts.body === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/sdk-client-required/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/sdk-client-required/client/client.gen.ts index ff7815f4d..d98de0bc6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/sdk-client-required/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/sdk-client-required/client/client.gen.ts @@ -65,10 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if ( - opts.body === undefined || - (opts.serializedBody !== undefined && opts.serializedBody === '') - ) { + if (opts.body === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/tsconfig-nodenext-sdk/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/tsconfig-nodenext-sdk/client/client.gen.ts index ca4eebad6..95010de9a 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/tsconfig-nodenext-sdk/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/tsconfig-nodenext-sdk/client/client.gen.ts @@ -65,10 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if ( - opts.body === undefined || - (opts.serializedBody !== undefined && opts.serializedBody === '') - ) { + if (opts.body === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-false/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-false/client/client.gen.ts index 06cae5956..8aafb006a 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-false/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-false/client/client.gen.ts @@ -64,10 +64,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if ( - opts.body === undefined || - (opts.serializedBody !== undefined && opts.serializedBody === '') - ) { + if (opts.body === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-number/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-number/client/client.gen.ts index 06cae5956..8aafb006a 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-number/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-number/client/client.gen.ts @@ -64,10 +64,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if ( - opts.body === undefined || - (opts.serializedBody !== undefined && opts.serializedBody === '') - ) { + if (opts.body === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-strict/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-strict/client/client.gen.ts index 06cae5956..8aafb006a 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-strict/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-strict/client/client.gen.ts @@ -64,10 +64,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if ( - opts.body === undefined || - (opts.serializedBody !== undefined && opts.serializedBody === '') - ) { + if (opts.body === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-string/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-string/client/client.gen.ts index 06cae5956..8aafb006a 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-string/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-string/client/client.gen.ts @@ -64,10 +64,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if ( - opts.body === undefined || - (opts.serializedBody !== undefined && opts.serializedBody === '') - ) { + if (opts.body === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/clean-false/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/clean-false/client/client.gen.ts index 06cae5956..8aafb006a 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/clean-false/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/clean-false/client/client.gen.ts @@ -64,10 +64,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if ( - opts.body === undefined || - (opts.serializedBody !== undefined && opts.serializedBody === '') - ) { + if (opts.body === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/default/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/default/client/client.gen.ts index 06cae5956..8aafb006a 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/default/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/default/client/client.gen.ts @@ -64,10 +64,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if ( - opts.body === undefined || - (opts.serializedBody !== undefined && opts.serializedBody === '') - ) { + if (opts.body === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/sdk-client-optional/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/sdk-client-optional/client/client.gen.ts index 06cae5956..8aafb006a 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/sdk-client-optional/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/sdk-client-optional/client/client.gen.ts @@ -64,10 +64,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if ( - opts.body === undefined || - (opts.serializedBody !== undefined && opts.serializedBody === '') - ) { + if (opts.body === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/sdk-client-required/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/sdk-client-required/client/client.gen.ts index 06cae5956..8aafb006a 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/sdk-client-required/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/sdk-client-required/client/client.gen.ts @@ -64,10 +64,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if ( - opts.body === undefined || - (opts.serializedBody !== undefined && opts.serializedBody === '') - ) { + if (opts.body === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/tsconfig-nodenext-sdk/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/tsconfig-nodenext-sdk/client/client.gen.ts index 6579f7ab6..d4e51ed2a 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/tsconfig-nodenext-sdk/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/tsconfig-nodenext-sdk/client/client.gen.ts @@ -64,10 +64,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if ( - opts.body === undefined || - (opts.serializedBody !== undefined && opts.serializedBody === '') - ) { + if (opts.body === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/headers/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/headers/client/client.gen.ts index ff7815f4d..d98de0bc6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/headers/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/headers/client/client.gen.ts @@ -65,10 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if ( - opts.body === undefined || - (opts.serializedBody !== undefined && opts.serializedBody === '') - ) { + if (opts.body === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/internal-name-conflict/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/internal-name-conflict/client/client.gen.ts index ff7815f4d..d98de0bc6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/internal-name-conflict/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/internal-name-conflict/client/client.gen.ts @@ -65,10 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if ( - opts.body === undefined || - (opts.serializedBody !== undefined && opts.serializedBody === '') - ) { + if (opts.body === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/pagination-ref/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/pagination-ref/client/client.gen.ts index ff7815f4d..d98de0bc6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/pagination-ref/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/pagination-ref/client/client.gen.ts @@ -65,10 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if ( - opts.body === undefined || - (opts.serializedBody !== undefined && opts.serializedBody === '') - ) { + if (opts.body === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/parameter-explode-false/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/parameter-explode-false/client/client.gen.ts index ff7815f4d..d98de0bc6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/parameter-explode-false/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/parameter-explode-false/client/client.gen.ts @@ -65,10 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if ( - opts.body === undefined || - (opts.serializedBody !== undefined && opts.serializedBody === '') - ) { + if (opts.body === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/client-fetch/sdk-nested-classes-instance/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/client-fetch/sdk-nested-classes-instance/client/client.gen.ts index ff7815f4d..d98de0bc6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/client-fetch/sdk-nested-classes-instance/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/client-fetch/sdk-nested-classes-instance/client/client.gen.ts @@ -65,10 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if ( - opts.body === undefined || - (opts.serializedBody !== undefined && opts.serializedBody === '') - ) { + if (opts.body === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/client-fetch/sdk-nested-classes/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/client-fetch/sdk-nested-classes/client/client.gen.ts index ff7815f4d..d98de0bc6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/client-fetch/sdk-nested-classes/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/client-fetch/sdk-nested-classes/client/client.gen.ts @@ -65,10 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if ( - opts.body === undefined || - (opts.serializedBody !== undefined && opts.serializedBody === '') - ) { + if (opts.body === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/sdk/default/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/sdk/default/client/client.gen.ts index ff7815f4d..d98de0bc6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/sdk/default/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/sdk/default/client/client.gen.ts @@ -65,10 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if ( - opts.body === undefined || - (opts.serializedBody !== undefined && opts.serializedBody === '') - ) { + if (opts.body === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/sdk/instance/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/sdk/instance/client/client.gen.ts index ff7815f4d..d98de0bc6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/sdk/instance/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/sdk/instance/client/client.gen.ts @@ -65,10 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if ( - opts.body === undefined || - (opts.serializedBody !== undefined && opts.serializedBody === '') - ) { + if (opts.body === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/sdk/throwOnError/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/sdk/throwOnError/client/client.gen.ts index ff7815f4d..d98de0bc6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/sdk/throwOnError/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/sdk/throwOnError/client/client.gen.ts @@ -65,10 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if ( - opts.body === undefined || - (opts.serializedBody !== undefined && opts.serializedBody === '') - ) { + if (opts.body === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/transformers/type-format-valibot/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/transformers/type-format-valibot/client/client.gen.ts index ff7815f4d..d98de0bc6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/transformers/type-format-valibot/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/transformers/type-format-valibot/client/client.gen.ts @@ -65,10 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if ( - opts.body === undefined || - (opts.serializedBody !== undefined && opts.serializedBody === '') - ) { + if (opts.body === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/transformers/type-format-zod/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/transformers/type-format-zod/client/client.gen.ts index ff7815f4d..d98de0bc6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/transformers/type-format-zod/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/transformers/type-format-zod/client/client.gen.ts @@ -65,10 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if ( - opts.body === undefined || - (opts.serializedBody !== undefined && opts.serializedBody === '') - ) { + if (opts.body === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/typescript/transforms-read-write-custom-name/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/typescript/transforms-read-write-custom-name/client/client.gen.ts index ff7815f4d..d98de0bc6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/typescript/transforms-read-write-custom-name/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/typescript/transforms-read-write-custom-name/client/client.gen.ts @@ -65,10 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if ( - opts.body === undefined || - (opts.serializedBody !== undefined && opts.serializedBody === '') - ) { + if (opts.body === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/typescript/transforms-read-write-ignore/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/typescript/transforms-read-write-ignore/client/client.gen.ts index ff7815f4d..d98de0bc6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/typescript/transforms-read-write-ignore/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/typescript/transforms-read-write-ignore/client/client.gen.ts @@ -65,10 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if ( - opts.body === undefined || - (opts.serializedBody !== undefined && opts.serializedBody === '') - ) { + if (opts.body === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@pinia/colada/fetch/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@pinia/colada/fetch/client/client.gen.ts index ff7815f4d..d98de0bc6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@pinia/colada/fetch/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@pinia/colada/fetch/client/client.gen.ts @@ -65,10 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if ( - opts.body === undefined || - (opts.serializedBody !== undefined && opts.serializedBody === '') - ) { + if (opts.body === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@pinia/colada/group-by-tag/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@pinia/colada/group-by-tag/client/client.gen.ts index ff7815f4d..d98de0bc6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@pinia/colada/group-by-tag/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@pinia/colada/group-by-tag/client/client.gen.ts @@ -65,10 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if ( - opts.body === undefined || - (opts.serializedBody !== undefined && opts.serializedBody === '') - ) { + if (opts.body === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/angular-query-experimental/asClass/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/angular-query-experimental/asClass/client/client.gen.ts index ff7815f4d..d98de0bc6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/angular-query-experimental/asClass/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/angular-query-experimental/asClass/client/client.gen.ts @@ -65,10 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if ( - opts.body === undefined || - (opts.serializedBody !== undefined && opts.serializedBody === '') - ) { + if (opts.body === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/angular-query-experimental/fetch/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/angular-query-experimental/fetch/client/client.gen.ts index ff7815f4d..d98de0bc6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/angular-query-experimental/fetch/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/angular-query-experimental/fetch/client/client.gen.ts @@ -65,10 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if ( - opts.body === undefined || - (opts.serializedBody !== undefined && opts.serializedBody === '') - ) { + if (opts.body === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/angular-query-experimental/name-builder/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/angular-query-experimental/name-builder/client/client.gen.ts index ff7815f4d..d98de0bc6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/angular-query-experimental/name-builder/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/angular-query-experimental/name-builder/client/client.gen.ts @@ -65,10 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if ( - opts.body === undefined || - (opts.serializedBody !== undefined && opts.serializedBody === '') - ) { + if (opts.body === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/react-query/asClass/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/react-query/asClass/client/client.gen.ts index ff7815f4d..d98de0bc6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/react-query/asClass/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/react-query/asClass/client/client.gen.ts @@ -65,10 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if ( - opts.body === undefined || - (opts.serializedBody !== undefined && opts.serializedBody === '') - ) { + if (opts.body === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/react-query/fetch/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/react-query/fetch/client/client.gen.ts index ff7815f4d..d98de0bc6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/react-query/fetch/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/react-query/fetch/client/client.gen.ts @@ -65,10 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if ( - opts.body === undefined || - (opts.serializedBody !== undefined && opts.serializedBody === '') - ) { + if (opts.body === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/react-query/name-builder/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/react-query/name-builder/client/client.gen.ts index ff7815f4d..d98de0bc6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/react-query/name-builder/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/react-query/name-builder/client/client.gen.ts @@ -65,10 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if ( - opts.body === undefined || - (opts.serializedBody !== undefined && opts.serializedBody === '') - ) { + if (opts.body === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/solid-query/asClass/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/solid-query/asClass/client/client.gen.ts index ff7815f4d..d98de0bc6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/solid-query/asClass/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/solid-query/asClass/client/client.gen.ts @@ -65,10 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if ( - opts.body === undefined || - (opts.serializedBody !== undefined && opts.serializedBody === '') - ) { + if (opts.body === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/solid-query/fetch/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/solid-query/fetch/client/client.gen.ts index ff7815f4d..d98de0bc6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/solid-query/fetch/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/solid-query/fetch/client/client.gen.ts @@ -65,10 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if ( - opts.body === undefined || - (opts.serializedBody !== undefined && opts.serializedBody === '') - ) { + if (opts.body === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/solid-query/name-builder/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/solid-query/name-builder/client/client.gen.ts index ff7815f4d..d98de0bc6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/solid-query/name-builder/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/solid-query/name-builder/client/client.gen.ts @@ -65,10 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if ( - opts.body === undefined || - (opts.serializedBody !== undefined && opts.serializedBody === '') - ) { + if (opts.body === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/svelte-query/asClass/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/svelte-query/asClass/client/client.gen.ts index ff7815f4d..d98de0bc6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/svelte-query/asClass/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/svelte-query/asClass/client/client.gen.ts @@ -65,10 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if ( - opts.body === undefined || - (opts.serializedBody !== undefined && opts.serializedBody === '') - ) { + if (opts.body === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/svelte-query/fetch/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/svelte-query/fetch/client/client.gen.ts index ff7815f4d..d98de0bc6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/svelte-query/fetch/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/svelte-query/fetch/client/client.gen.ts @@ -65,10 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if ( - opts.body === undefined || - (opts.serializedBody !== undefined && opts.serializedBody === '') - ) { + if (opts.body === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/svelte-query/name-builder/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/svelte-query/name-builder/client/client.gen.ts index ff7815f4d..d98de0bc6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/svelte-query/name-builder/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/svelte-query/name-builder/client/client.gen.ts @@ -65,10 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if ( - opts.body === undefined || - (opts.serializedBody !== undefined && opts.serializedBody === '') - ) { + if (opts.body === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/vue-query/asClass/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/vue-query/asClass/client/client.gen.ts index ff7815f4d..d98de0bc6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/vue-query/asClass/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/vue-query/asClass/client/client.gen.ts @@ -65,10 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if ( - opts.body === undefined || - (opts.serializedBody !== undefined && opts.serializedBody === '') - ) { + if (opts.body === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/vue-query/fetch/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/vue-query/fetch/client/client.gen.ts index ff7815f4d..d98de0bc6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/vue-query/fetch/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/vue-query/fetch/client/client.gen.ts @@ -65,10 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if ( - opts.body === undefined || - (opts.serializedBody !== undefined && opts.serializedBody === '') - ) { + if (opts.body === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/vue-query/name-builder/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/vue-query/name-builder/client/client.gen.ts index ff7815f4d..d98de0bc6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/vue-query/name-builder/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/vue-query/name-builder/client/client.gen.ts @@ -65,10 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if ( - opts.body === undefined || - (opts.serializedBody !== undefined && opts.serializedBody === '') - ) { + if (opts.body === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-api-key/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-api-key/client/client.gen.ts index ff7815f4d..d98de0bc6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-api-key/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-api-key/client/client.gen.ts @@ -65,10 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if ( - opts.body === undefined || - (opts.serializedBody !== undefined && opts.serializedBody === '') - ) { + if (opts.body === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-false/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-false/client/client.gen.ts index ff7815f4d..d98de0bc6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-false/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-false/client/client.gen.ts @@ -65,10 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if ( - opts.body === undefined || - (opts.serializedBody !== undefined && opts.serializedBody === '') - ) { + if (opts.body === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-http-bearer/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-http-bearer/client/client.gen.ts index ff7815f4d..d98de0bc6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-http-bearer/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-http-bearer/client/client.gen.ts @@ -65,10 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if ( - opts.body === undefined || - (opts.serializedBody !== undefined && opts.serializedBody === '') - ) { + if (opts.body === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-oauth2/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-oauth2/client/client.gen.ts index ff7815f4d..d98de0bc6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-oauth2/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-oauth2/client/client.gen.ts @@ -65,10 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if ( - opts.body === undefined || - (opts.serializedBody !== undefined && opts.serializedBody === '') - ) { + if (opts.body === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-open-id-connect/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-open-id-connect/client/client.gen.ts index ff7815f4d..d98de0bc6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-open-id-connect/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-open-id-connect/client/client.gen.ts @@ -65,10 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if ( - opts.body === undefined || - (opts.serializedBody !== undefined && opts.serializedBody === '') - ) { + if (opts.body === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/servers/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/servers/client/client.gen.ts index ff7815f4d..d98de0bc6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/servers/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/servers/client/client.gen.ts @@ -65,10 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if ( - opts.body === undefined || - (opts.serializedBody !== undefined && opts.serializedBody === '') - ) { + if (opts.body === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-fetch/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-fetch/client/client.gen.ts index ff7815f4d..d98de0bc6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-fetch/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-fetch/client/client.gen.ts @@ -65,10 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if ( - opts.body === undefined || - (opts.serializedBody !== undefined && opts.serializedBody === '') - ) { + if (opts.body === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-next/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-next/client/client.gen.ts index 06cae5956..8aafb006a 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-next/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-next/client/client.gen.ts @@ -64,10 +64,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if ( - opts.body === undefined || - (opts.serializedBody !== undefined && opts.serializedBody === '') - ) { + if (opts.body === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-all-of/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-all-of/client/client.gen.ts index ff7815f4d..d98de0bc6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-all-of/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-all-of/client/client.gen.ts @@ -65,10 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if ( - opts.body === undefined || - (opts.serializedBody !== undefined && opts.serializedBody === '') - ) { + if (opts.body === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-any-of-null/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-any-of-null/client/client.gen.ts index ff7815f4d..d98de0bc6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-any-of-null/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-any-of-null/client/client.gen.ts @@ -65,10 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if ( - opts.body === undefined || - (opts.serializedBody !== undefined && opts.serializedBody === '') - ) { + if (opts.body === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-array/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-array/client/client.gen.ts index ff7815f4d..d98de0bc6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-array/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-array/client/client.gen.ts @@ -65,10 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if ( - opts.body === undefined || - (opts.serializedBody !== undefined && opts.serializedBody === '') - ) { + if (opts.body === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transforms-read-write/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transforms-read-write/client/client.gen.ts index ff7815f4d..d98de0bc6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transforms-read-write/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transforms-read-write/client/client.gen.ts @@ -65,10 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if ( - opts.body === undefined || - (opts.serializedBody !== undefined && opts.serializedBody === '') - ) { + if (opts.body === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/plugins/@tanstack/meta/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/plugins/@tanstack/meta/client/client.gen.ts index ff7815f4d..d98de0bc6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/plugins/@tanstack/meta/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/plugins/@tanstack/meta/client/client.gen.ts @@ -65,10 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if ( - opts.body === undefined || - (opts.serializedBody !== undefined && opts.serializedBody === '') - ) { + if (opts.body === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/test/generated/v3_no_index/client/client.gen.ts.snap b/packages/openapi-ts-tests/main/test/__snapshots__/test/generated/v3_no_index/client/client.gen.ts.snap index ff7815f4d..d98de0bc6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/test/generated/v3_no_index/client/client.gen.ts.snap +++ b/packages/openapi-ts-tests/main/test/__snapshots__/test/generated/v3_no_index/client/client.gen.ts.snap @@ -65,10 +65,7 @@ export const createClient = (config: Config = {}): Client => { } // remove Content-Type header if body is empty to avoid sending invalid requests - if ( - opts.body === undefined || - (opts.serializedBody !== undefined && opts.serializedBody === '') - ) { + if (opts.body === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); } -- 2.51.2 From bdd77257efff10dbdcf7bf55756ad8b1e5a32d3e Mon Sep 17 00:00:00 2001 From: Fransis Young Date: Tue, 2 Sep 2025 21:57:32 -0400 Subject: [PATCH 16/46] chore(client-fetch,client-nuxt): updates getValidRequestBody to return undefined by default --- .../src/plugins/@hey-api/client-fetch/bundle/client.ts | 3 ++- .../src/plugins/@hey-api/client-next/bundle/client.ts | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/openapi-ts/src/plugins/@hey-api/client-fetch/bundle/client.ts b/packages/openapi-ts/src/plugins/@hey-api/client-fetch/bundle/client.ts index 3e59d949a..e750a8314 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/client-fetch/bundle/client.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/client-fetch/bundle/client.ts @@ -226,7 +226,8 @@ export const createClient = (config: Config = {}): Client => { return options.body; } - return null; + // no body was provided + return undefined; } const makeMethodFn = diff --git a/packages/openapi-ts/src/plugins/@hey-api/client-next/bundle/client.ts b/packages/openapi-ts/src/plugins/@hey-api/client-next/bundle/client.ts index 3cf237b6e..574ca0b57 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/client-next/bundle/client.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/client-next/bundle/client.ts @@ -214,7 +214,8 @@ export const createClient = (config: Config = {}): Client => { return options.body; } - return null; + // no body was provided + return undefined; } const makeMethodFn = -- 2.51.2 From 10e548828aefb39c8c33d64a9f7acfdd6481e5de Mon Sep 17 00:00:00 2001 From: Fransis Young Date: Tue, 2 Sep 2025 22:05:40 -0400 Subject: [PATCH 17/46] test(client): updates snapshots --- .../2.0.x/body-response-text-plain/client/client.gen.ts | 3 ++- .../test/__snapshots__/2.0.x/form-data/client/client.gen.ts | 3 ++- .../sdk-nested-classes-instance/client/client.gen.ts | 3 ++- .../client-fetch/sdk-nested-classes/client/client.gen.ts | 3 ++- .../2.0.x/plugins/@hey-api/sdk/default/client/client.gen.ts | 3 ++- .../2.0.x/plugins/@hey-api/sdk/instance/client/client.gen.ts | 3 ++- .../plugins/@hey-api/sdk/throwOnError/client/client.gen.ts | 3 ++- .../transformers/type-format-valibot/client/client.gen.ts | 3 ++- .../@hey-api/transformers/type-format-zod/client/client.gen.ts | 3 ++- .../transforms-read-write-custom-name/client/client.gen.ts | 3 ++- .../transforms-read-write-ignore/client/client.gen.ts | 3 ++- .../2.0.x/plugins/@pinia/colada/fetch/client/client.gen.ts | 3 ++- .../plugins/@pinia/colada/group-by-tag/client/client.gen.ts | 3 ++- .../angular-query-experimental/asClass/client/client.gen.ts | 3 ++- .../angular-query-experimental/fetch/client/client.gen.ts | 3 ++- .../name-builder/client/client.gen.ts | 3 ++- .../plugins/@tanstack/react-query/asClass/client/client.gen.ts | 3 ++- .../plugins/@tanstack/react-query/fetch/client/client.gen.ts | 3 ++- .../@tanstack/react-query/name-builder/client/client.gen.ts | 3 ++- .../plugins/@tanstack/solid-query/asClass/client/client.gen.ts | 3 ++- .../plugins/@tanstack/solid-query/fetch/client/client.gen.ts | 3 ++- .../@tanstack/solid-query/name-builder/client/client.gen.ts | 3 ++- .../@tanstack/svelte-query/asClass/client/client.gen.ts | 3 ++- .../plugins/@tanstack/svelte-query/fetch/client/client.gen.ts | 3 ++- .../@tanstack/svelte-query/name-builder/client/client.gen.ts | 3 ++- .../plugins/@tanstack/vue-query/asClass/client/client.gen.ts | 3 ++- .../plugins/@tanstack/vue-query/fetch/client/client.gen.ts | 3 ++- .../@tanstack/vue-query/name-builder/client/client.gen.ts | 3 ++- .../__snapshots__/2.0.x/schema-unknown/client/client.gen.ts | 3 ++- .../__snapshots__/2.0.x/security-api-key/client/client.gen.ts | 3 ++- .../__snapshots__/2.0.x/security-basic/client/client.gen.ts | 3 ++- .../__snapshots__/2.0.x/security-false/client/client.gen.ts | 3 ++- .../__snapshots__/2.0.x/security-oauth2/client/client.gen.ts | 3 ++- .../__snapshots__/2.0.x/servers-base-path/client/client.gen.ts | 3 ++- .../test/__snapshots__/2.0.x/servers-host/client/client.gen.ts | 3 ++- .../main/test/__snapshots__/2.0.x/servers/client/client.gen.ts | 3 ++- .../2.0.x/transforms-read-write/client/client.gen.ts | 3 ++- .../3.0.x/body-response-text-plain/client/client.gen.ts | 3 ++- .../3.0.x/internal-name-conflict/client/client.gen.ts | 3 ++- .../3.0.x/parameter-explode-false/client/client.gen.ts | 3 ++- .../sdk-nested-classes-instance/client/client.gen.ts | 3 ++- .../client-fetch/sdk-nested-classes/client/client.gen.ts | 3 ++- .../3.0.x/plugins/@hey-api/sdk/default/client/client.gen.ts | 3 ++- .../3.0.x/plugins/@hey-api/sdk/instance/client/client.gen.ts | 3 ++- .../plugins/@hey-api/sdk/throwOnError/client/client.gen.ts | 3 ++- .../transformers/type-format-valibot/client/client.gen.ts | 3 ++- .../@hey-api/transformers/type-format-zod/client/client.gen.ts | 3 ++- .../transforms-read-write-custom-name/client/client.gen.ts | 3 ++- .../transforms-read-write-ignore/client/client.gen.ts | 3 ++- .../3.0.x/plugins/@pinia/colada/fetch/client/client.gen.ts | 3 ++- .../plugins/@pinia/colada/group-by-tag/client/client.gen.ts | 3 ++- .../angular-query-experimental/asClass/client/client.gen.ts | 3 ++- .../angular-query-experimental/fetch/client/client.gen.ts | 3 ++- .../name-builder/client/client.gen.ts | 3 ++- .../plugins/@tanstack/react-query/asClass/client/client.gen.ts | 3 ++- .../plugins/@tanstack/react-query/fetch/client/client.gen.ts | 3 ++- .../@tanstack/react-query/name-builder/client/client.gen.ts | 3 ++- .../plugins/@tanstack/solid-query/asClass/client/client.gen.ts | 3 ++- .../plugins/@tanstack/solid-query/fetch/client/client.gen.ts | 3 ++- .../@tanstack/solid-query/name-builder/client/client.gen.ts | 3 ++- .../@tanstack/svelte-query/asClass/client/client.gen.ts | 3 ++- .../plugins/@tanstack/svelte-query/fetch/client/client.gen.ts | 3 ++- .../@tanstack/svelte-query/name-builder/client/client.gen.ts | 3 ++- .../plugins/@tanstack/vue-query/asClass/client/client.gen.ts | 3 ++- .../plugins/@tanstack/vue-query/fetch/client/client.gen.ts | 3 ++- .../@tanstack/vue-query/name-builder/client/client.gen.ts | 3 ++- .../__snapshots__/3.0.x/security-api-key/client/client.gen.ts | 3 ++- .../__snapshots__/3.0.x/security-false/client/client.gen.ts | 3 ++- .../3.0.x/security-http-bearer/client/client.gen.ts | 3 ++- .../__snapshots__/3.0.x/security-oauth2/client/client.gen.ts | 3 ++- .../3.0.x/security-open-id-connect/client/client.gen.ts | 3 ++- .../main/test/__snapshots__/3.0.x/servers/client/client.gen.ts | 3 ++- .../3.0.x/transformers-all-of/client/client.gen.ts | 3 ++- .../3.0.x/transformers-any-of-null/client/client.gen.ts | 3 ++- .../3.0.x/transformers-array/client/client.gen.ts | 3 ++- .../3.0.x/transforms-read-write/client/client.gen.ts | 3 ++- .../3.1.x/body-response-text-plain/client/client.gen.ts | 3 ++- .../@hey-api/client-fetch/base-url-false/client/client.gen.ts | 3 ++- .../@hey-api/client-fetch/base-url-number/client/client.gen.ts | 3 ++- .../@hey-api/client-fetch/base-url-strict/client/client.gen.ts | 3 ++- .../@hey-api/client-fetch/base-url-string/client/client.gen.ts | 3 ++- .../@hey-api/client-fetch/clean-false/client/client.gen.ts | 3 ++- .../clients/@hey-api/client-fetch/default/client/client.gen.ts | 3 ++- .../client-fetch/sdk-client-optional/client/client.gen.ts | 3 ++- .../client-fetch/sdk-client-required/client/client.gen.ts | 3 ++- .../client-fetch/tsconfig-nodenext-sdk/client/client.gen.ts | 3 ++- .../@hey-api/client-next/base-url-false/client/client.gen.ts | 3 ++- .../@hey-api/client-next/base-url-number/client/client.gen.ts | 3 ++- .../@hey-api/client-next/base-url-strict/client/client.gen.ts | 3 ++- .../@hey-api/client-next/base-url-string/client/client.gen.ts | 3 ++- .../@hey-api/client-next/clean-false/client/client.gen.ts | 3 ++- .../clients/@hey-api/client-next/default/client/client.gen.ts | 3 ++- .../client-next/sdk-client-optional/client/client.gen.ts | 3 ++- .../client-next/sdk-client-required/client/client.gen.ts | 3 ++- .../client-next/tsconfig-nodenext-sdk/client/client.gen.ts | 3 ++- .../main/test/__snapshots__/3.1.x/headers/client/client.gen.ts | 3 ++- .../3.1.x/internal-name-conflict/client/client.gen.ts | 3 ++- .../__snapshots__/3.1.x/pagination-ref/client/client.gen.ts | 3 ++- .../3.1.x/parameter-explode-false/client/client.gen.ts | 3 ++- .../sdk-nested-classes-instance/client/client.gen.ts | 3 ++- .../client-fetch/sdk-nested-classes/client/client.gen.ts | 3 ++- .../3.1.x/plugins/@hey-api/sdk/default/client/client.gen.ts | 3 ++- .../3.1.x/plugins/@hey-api/sdk/instance/client/client.gen.ts | 3 ++- .../plugins/@hey-api/sdk/throwOnError/client/client.gen.ts | 3 ++- .../transformers/type-format-valibot/client/client.gen.ts | 3 ++- .../@hey-api/transformers/type-format-zod/client/client.gen.ts | 3 ++- .../transforms-read-write-custom-name/client/client.gen.ts | 3 ++- .../transforms-read-write-ignore/client/client.gen.ts | 3 ++- .../3.1.x/plugins/@pinia/colada/fetch/client/client.gen.ts | 3 ++- .../plugins/@pinia/colada/group-by-tag/client/client.gen.ts | 3 ++- .../angular-query-experimental/asClass/client/client.gen.ts | 3 ++- .../angular-query-experimental/fetch/client/client.gen.ts | 3 ++- .../name-builder/client/client.gen.ts | 3 ++- .../plugins/@tanstack/react-query/asClass/client/client.gen.ts | 3 ++- .../plugins/@tanstack/react-query/fetch/client/client.gen.ts | 3 ++- .../@tanstack/react-query/name-builder/client/client.gen.ts | 3 ++- .../plugins/@tanstack/solid-query/asClass/client/client.gen.ts | 3 ++- .../plugins/@tanstack/solid-query/fetch/client/client.gen.ts | 3 ++- .../@tanstack/solid-query/name-builder/client/client.gen.ts | 3 ++- .../@tanstack/svelte-query/asClass/client/client.gen.ts | 3 ++- .../plugins/@tanstack/svelte-query/fetch/client/client.gen.ts | 3 ++- .../@tanstack/svelte-query/name-builder/client/client.gen.ts | 3 ++- .../plugins/@tanstack/vue-query/asClass/client/client.gen.ts | 3 ++- .../plugins/@tanstack/vue-query/fetch/client/client.gen.ts | 3 ++- .../@tanstack/vue-query/name-builder/client/client.gen.ts | 3 ++- .../__snapshots__/3.1.x/security-api-key/client/client.gen.ts | 3 ++- .../__snapshots__/3.1.x/security-false/client/client.gen.ts | 3 ++- .../3.1.x/security-http-bearer/client/client.gen.ts | 3 ++- .../__snapshots__/3.1.x/security-oauth2/client/client.gen.ts | 3 ++- .../3.1.x/security-open-id-connect/client/client.gen.ts | 3 ++- .../main/test/__snapshots__/3.1.x/servers/client/client.gen.ts | 3 ++- .../test/__snapshots__/3.1.x/sse-fetch/client/client.gen.ts | 3 ++- .../test/__snapshots__/3.1.x/sse-next/client/client.gen.ts | 3 ++- .../3.1.x/transformers-all-of/client/client.gen.ts | 3 ++- .../3.1.x/transformers-any-of-null/client/client.gen.ts | 3 ++- .../3.1.x/transformers-array/client/client.gen.ts | 3 ++- .../3.1.x/transforms-read-write/client/client.gen.ts | 3 ++- .../__snapshots__/plugins/@tanstack/meta/client/client.gen.ts | 3 ++- .../test/generated/v3_no_index/client/client.gen.ts.snap | 3 ++- 139 files changed, 278 insertions(+), 139 deletions(-) diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/body-response-text-plain/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/body-response-text-plain/client/client.gen.ts index d98de0bc6..329968d82 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/body-response-text-plain/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/body-response-text-plain/client/client.gen.ts @@ -228,7 +228,8 @@ export const createClient = (config: Config = {}): Client => { return options.body; } - return null; + // no body was provided + return undefined; } const makeMethodFn = diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/form-data/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/form-data/client/client.gen.ts index d98de0bc6..329968d82 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/form-data/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/form-data/client/client.gen.ts @@ -228,7 +228,8 @@ export const createClient = (config: Config = {}): Client => { return options.body; } - return null; + // no body was provided + return undefined; } const makeMethodFn = diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/client-fetch/sdk-nested-classes-instance/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/client-fetch/sdk-nested-classes-instance/client/client.gen.ts index d98de0bc6..329968d82 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/client-fetch/sdk-nested-classes-instance/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/client-fetch/sdk-nested-classes-instance/client/client.gen.ts @@ -228,7 +228,8 @@ export const createClient = (config: Config = {}): Client => { return options.body; } - return null; + // no body was provided + return undefined; } const makeMethodFn = diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/client-fetch/sdk-nested-classes/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/client-fetch/sdk-nested-classes/client/client.gen.ts index d98de0bc6..329968d82 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/client-fetch/sdk-nested-classes/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/client-fetch/sdk-nested-classes/client/client.gen.ts @@ -228,7 +228,8 @@ export const createClient = (config: Config = {}): Client => { return options.body; } - return null; + // no body was provided + return undefined; } const makeMethodFn = diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/sdk/default/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/sdk/default/client/client.gen.ts index d98de0bc6..329968d82 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/sdk/default/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/sdk/default/client/client.gen.ts @@ -228,7 +228,8 @@ export const createClient = (config: Config = {}): Client => { return options.body; } - return null; + // no body was provided + return undefined; } const makeMethodFn = diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/sdk/instance/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/sdk/instance/client/client.gen.ts index d98de0bc6..329968d82 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/sdk/instance/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/sdk/instance/client/client.gen.ts @@ -228,7 +228,8 @@ export const createClient = (config: Config = {}): Client => { return options.body; } - return null; + // no body was provided + return undefined; } const makeMethodFn = diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/sdk/throwOnError/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/sdk/throwOnError/client/client.gen.ts index d98de0bc6..329968d82 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/sdk/throwOnError/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/sdk/throwOnError/client/client.gen.ts @@ -228,7 +228,8 @@ export const createClient = (config: Config = {}): Client => { return options.body; } - return null; + // no body was provided + return undefined; } const makeMethodFn = diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/transformers/type-format-valibot/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/transformers/type-format-valibot/client/client.gen.ts index d98de0bc6..329968d82 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/transformers/type-format-valibot/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/transformers/type-format-valibot/client/client.gen.ts @@ -228,7 +228,8 @@ export const createClient = (config: Config = {}): Client => { return options.body; } - return null; + // no body was provided + return undefined; } const makeMethodFn = diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/transformers/type-format-zod/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/transformers/type-format-zod/client/client.gen.ts index d98de0bc6..329968d82 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/transformers/type-format-zod/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/transformers/type-format-zod/client/client.gen.ts @@ -228,7 +228,8 @@ export const createClient = (config: Config = {}): Client => { return options.body; } - return null; + // no body was provided + return undefined; } const makeMethodFn = diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/typescript/transforms-read-write-custom-name/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/typescript/transforms-read-write-custom-name/client/client.gen.ts index d98de0bc6..329968d82 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/typescript/transforms-read-write-custom-name/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/typescript/transforms-read-write-custom-name/client/client.gen.ts @@ -228,7 +228,8 @@ export const createClient = (config: Config = {}): Client => { return options.body; } - return null; + // no body was provided + return undefined; } const makeMethodFn = diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/typescript/transforms-read-write-ignore/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/typescript/transforms-read-write-ignore/client/client.gen.ts index d98de0bc6..329968d82 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/typescript/transforms-read-write-ignore/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/typescript/transforms-read-write-ignore/client/client.gen.ts @@ -228,7 +228,8 @@ export const createClient = (config: Config = {}): Client => { return options.body; } - return null; + // no body was provided + return undefined; } const makeMethodFn = diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@pinia/colada/fetch/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@pinia/colada/fetch/client/client.gen.ts index d98de0bc6..329968d82 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@pinia/colada/fetch/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@pinia/colada/fetch/client/client.gen.ts @@ -228,7 +228,8 @@ export const createClient = (config: Config = {}): Client => { return options.body; } - return null; + // no body was provided + return undefined; } const makeMethodFn = diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@pinia/colada/group-by-tag/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@pinia/colada/group-by-tag/client/client.gen.ts index d98de0bc6..329968d82 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@pinia/colada/group-by-tag/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@pinia/colada/group-by-tag/client/client.gen.ts @@ -228,7 +228,8 @@ export const createClient = (config: Config = {}): Client => { return options.body; } - return null; + // no body was provided + return undefined; } const makeMethodFn = diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/asClass/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/asClass/client/client.gen.ts index d98de0bc6..329968d82 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/asClass/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/asClass/client/client.gen.ts @@ -228,7 +228,8 @@ export const createClient = (config: Config = {}): Client => { return options.body; } - return null; + // no body was provided + return undefined; } const makeMethodFn = diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/fetch/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/fetch/client/client.gen.ts index d98de0bc6..329968d82 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/fetch/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/fetch/client/client.gen.ts @@ -228,7 +228,8 @@ export const createClient = (config: Config = {}): Client => { return options.body; } - return null; + // no body was provided + return undefined; } const makeMethodFn = diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/name-builder/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/name-builder/client/client.gen.ts index d98de0bc6..329968d82 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/name-builder/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/name-builder/client/client.gen.ts @@ -228,7 +228,8 @@ export const createClient = (config: Config = {}): Client => { return options.body; } - return null; + // no body was provided + return undefined; } const makeMethodFn = diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/react-query/asClass/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/react-query/asClass/client/client.gen.ts index d98de0bc6..329968d82 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/react-query/asClass/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/react-query/asClass/client/client.gen.ts @@ -228,7 +228,8 @@ export const createClient = (config: Config = {}): Client => { return options.body; } - return null; + // no body was provided + return undefined; } const makeMethodFn = diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/react-query/fetch/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/react-query/fetch/client/client.gen.ts index d98de0bc6..329968d82 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/react-query/fetch/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/react-query/fetch/client/client.gen.ts @@ -228,7 +228,8 @@ export const createClient = (config: Config = {}): Client => { return options.body; } - return null; + // no body was provided + return undefined; } const makeMethodFn = diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/react-query/name-builder/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/react-query/name-builder/client/client.gen.ts index d98de0bc6..329968d82 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/react-query/name-builder/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/react-query/name-builder/client/client.gen.ts @@ -228,7 +228,8 @@ export const createClient = (config: Config = {}): Client => { return options.body; } - return null; + // no body was provided + return undefined; } const makeMethodFn = diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/solid-query/asClass/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/solid-query/asClass/client/client.gen.ts index d98de0bc6..329968d82 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/solid-query/asClass/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/solid-query/asClass/client/client.gen.ts @@ -228,7 +228,8 @@ export const createClient = (config: Config = {}): Client => { return options.body; } - return null; + // no body was provided + return undefined; } const makeMethodFn = diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/solid-query/fetch/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/solid-query/fetch/client/client.gen.ts index d98de0bc6..329968d82 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/solid-query/fetch/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/solid-query/fetch/client/client.gen.ts @@ -228,7 +228,8 @@ export const createClient = (config: Config = {}): Client => { return options.body; } - return null; + // no body was provided + return undefined; } const makeMethodFn = diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/solid-query/name-builder/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/solid-query/name-builder/client/client.gen.ts index d98de0bc6..329968d82 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/solid-query/name-builder/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/solid-query/name-builder/client/client.gen.ts @@ -228,7 +228,8 @@ export const createClient = (config: Config = {}): Client => { return options.body; } - return null; + // no body was provided + return undefined; } const makeMethodFn = diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/svelte-query/asClass/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/svelte-query/asClass/client/client.gen.ts index d98de0bc6..329968d82 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/svelte-query/asClass/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/svelte-query/asClass/client/client.gen.ts @@ -228,7 +228,8 @@ export const createClient = (config: Config = {}): Client => { return options.body; } - return null; + // no body was provided + return undefined; } const makeMethodFn = diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/svelte-query/fetch/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/svelte-query/fetch/client/client.gen.ts index d98de0bc6..329968d82 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/svelte-query/fetch/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/svelte-query/fetch/client/client.gen.ts @@ -228,7 +228,8 @@ export const createClient = (config: Config = {}): Client => { return options.body; } - return null; + // no body was provided + return undefined; } const makeMethodFn = diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/svelte-query/name-builder/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/svelte-query/name-builder/client/client.gen.ts index d98de0bc6..329968d82 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/svelte-query/name-builder/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/svelte-query/name-builder/client/client.gen.ts @@ -228,7 +228,8 @@ export const createClient = (config: Config = {}): Client => { return options.body; } - return null; + // no body was provided + return undefined; } const makeMethodFn = diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/vue-query/asClass/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/vue-query/asClass/client/client.gen.ts index d98de0bc6..329968d82 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/vue-query/asClass/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/vue-query/asClass/client/client.gen.ts @@ -228,7 +228,8 @@ export const createClient = (config: Config = {}): Client => { return options.body; } - return null; + // no body was provided + return undefined; } const makeMethodFn = diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/vue-query/fetch/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/vue-query/fetch/client/client.gen.ts index d98de0bc6..329968d82 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/vue-query/fetch/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/vue-query/fetch/client/client.gen.ts @@ -228,7 +228,8 @@ export const createClient = (config: Config = {}): Client => { return options.body; } - return null; + // no body was provided + return undefined; } const makeMethodFn = diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/vue-query/name-builder/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/vue-query/name-builder/client/client.gen.ts index d98de0bc6..329968d82 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/vue-query/name-builder/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/vue-query/name-builder/client/client.gen.ts @@ -228,7 +228,8 @@ export const createClient = (config: Config = {}): Client => { return options.body; } - return null; + // no body was provided + return undefined; } const makeMethodFn = diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/schema-unknown/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/schema-unknown/client/client.gen.ts index d98de0bc6..329968d82 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/schema-unknown/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/schema-unknown/client/client.gen.ts @@ -228,7 +228,8 @@ export const createClient = (config: Config = {}): Client => { return options.body; } - return null; + // no body was provided + return undefined; } const makeMethodFn = diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-api-key/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-api-key/client/client.gen.ts index d98de0bc6..329968d82 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-api-key/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-api-key/client/client.gen.ts @@ -228,7 +228,8 @@ export const createClient = (config: Config = {}): Client => { return options.body; } - return null; + // no body was provided + return undefined; } const makeMethodFn = diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-basic/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-basic/client/client.gen.ts index d98de0bc6..329968d82 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-basic/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-basic/client/client.gen.ts @@ -228,7 +228,8 @@ export const createClient = (config: Config = {}): Client => { return options.body; } - return null; + // no body was provided + return undefined; } const makeMethodFn = diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-false/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-false/client/client.gen.ts index d98de0bc6..329968d82 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-false/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-false/client/client.gen.ts @@ -228,7 +228,8 @@ export const createClient = (config: Config = {}): Client => { return options.body; } - return null; + // no body was provided + return undefined; } const makeMethodFn = diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-oauth2/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-oauth2/client/client.gen.ts index d98de0bc6..329968d82 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-oauth2/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-oauth2/client/client.gen.ts @@ -228,7 +228,8 @@ export const createClient = (config: Config = {}): Client => { return options.body; } - return null; + // no body was provided + return undefined; } const makeMethodFn = diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/servers-base-path/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/servers-base-path/client/client.gen.ts index d98de0bc6..329968d82 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/servers-base-path/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/servers-base-path/client/client.gen.ts @@ -228,7 +228,8 @@ export const createClient = (config: Config = {}): Client => { return options.body; } - return null; + // no body was provided + return undefined; } const makeMethodFn = diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/servers-host/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/servers-host/client/client.gen.ts index d98de0bc6..329968d82 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/servers-host/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/servers-host/client/client.gen.ts @@ -228,7 +228,8 @@ export const createClient = (config: Config = {}): Client => { return options.body; } - return null; + // no body was provided + return undefined; } const makeMethodFn = diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/servers/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/servers/client/client.gen.ts index d98de0bc6..329968d82 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/servers/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/servers/client/client.gen.ts @@ -228,7 +228,8 @@ export const createClient = (config: Config = {}): Client => { return options.body; } - return null; + // no body was provided + return undefined; } const makeMethodFn = diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/transforms-read-write/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/transforms-read-write/client/client.gen.ts index d98de0bc6..329968d82 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/transforms-read-write/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/transforms-read-write/client/client.gen.ts @@ -228,7 +228,8 @@ export const createClient = (config: Config = {}): Client => { return options.body; } - return null; + // no body was provided + return undefined; } const makeMethodFn = diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/body-response-text-plain/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/body-response-text-plain/client/client.gen.ts index d98de0bc6..329968d82 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/body-response-text-plain/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/body-response-text-plain/client/client.gen.ts @@ -228,7 +228,8 @@ export const createClient = (config: Config = {}): Client => { return options.body; } - return null; + // no body was provided + return undefined; } const makeMethodFn = diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/internal-name-conflict/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/internal-name-conflict/client/client.gen.ts index d98de0bc6..329968d82 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/internal-name-conflict/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/internal-name-conflict/client/client.gen.ts @@ -228,7 +228,8 @@ export const createClient = (config: Config = {}): Client => { return options.body; } - return null; + // no body was provided + return undefined; } const makeMethodFn = diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/parameter-explode-false/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/parameter-explode-false/client/client.gen.ts index d98de0bc6..329968d82 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/parameter-explode-false/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/parameter-explode-false/client/client.gen.ts @@ -228,7 +228,8 @@ export const createClient = (config: Config = {}): Client => { return options.body; } - return null; + // no body was provided + return undefined; } const makeMethodFn = diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/client-fetch/sdk-nested-classes-instance/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/client-fetch/sdk-nested-classes-instance/client/client.gen.ts index d98de0bc6..329968d82 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/client-fetch/sdk-nested-classes-instance/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/client-fetch/sdk-nested-classes-instance/client/client.gen.ts @@ -228,7 +228,8 @@ export const createClient = (config: Config = {}): Client => { return options.body; } - return null; + // no body was provided + return undefined; } const makeMethodFn = diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/client-fetch/sdk-nested-classes/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/client-fetch/sdk-nested-classes/client/client.gen.ts index d98de0bc6..329968d82 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/client-fetch/sdk-nested-classes/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/client-fetch/sdk-nested-classes/client/client.gen.ts @@ -228,7 +228,8 @@ export const createClient = (config: Config = {}): Client => { return options.body; } - return null; + // no body was provided + return undefined; } const makeMethodFn = diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/sdk/default/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/sdk/default/client/client.gen.ts index d98de0bc6..329968d82 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/sdk/default/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/sdk/default/client/client.gen.ts @@ -228,7 +228,8 @@ export const createClient = (config: Config = {}): Client => { return options.body; } - return null; + // no body was provided + return undefined; } const makeMethodFn = diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/sdk/instance/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/sdk/instance/client/client.gen.ts index d98de0bc6..329968d82 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/sdk/instance/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/sdk/instance/client/client.gen.ts @@ -228,7 +228,8 @@ export const createClient = (config: Config = {}): Client => { return options.body; } - return null; + // no body was provided + return undefined; } const makeMethodFn = diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/sdk/throwOnError/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/sdk/throwOnError/client/client.gen.ts index d98de0bc6..329968d82 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/sdk/throwOnError/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/sdk/throwOnError/client/client.gen.ts @@ -228,7 +228,8 @@ export const createClient = (config: Config = {}): Client => { return options.body; } - return null; + // no body was provided + return undefined; } const makeMethodFn = diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/transformers/type-format-valibot/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/transformers/type-format-valibot/client/client.gen.ts index d98de0bc6..329968d82 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/transformers/type-format-valibot/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/transformers/type-format-valibot/client/client.gen.ts @@ -228,7 +228,8 @@ export const createClient = (config: Config = {}): Client => { return options.body; } - return null; + // no body was provided + return undefined; } const makeMethodFn = diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/transformers/type-format-zod/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/transformers/type-format-zod/client/client.gen.ts index d98de0bc6..329968d82 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/transformers/type-format-zod/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/transformers/type-format-zod/client/client.gen.ts @@ -228,7 +228,8 @@ export const createClient = (config: Config = {}): Client => { return options.body; } - return null; + // no body was provided + return undefined; } const makeMethodFn = diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/typescript/transforms-read-write-custom-name/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/typescript/transforms-read-write-custom-name/client/client.gen.ts index d98de0bc6..329968d82 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/typescript/transforms-read-write-custom-name/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/typescript/transforms-read-write-custom-name/client/client.gen.ts @@ -228,7 +228,8 @@ export const createClient = (config: Config = {}): Client => { return options.body; } - return null; + // no body was provided + return undefined; } const makeMethodFn = diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/typescript/transforms-read-write-ignore/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/typescript/transforms-read-write-ignore/client/client.gen.ts index d98de0bc6..329968d82 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/typescript/transforms-read-write-ignore/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/typescript/transforms-read-write-ignore/client/client.gen.ts @@ -228,7 +228,8 @@ export const createClient = (config: Config = {}): Client => { return options.body; } - return null; + // no body was provided + return undefined; } const makeMethodFn = diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@pinia/colada/fetch/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@pinia/colada/fetch/client/client.gen.ts index d98de0bc6..329968d82 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@pinia/colada/fetch/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@pinia/colada/fetch/client/client.gen.ts @@ -228,7 +228,8 @@ export const createClient = (config: Config = {}): Client => { return options.body; } - return null; + // no body was provided + return undefined; } const makeMethodFn = diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@pinia/colada/group-by-tag/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@pinia/colada/group-by-tag/client/client.gen.ts index d98de0bc6..329968d82 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@pinia/colada/group-by-tag/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@pinia/colada/group-by-tag/client/client.gen.ts @@ -228,7 +228,8 @@ export const createClient = (config: Config = {}): Client => { return options.body; } - return null; + // no body was provided + return undefined; } const makeMethodFn = diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/angular-query-experimental/asClass/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/angular-query-experimental/asClass/client/client.gen.ts index d98de0bc6..329968d82 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/angular-query-experimental/asClass/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/angular-query-experimental/asClass/client/client.gen.ts @@ -228,7 +228,8 @@ export const createClient = (config: Config = {}): Client => { return options.body; } - return null; + // no body was provided + return undefined; } const makeMethodFn = diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/angular-query-experimental/fetch/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/angular-query-experimental/fetch/client/client.gen.ts index d98de0bc6..329968d82 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/angular-query-experimental/fetch/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/angular-query-experimental/fetch/client/client.gen.ts @@ -228,7 +228,8 @@ export const createClient = (config: Config = {}): Client => { return options.body; } - return null; + // no body was provided + return undefined; } const makeMethodFn = diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/angular-query-experimental/name-builder/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/angular-query-experimental/name-builder/client/client.gen.ts index d98de0bc6..329968d82 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/angular-query-experimental/name-builder/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/angular-query-experimental/name-builder/client/client.gen.ts @@ -228,7 +228,8 @@ export const createClient = (config: Config = {}): Client => { return options.body; } - return null; + // no body was provided + return undefined; } const makeMethodFn = diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/react-query/asClass/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/react-query/asClass/client/client.gen.ts index d98de0bc6..329968d82 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/react-query/asClass/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/react-query/asClass/client/client.gen.ts @@ -228,7 +228,8 @@ export const createClient = (config: Config = {}): Client => { return options.body; } - return null; + // no body was provided + return undefined; } const makeMethodFn = diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/react-query/fetch/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/react-query/fetch/client/client.gen.ts index d98de0bc6..329968d82 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/react-query/fetch/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/react-query/fetch/client/client.gen.ts @@ -228,7 +228,8 @@ export const createClient = (config: Config = {}): Client => { return options.body; } - return null; + // no body was provided + return undefined; } const makeMethodFn = diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/react-query/name-builder/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/react-query/name-builder/client/client.gen.ts index d98de0bc6..329968d82 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/react-query/name-builder/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/react-query/name-builder/client/client.gen.ts @@ -228,7 +228,8 @@ export const createClient = (config: Config = {}): Client => { return options.body; } - return null; + // no body was provided + return undefined; } const makeMethodFn = diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/solid-query/asClass/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/solid-query/asClass/client/client.gen.ts index d98de0bc6..329968d82 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/solid-query/asClass/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/solid-query/asClass/client/client.gen.ts @@ -228,7 +228,8 @@ export const createClient = (config: Config = {}): Client => { return options.body; } - return null; + // no body was provided + return undefined; } const makeMethodFn = diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/solid-query/fetch/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/solid-query/fetch/client/client.gen.ts index d98de0bc6..329968d82 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/solid-query/fetch/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/solid-query/fetch/client/client.gen.ts @@ -228,7 +228,8 @@ export const createClient = (config: Config = {}): Client => { return options.body; } - return null; + // no body was provided + return undefined; } const makeMethodFn = diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/solid-query/name-builder/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/solid-query/name-builder/client/client.gen.ts index d98de0bc6..329968d82 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/solid-query/name-builder/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/solid-query/name-builder/client/client.gen.ts @@ -228,7 +228,8 @@ export const createClient = (config: Config = {}): Client => { return options.body; } - return null; + // no body was provided + return undefined; } const makeMethodFn = diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/svelte-query/asClass/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/svelte-query/asClass/client/client.gen.ts index d98de0bc6..329968d82 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/svelte-query/asClass/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/svelte-query/asClass/client/client.gen.ts @@ -228,7 +228,8 @@ export const createClient = (config: Config = {}): Client => { return options.body; } - return null; + // no body was provided + return undefined; } const makeMethodFn = diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/svelte-query/fetch/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/svelte-query/fetch/client/client.gen.ts index d98de0bc6..329968d82 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/svelte-query/fetch/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/svelte-query/fetch/client/client.gen.ts @@ -228,7 +228,8 @@ export const createClient = (config: Config = {}): Client => { return options.body; } - return null; + // no body was provided + return undefined; } const makeMethodFn = diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/svelte-query/name-builder/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/svelte-query/name-builder/client/client.gen.ts index d98de0bc6..329968d82 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/svelte-query/name-builder/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/svelte-query/name-builder/client/client.gen.ts @@ -228,7 +228,8 @@ export const createClient = (config: Config = {}): Client => { return options.body; } - return null; + // no body was provided + return undefined; } const makeMethodFn = diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/vue-query/asClass/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/vue-query/asClass/client/client.gen.ts index d98de0bc6..329968d82 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/vue-query/asClass/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/vue-query/asClass/client/client.gen.ts @@ -228,7 +228,8 @@ export const createClient = (config: Config = {}): Client => { return options.body; } - return null; + // no body was provided + return undefined; } const makeMethodFn = diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/vue-query/fetch/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/vue-query/fetch/client/client.gen.ts index d98de0bc6..329968d82 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/vue-query/fetch/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/vue-query/fetch/client/client.gen.ts @@ -228,7 +228,8 @@ export const createClient = (config: Config = {}): Client => { return options.body; } - return null; + // no body was provided + return undefined; } const makeMethodFn = diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/vue-query/name-builder/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/vue-query/name-builder/client/client.gen.ts index d98de0bc6..329968d82 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/vue-query/name-builder/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/vue-query/name-builder/client/client.gen.ts @@ -228,7 +228,8 @@ export const createClient = (config: Config = {}): Client => { return options.body; } - return null; + // no body was provided + return undefined; } const makeMethodFn = diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-api-key/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-api-key/client/client.gen.ts index d98de0bc6..329968d82 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-api-key/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-api-key/client/client.gen.ts @@ -228,7 +228,8 @@ export const createClient = (config: Config = {}): Client => { return options.body; } - return null; + // no body was provided + return undefined; } const makeMethodFn = diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-false/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-false/client/client.gen.ts index d98de0bc6..329968d82 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-false/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-false/client/client.gen.ts @@ -228,7 +228,8 @@ export const createClient = (config: Config = {}): Client => { return options.body; } - return null; + // no body was provided + return undefined; } const makeMethodFn = diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-http-bearer/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-http-bearer/client/client.gen.ts index d98de0bc6..329968d82 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-http-bearer/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-http-bearer/client/client.gen.ts @@ -228,7 +228,8 @@ export const createClient = (config: Config = {}): Client => { return options.body; } - return null; + // no body was provided + return undefined; } const makeMethodFn = diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-oauth2/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-oauth2/client/client.gen.ts index d98de0bc6..329968d82 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-oauth2/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-oauth2/client/client.gen.ts @@ -228,7 +228,8 @@ export const createClient = (config: Config = {}): Client => { return options.body; } - return null; + // no body was provided + return undefined; } const makeMethodFn = diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-open-id-connect/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-open-id-connect/client/client.gen.ts index d98de0bc6..329968d82 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-open-id-connect/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-open-id-connect/client/client.gen.ts @@ -228,7 +228,8 @@ export const createClient = (config: Config = {}): Client => { return options.body; } - return null; + // no body was provided + return undefined; } const makeMethodFn = diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/servers/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/servers/client/client.gen.ts index d98de0bc6..329968d82 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/servers/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/servers/client/client.gen.ts @@ -228,7 +228,8 @@ export const createClient = (config: Config = {}): Client => { return options.body; } - return null; + // no body was provided + return undefined; } const makeMethodFn = diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transformers-all-of/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transformers-all-of/client/client.gen.ts index d98de0bc6..329968d82 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transformers-all-of/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transformers-all-of/client/client.gen.ts @@ -228,7 +228,8 @@ export const createClient = (config: Config = {}): Client => { return options.body; } - return null; + // no body was provided + return undefined; } const makeMethodFn = diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transformers-any-of-null/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transformers-any-of-null/client/client.gen.ts index d98de0bc6..329968d82 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transformers-any-of-null/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transformers-any-of-null/client/client.gen.ts @@ -228,7 +228,8 @@ export const createClient = (config: Config = {}): Client => { return options.body; } - return null; + // no body was provided + return undefined; } const makeMethodFn = diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transformers-array/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transformers-array/client/client.gen.ts index d98de0bc6..329968d82 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transformers-array/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transformers-array/client/client.gen.ts @@ -228,7 +228,8 @@ export const createClient = (config: Config = {}): Client => { return options.body; } - return null; + // no body was provided + return undefined; } const makeMethodFn = diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transforms-read-write/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transforms-read-write/client/client.gen.ts index d98de0bc6..329968d82 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transforms-read-write/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transforms-read-write/client/client.gen.ts @@ -228,7 +228,8 @@ export const createClient = (config: Config = {}): Client => { return options.body; } - return null; + // no body was provided + return undefined; } const makeMethodFn = diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/body-response-text-plain/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/body-response-text-plain/client/client.gen.ts index d98de0bc6..329968d82 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/body-response-text-plain/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/body-response-text-plain/client/client.gen.ts @@ -228,7 +228,8 @@ export const createClient = (config: Config = {}): Client => { return options.body; } - return null; + // no body was provided + return undefined; } const makeMethodFn = diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-false/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-false/client/client.gen.ts index d98de0bc6..329968d82 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-false/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-false/client/client.gen.ts @@ -228,7 +228,8 @@ export const createClient = (config: Config = {}): Client => { return options.body; } - return null; + // no body was provided + return undefined; } const makeMethodFn = diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-number/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-number/client/client.gen.ts index d98de0bc6..329968d82 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-number/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-number/client/client.gen.ts @@ -228,7 +228,8 @@ export const createClient = (config: Config = {}): Client => { return options.body; } - return null; + // no body was provided + return undefined; } const makeMethodFn = diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-strict/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-strict/client/client.gen.ts index d98de0bc6..329968d82 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-strict/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-strict/client/client.gen.ts @@ -228,7 +228,8 @@ export const createClient = (config: Config = {}): Client => { return options.body; } - return null; + // no body was provided + return undefined; } const makeMethodFn = diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-string/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-string/client/client.gen.ts index d98de0bc6..329968d82 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-string/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-string/client/client.gen.ts @@ -228,7 +228,8 @@ export const createClient = (config: Config = {}): Client => { return options.body; } - return null; + // no body was provided + return undefined; } const makeMethodFn = diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/clean-false/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/clean-false/client/client.gen.ts index d98de0bc6..329968d82 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/clean-false/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/clean-false/client/client.gen.ts @@ -228,7 +228,8 @@ export const createClient = (config: Config = {}): Client => { return options.body; } - return null; + // no body was provided + return undefined; } const makeMethodFn = diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/default/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/default/client/client.gen.ts index d98de0bc6..329968d82 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/default/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/default/client/client.gen.ts @@ -228,7 +228,8 @@ export const createClient = (config: Config = {}): Client => { return options.body; } - return null; + // no body was provided + return undefined; } const makeMethodFn = diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/sdk-client-optional/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/sdk-client-optional/client/client.gen.ts index d98de0bc6..329968d82 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/sdk-client-optional/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/sdk-client-optional/client/client.gen.ts @@ -228,7 +228,8 @@ export const createClient = (config: Config = {}): Client => { return options.body; } - return null; + // no body was provided + return undefined; } const makeMethodFn = diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/sdk-client-required/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/sdk-client-required/client/client.gen.ts index d98de0bc6..329968d82 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/sdk-client-required/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/sdk-client-required/client/client.gen.ts @@ -228,7 +228,8 @@ export const createClient = (config: Config = {}): Client => { return options.body; } - return null; + // no body was provided + return undefined; } const makeMethodFn = diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/tsconfig-nodenext-sdk/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/tsconfig-nodenext-sdk/client/client.gen.ts index 95010de9a..6b56f4523 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/tsconfig-nodenext-sdk/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/tsconfig-nodenext-sdk/client/client.gen.ts @@ -228,7 +228,8 @@ export const createClient = (config: Config = {}): Client => { return options.body; } - return null; + // no body was provided + return undefined; } const makeMethodFn = diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-false/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-false/client/client.gen.ts index 8aafb006a..ad44b7fba 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-false/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-false/client/client.gen.ts @@ -216,7 +216,8 @@ export const createClient = (config: Config = {}): Client => { return options.body; } - return null; + // no body was provided + return undefined; } const makeMethodFn = diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-number/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-number/client/client.gen.ts index 8aafb006a..ad44b7fba 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-number/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-number/client/client.gen.ts @@ -216,7 +216,8 @@ export const createClient = (config: Config = {}): Client => { return options.body; } - return null; + // no body was provided + return undefined; } const makeMethodFn = diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-strict/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-strict/client/client.gen.ts index 8aafb006a..ad44b7fba 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-strict/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-strict/client/client.gen.ts @@ -216,7 +216,8 @@ export const createClient = (config: Config = {}): Client => { return options.body; } - return null; + // no body was provided + return undefined; } const makeMethodFn = diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-string/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-string/client/client.gen.ts index 8aafb006a..ad44b7fba 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-string/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-string/client/client.gen.ts @@ -216,7 +216,8 @@ export const createClient = (config: Config = {}): Client => { return options.body; } - return null; + // no body was provided + return undefined; } const makeMethodFn = diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/clean-false/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/clean-false/client/client.gen.ts index 8aafb006a..ad44b7fba 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/clean-false/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/clean-false/client/client.gen.ts @@ -216,7 +216,8 @@ export const createClient = (config: Config = {}): Client => { return options.body; } - return null; + // no body was provided + return undefined; } const makeMethodFn = diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/default/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/default/client/client.gen.ts index 8aafb006a..ad44b7fba 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/default/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/default/client/client.gen.ts @@ -216,7 +216,8 @@ export const createClient = (config: Config = {}): Client => { return options.body; } - return null; + // no body was provided + return undefined; } const makeMethodFn = diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/sdk-client-optional/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/sdk-client-optional/client/client.gen.ts index 8aafb006a..ad44b7fba 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/sdk-client-optional/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/sdk-client-optional/client/client.gen.ts @@ -216,7 +216,8 @@ export const createClient = (config: Config = {}): Client => { return options.body; } - return null; + // no body was provided + return undefined; } const makeMethodFn = diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/sdk-client-required/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/sdk-client-required/client/client.gen.ts index 8aafb006a..ad44b7fba 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/sdk-client-required/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/sdk-client-required/client/client.gen.ts @@ -216,7 +216,8 @@ export const createClient = (config: Config = {}): Client => { return options.body; } - return null; + // no body was provided + return undefined; } const makeMethodFn = diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/tsconfig-nodenext-sdk/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/tsconfig-nodenext-sdk/client/client.gen.ts index d4e51ed2a..f1bc43c02 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/tsconfig-nodenext-sdk/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/tsconfig-nodenext-sdk/client/client.gen.ts @@ -216,7 +216,8 @@ export const createClient = (config: Config = {}): Client => { return options.body; } - return null; + // no body was provided + return undefined; } const makeMethodFn = diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/headers/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/headers/client/client.gen.ts index d98de0bc6..329968d82 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/headers/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/headers/client/client.gen.ts @@ -228,7 +228,8 @@ export const createClient = (config: Config = {}): Client => { return options.body; } - return null; + // no body was provided + return undefined; } const makeMethodFn = diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/internal-name-conflict/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/internal-name-conflict/client/client.gen.ts index d98de0bc6..329968d82 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/internal-name-conflict/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/internal-name-conflict/client/client.gen.ts @@ -228,7 +228,8 @@ export const createClient = (config: Config = {}): Client => { return options.body; } - return null; + // no body was provided + return undefined; } const makeMethodFn = diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/pagination-ref/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/pagination-ref/client/client.gen.ts index d98de0bc6..329968d82 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/pagination-ref/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/pagination-ref/client/client.gen.ts @@ -228,7 +228,8 @@ export const createClient = (config: Config = {}): Client => { return options.body; } - return null; + // no body was provided + return undefined; } const makeMethodFn = diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/parameter-explode-false/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/parameter-explode-false/client/client.gen.ts index d98de0bc6..329968d82 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/parameter-explode-false/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/parameter-explode-false/client/client.gen.ts @@ -228,7 +228,8 @@ export const createClient = (config: Config = {}): Client => { return options.body; } - return null; + // no body was provided + return undefined; } const makeMethodFn = diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/client-fetch/sdk-nested-classes-instance/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/client-fetch/sdk-nested-classes-instance/client/client.gen.ts index d98de0bc6..329968d82 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/client-fetch/sdk-nested-classes-instance/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/client-fetch/sdk-nested-classes-instance/client/client.gen.ts @@ -228,7 +228,8 @@ export const createClient = (config: Config = {}): Client => { return options.body; } - return null; + // no body was provided + return undefined; } const makeMethodFn = diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/client-fetch/sdk-nested-classes/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/client-fetch/sdk-nested-classes/client/client.gen.ts index d98de0bc6..329968d82 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/client-fetch/sdk-nested-classes/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/client-fetch/sdk-nested-classes/client/client.gen.ts @@ -228,7 +228,8 @@ export const createClient = (config: Config = {}): Client => { return options.body; } - return null; + // no body was provided + return undefined; } const makeMethodFn = diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/sdk/default/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/sdk/default/client/client.gen.ts index d98de0bc6..329968d82 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/sdk/default/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/sdk/default/client/client.gen.ts @@ -228,7 +228,8 @@ export const createClient = (config: Config = {}): Client => { return options.body; } - return null; + // no body was provided + return undefined; } const makeMethodFn = diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/sdk/instance/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/sdk/instance/client/client.gen.ts index d98de0bc6..329968d82 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/sdk/instance/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/sdk/instance/client/client.gen.ts @@ -228,7 +228,8 @@ export const createClient = (config: Config = {}): Client => { return options.body; } - return null; + // no body was provided + return undefined; } const makeMethodFn = diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/sdk/throwOnError/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/sdk/throwOnError/client/client.gen.ts index d98de0bc6..329968d82 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/sdk/throwOnError/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/sdk/throwOnError/client/client.gen.ts @@ -228,7 +228,8 @@ export const createClient = (config: Config = {}): Client => { return options.body; } - return null; + // no body was provided + return undefined; } const makeMethodFn = diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/transformers/type-format-valibot/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/transformers/type-format-valibot/client/client.gen.ts index d98de0bc6..329968d82 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/transformers/type-format-valibot/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/transformers/type-format-valibot/client/client.gen.ts @@ -228,7 +228,8 @@ export const createClient = (config: Config = {}): Client => { return options.body; } - return null; + // no body was provided + return undefined; } const makeMethodFn = diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/transformers/type-format-zod/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/transformers/type-format-zod/client/client.gen.ts index d98de0bc6..329968d82 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/transformers/type-format-zod/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/transformers/type-format-zod/client/client.gen.ts @@ -228,7 +228,8 @@ export const createClient = (config: Config = {}): Client => { return options.body; } - return null; + // no body was provided + return undefined; } const makeMethodFn = diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/typescript/transforms-read-write-custom-name/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/typescript/transforms-read-write-custom-name/client/client.gen.ts index d98de0bc6..329968d82 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/typescript/transforms-read-write-custom-name/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/typescript/transforms-read-write-custom-name/client/client.gen.ts @@ -228,7 +228,8 @@ export const createClient = (config: Config = {}): Client => { return options.body; } - return null; + // no body was provided + return undefined; } const makeMethodFn = diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/typescript/transforms-read-write-ignore/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/typescript/transforms-read-write-ignore/client/client.gen.ts index d98de0bc6..329968d82 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/typescript/transforms-read-write-ignore/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/typescript/transforms-read-write-ignore/client/client.gen.ts @@ -228,7 +228,8 @@ export const createClient = (config: Config = {}): Client => { return options.body; } - return null; + // no body was provided + return undefined; } const makeMethodFn = diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@pinia/colada/fetch/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@pinia/colada/fetch/client/client.gen.ts index d98de0bc6..329968d82 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@pinia/colada/fetch/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@pinia/colada/fetch/client/client.gen.ts @@ -228,7 +228,8 @@ export const createClient = (config: Config = {}): Client => { return options.body; } - return null; + // no body was provided + return undefined; } const makeMethodFn = diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@pinia/colada/group-by-tag/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@pinia/colada/group-by-tag/client/client.gen.ts index d98de0bc6..329968d82 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@pinia/colada/group-by-tag/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@pinia/colada/group-by-tag/client/client.gen.ts @@ -228,7 +228,8 @@ export const createClient = (config: Config = {}): Client => { return options.body; } - return null; + // no body was provided + return undefined; } const makeMethodFn = diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/angular-query-experimental/asClass/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/angular-query-experimental/asClass/client/client.gen.ts index d98de0bc6..329968d82 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/angular-query-experimental/asClass/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/angular-query-experimental/asClass/client/client.gen.ts @@ -228,7 +228,8 @@ export const createClient = (config: Config = {}): Client => { return options.body; } - return null; + // no body was provided + return undefined; } const makeMethodFn = diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/angular-query-experimental/fetch/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/angular-query-experimental/fetch/client/client.gen.ts index d98de0bc6..329968d82 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/angular-query-experimental/fetch/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/angular-query-experimental/fetch/client/client.gen.ts @@ -228,7 +228,8 @@ export const createClient = (config: Config = {}): Client => { return options.body; } - return null; + // no body was provided + return undefined; } const makeMethodFn = diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/angular-query-experimental/name-builder/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/angular-query-experimental/name-builder/client/client.gen.ts index d98de0bc6..329968d82 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/angular-query-experimental/name-builder/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/angular-query-experimental/name-builder/client/client.gen.ts @@ -228,7 +228,8 @@ export const createClient = (config: Config = {}): Client => { return options.body; } - return null; + // no body was provided + return undefined; } const makeMethodFn = diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/react-query/asClass/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/react-query/asClass/client/client.gen.ts index d98de0bc6..329968d82 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/react-query/asClass/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/react-query/asClass/client/client.gen.ts @@ -228,7 +228,8 @@ export const createClient = (config: Config = {}): Client => { return options.body; } - return null; + // no body was provided + return undefined; } const makeMethodFn = diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/react-query/fetch/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/react-query/fetch/client/client.gen.ts index d98de0bc6..329968d82 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/react-query/fetch/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/react-query/fetch/client/client.gen.ts @@ -228,7 +228,8 @@ export const createClient = (config: Config = {}): Client => { return options.body; } - return null; + // no body was provided + return undefined; } const makeMethodFn = diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/react-query/name-builder/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/react-query/name-builder/client/client.gen.ts index d98de0bc6..329968d82 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/react-query/name-builder/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/react-query/name-builder/client/client.gen.ts @@ -228,7 +228,8 @@ export const createClient = (config: Config = {}): Client => { return options.body; } - return null; + // no body was provided + return undefined; } const makeMethodFn = diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/solid-query/asClass/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/solid-query/asClass/client/client.gen.ts index d98de0bc6..329968d82 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/solid-query/asClass/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/solid-query/asClass/client/client.gen.ts @@ -228,7 +228,8 @@ export const createClient = (config: Config = {}): Client => { return options.body; } - return null; + // no body was provided + return undefined; } const makeMethodFn = diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/solid-query/fetch/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/solid-query/fetch/client/client.gen.ts index d98de0bc6..329968d82 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/solid-query/fetch/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/solid-query/fetch/client/client.gen.ts @@ -228,7 +228,8 @@ export const createClient = (config: Config = {}): Client => { return options.body; } - return null; + // no body was provided + return undefined; } const makeMethodFn = diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/solid-query/name-builder/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/solid-query/name-builder/client/client.gen.ts index d98de0bc6..329968d82 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/solid-query/name-builder/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/solid-query/name-builder/client/client.gen.ts @@ -228,7 +228,8 @@ export const createClient = (config: Config = {}): Client => { return options.body; } - return null; + // no body was provided + return undefined; } const makeMethodFn = diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/svelte-query/asClass/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/svelte-query/asClass/client/client.gen.ts index d98de0bc6..329968d82 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/svelte-query/asClass/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/svelte-query/asClass/client/client.gen.ts @@ -228,7 +228,8 @@ export const createClient = (config: Config = {}): Client => { return options.body; } - return null; + // no body was provided + return undefined; } const makeMethodFn = diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/svelte-query/fetch/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/svelte-query/fetch/client/client.gen.ts index d98de0bc6..329968d82 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/svelte-query/fetch/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/svelte-query/fetch/client/client.gen.ts @@ -228,7 +228,8 @@ export const createClient = (config: Config = {}): Client => { return options.body; } - return null; + // no body was provided + return undefined; } const makeMethodFn = diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/svelte-query/name-builder/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/svelte-query/name-builder/client/client.gen.ts index d98de0bc6..329968d82 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/svelte-query/name-builder/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/svelte-query/name-builder/client/client.gen.ts @@ -228,7 +228,8 @@ export const createClient = (config: Config = {}): Client => { return options.body; } - return null; + // no body was provided + return undefined; } const makeMethodFn = diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/vue-query/asClass/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/vue-query/asClass/client/client.gen.ts index d98de0bc6..329968d82 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/vue-query/asClass/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/vue-query/asClass/client/client.gen.ts @@ -228,7 +228,8 @@ export const createClient = (config: Config = {}): Client => { return options.body; } - return null; + // no body was provided + return undefined; } const makeMethodFn = diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/vue-query/fetch/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/vue-query/fetch/client/client.gen.ts index d98de0bc6..329968d82 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/vue-query/fetch/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/vue-query/fetch/client/client.gen.ts @@ -228,7 +228,8 @@ export const createClient = (config: Config = {}): Client => { return options.body; } - return null; + // no body was provided + return undefined; } const makeMethodFn = diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/vue-query/name-builder/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/vue-query/name-builder/client/client.gen.ts index d98de0bc6..329968d82 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/vue-query/name-builder/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/vue-query/name-builder/client/client.gen.ts @@ -228,7 +228,8 @@ export const createClient = (config: Config = {}): Client => { return options.body; } - return null; + // no body was provided + return undefined; } const makeMethodFn = diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-api-key/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-api-key/client/client.gen.ts index d98de0bc6..329968d82 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-api-key/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-api-key/client/client.gen.ts @@ -228,7 +228,8 @@ export const createClient = (config: Config = {}): Client => { return options.body; } - return null; + // no body was provided + return undefined; } const makeMethodFn = diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-false/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-false/client/client.gen.ts index d98de0bc6..329968d82 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-false/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-false/client/client.gen.ts @@ -228,7 +228,8 @@ export const createClient = (config: Config = {}): Client => { return options.body; } - return null; + // no body was provided + return undefined; } const makeMethodFn = diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-http-bearer/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-http-bearer/client/client.gen.ts index d98de0bc6..329968d82 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-http-bearer/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-http-bearer/client/client.gen.ts @@ -228,7 +228,8 @@ export const createClient = (config: Config = {}): Client => { return options.body; } - return null; + // no body was provided + return undefined; } const makeMethodFn = diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-oauth2/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-oauth2/client/client.gen.ts index d98de0bc6..329968d82 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-oauth2/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-oauth2/client/client.gen.ts @@ -228,7 +228,8 @@ export const createClient = (config: Config = {}): Client => { return options.body; } - return null; + // no body was provided + return undefined; } const makeMethodFn = diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-open-id-connect/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-open-id-connect/client/client.gen.ts index d98de0bc6..329968d82 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-open-id-connect/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-open-id-connect/client/client.gen.ts @@ -228,7 +228,8 @@ export const createClient = (config: Config = {}): Client => { return options.body; } - return null; + // no body was provided + return undefined; } const makeMethodFn = diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/servers/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/servers/client/client.gen.ts index d98de0bc6..329968d82 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/servers/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/servers/client/client.gen.ts @@ -228,7 +228,8 @@ export const createClient = (config: Config = {}): Client => { return options.body; } - return null; + // no body was provided + return undefined; } const makeMethodFn = diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-fetch/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-fetch/client/client.gen.ts index d98de0bc6..329968d82 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-fetch/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-fetch/client/client.gen.ts @@ -228,7 +228,8 @@ export const createClient = (config: Config = {}): Client => { return options.body; } - return null; + // no body was provided + return undefined; } const makeMethodFn = diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-next/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-next/client/client.gen.ts index 8aafb006a..ad44b7fba 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-next/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-next/client/client.gen.ts @@ -216,7 +216,8 @@ export const createClient = (config: Config = {}): Client => { return options.body; } - return null; + // no body was provided + return undefined; } const makeMethodFn = diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-all-of/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-all-of/client/client.gen.ts index d98de0bc6..329968d82 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-all-of/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-all-of/client/client.gen.ts @@ -228,7 +228,8 @@ export const createClient = (config: Config = {}): Client => { return options.body; } - return null; + // no body was provided + return undefined; } const makeMethodFn = diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-any-of-null/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-any-of-null/client/client.gen.ts index d98de0bc6..329968d82 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-any-of-null/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-any-of-null/client/client.gen.ts @@ -228,7 +228,8 @@ export const createClient = (config: Config = {}): Client => { return options.body; } - return null; + // no body was provided + return undefined; } const makeMethodFn = diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-array/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-array/client/client.gen.ts index d98de0bc6..329968d82 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-array/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-array/client/client.gen.ts @@ -228,7 +228,8 @@ export const createClient = (config: Config = {}): Client => { return options.body; } - return null; + // no body was provided + return undefined; } const makeMethodFn = diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transforms-read-write/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transforms-read-write/client/client.gen.ts index d98de0bc6..329968d82 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transforms-read-write/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transforms-read-write/client/client.gen.ts @@ -228,7 +228,8 @@ export const createClient = (config: Config = {}): Client => { return options.body; } - return null; + // no body was provided + return undefined; } const makeMethodFn = diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/plugins/@tanstack/meta/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/plugins/@tanstack/meta/client/client.gen.ts index d98de0bc6..329968d82 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/plugins/@tanstack/meta/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/plugins/@tanstack/meta/client/client.gen.ts @@ -228,7 +228,8 @@ export const createClient = (config: Config = {}): Client => { return options.body; } - return null; + // no body was provided + return undefined; } const makeMethodFn = diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/test/generated/v3_no_index/client/client.gen.ts.snap b/packages/openapi-ts-tests/main/test/__snapshots__/test/generated/v3_no_index/client/client.gen.ts.snap index d98de0bc6..329968d82 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/test/generated/v3_no_index/client/client.gen.ts.snap +++ b/packages/openapi-ts-tests/main/test/__snapshots__/test/generated/v3_no_index/client/client.gen.ts.snap @@ -228,7 +228,8 @@ export const createClient = (config: Config = {}): Client => { return options.body; } - return null; + // no body was provided + return undefined; } const makeMethodFn = -- 2.51.2 From 14af1886d6d66ca7e2de9ebd07d45be536f40d11 Mon Sep 17 00:00:00 2001 From: carson2222 Date: Wed, 3 Sep 2025 13:14:11 +0200 Subject: [PATCH 18/46] chore: bump new version of @hey-api/json-schema-ref-parser 1.1.0 --- .../__snapshots__/2.0.x/external/types.gen.ts | 20 +++++++------- .../__snapshots__/3.0.x/external/types.gen.ts | 26 +++++++++---------- .../__snapshots__/3.1.x/external/types.gen.ts | 26 +++++++++---------- packages/openapi-ts/package.json | 2 +- pnpm-lock.yaml | 10 +++---- 5 files changed, 42 insertions(+), 42 deletions(-) diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/external/types.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/external/types.gen.ts index 64b3aee0f..8f48ac086 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/external/types.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/external/types.gen.ts @@ -115,32 +115,32 @@ export type ExternalAllOfSchema = ExternalSharedExternalSharedModel & { */ export type ExternalAnyOfSchema = unknown; -export type ExternalSharedExternalSharedModel = { - id: string; - name?: string; -}; - -export type ExternalSharedExternalSharedModelWithUuid = string; - export type ExternalSharedExternalNested = { inner?: { deep?: string; }; }; +export type ExternalSharedDeep = string; + export type ExternalSharedExternalNestedNumeric = { 0?: { 1?: string; }; }; +export type ExternalShared1 = string; + +export type ExternalSharedExternalSharedModel = { + id: string; + name?: string; +}; + export type ExternalSharedId = string; export type ExternalSharedName = string; -export type ExternalSharedDeep = string; - -export type ExternalShared1 = string; +export type ExternalSharedExternalSharedModelWithUuid = string; export type GetExternalModelData = { body?: never; diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/external/types.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/external/types.gen.ts index 1e31fd7d4..3c38c87e1 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/external/types.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/external/types.gen.ts @@ -115,15 +115,6 @@ export type ExternalAllOfSchema = ExternalSharedExternalSharedModel & { */ export type ExternalAnyOfSchema = ExternalSharedExternalNested | ExternalSharedExternalNestedNumeric; -export type ExternalSharedExternalSharedModelWithUuid = string; - -export type ExternalSharedExternalSharedModel = { - id: string; - name?: string; -}; - -export type ExternalSharedId = string; - export type ExternalSharedExternalNested = { inner?: { deep?: string; @@ -132,16 +123,25 @@ export type ExternalSharedExternalNested = { export type ExternalSharedDeep = string; -export type ExternalShared1 = string; - -export type ExternalSharedName = string; - export type ExternalSharedExternalNestedNumeric = { 0?: { 1?: string; }; }; +export type ExternalShared1 = string; + +export type ExternalSharedExternalSharedModel = { + id: string; + name?: string; +}; + +export type ExternalSharedId = string; + +export type ExternalSharedName = string; + +export type ExternalSharedExternalSharedModelWithUuid = string; + export type ExternalIdParam = ExternalSharedId; export type ExternalUuidParam = ExternalSharedExternalSharedModelWithUuid; diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/external/types.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/external/types.gen.ts index c60dd5c3b..90d15b680 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/external/types.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/external/types.gen.ts @@ -142,15 +142,6 @@ export type ExternalAllOfSchema = ExternalSharedExternalSharedModel & { */ export type ExternalAnyOfSchema = ExternalSharedExternalNested | ExternalSharedExternalNestedNumeric; -export type ExternalSharedExternalSharedModelWithUuid = string; - -export type ExternalSharedExternalSharedModel = { - id: string; - name?: string; -}; - -export type ExternalSharedId = string; - export type ExternalSharedExternalNested = { inner?: { deep?: string; @@ -159,16 +150,25 @@ export type ExternalSharedExternalNested = { export type ExternalSharedDeep = string; -export type ExternalShared1 = string; - -export type ExternalSharedName = string; - export type ExternalSharedExternalNestedNumeric = { 0?: { 1?: string; }; }; +export type ExternalShared1 = string; + +export type ExternalSharedExternalSharedModel = { + id: string; + name?: string; +}; + +export type ExternalSharedId = string; + +export type ExternalSharedName = string; + +export type ExternalSharedExternalSharedModelWithUuid = string; + export type ExternalIdParam = ExternalSharedId; export type ExternalUuidParam = ExternalSharedExternalSharedModelWithUuid; diff --git a/packages/openapi-ts/package.json b/packages/openapi-ts/package.json index 5afa8c1b8..bd78319f3 100644 --- a/packages/openapi-ts/package.json +++ b/packages/openapi-ts/package.json @@ -89,7 +89,7 @@ }, "dependencies": { "@hey-api/codegen-core": "workspace:^0.0.1", - "@hey-api/json-schema-ref-parser": "1.0.9", + "@hey-api/json-schema-ref-parser": "1.1.0", "ansi-colors": "4.1.3", "c12": "2.0.1", "color-support": "1.1.3", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 639af33cf..e2aa1d656 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1174,8 +1174,8 @@ importers: specifier: workspace:^0.0.1 version: link:../codegen-core '@hey-api/json-schema-ref-parser': - specifier: 1.0.7 - version: 1.0.7 + specifier: 1.1.0 + version: 1.1.0 ansi-colors: specifier: 4.1.3 version: 4.1.3 @@ -3673,8 +3673,8 @@ packages: '@fontsource/fira-mono@5.0.0': resolution: {integrity: sha512-IsinH/oLYJyv/sQv7SbKmjoAXZsSjm6Q1Tz5GBBXCXi3Jg9MzXmKvWm9bSLC8lFI6CDsi8GkH/DAgZ98t8bhTQ==} - '@hey-api/json-schema-ref-parser@1.0.7': - resolution: {integrity: sha512-XYZIDkzp16pf5d5ADLgoT2efuuIzkIGCtGVXNlexzxQaOIgYAwWON+7Tt77ChXMC/2Cq0qe57hSx1x6KwZyWcA==} + '@hey-api/json-schema-ref-parser@1.1.0': + resolution: {integrity: sha512-+5eg9pgAAM9oSqJQuUtfTKbLz8yieFKN91myyXiLnprqFj8ROfxUKJLr9DKq/hGKyybKT1WxFSetDqCFm80pCA==} engines: {node: '>= 16'} '@humanfs/core@0.19.1': @@ -16803,7 +16803,7 @@ snapshots: '@fontsource/fira-mono@5.0.0': {} - '@hey-api/json-schema-ref-parser@1.0.7': + '@hey-api/json-schema-ref-parser@1.1.0': dependencies: '@jsdevtools/ono': 7.1.3 '@types/json-schema': 7.0.15 -- 2.51.2 From b2b6998a1d32718e023615d26d16fa698e94159c Mon Sep 17 00:00:00 2001 From: Fransis Young Date: Thu, 4 Sep 2025 00:32:49 -0400 Subject: [PATCH 19/46] fix(client-angular)!: ensures valid serialized or unserialized body is sent with request BREAKING CHANGE: options.serializedBody is undefined by default, and will only be assigned a value when options.bodySerializer is defined refs: #2553 --- .../3.1.x/sse-angular/client/client.gen.ts | 27 +++++- .../client-angular/__tests__/client.test.ts | 90 ++++++++++++++++++- .../@hey-api/client-angular/bundle/client.ts | 27 +++++- 3 files changed, 135 insertions(+), 9 deletions(-) diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-angular/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-angular/client/client.gen.ts index 93b77ace4..9c5e817f3 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-angular/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-angular/client/client.gen.ts @@ -69,7 +69,7 @@ export const createClient = (config: Config = {}): Client => { ...options, headers: mergeHeaders(_config.headers, options.headers), httpClient: options.httpClient ?? _config.httpClient, - serializedBody: options.body as any, + serializedBody: undefined, }; if (!opts.httpClient) { @@ -83,12 +83,12 @@ export const createClient = (config: Config = {}): Client => { } } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.serializedBody === undefined || opts.serializedBody === '') { + if (opts.body === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); } @@ -97,7 +97,7 @@ export const createClient = (config: Config = {}): Client => { const req = new HttpRequest( opts.method ?? 'GET', url, - opts.serializedBody || null, + getValidRequestBody(opts), { redirect: 'follow', ...opts, @@ -201,6 +201,25 @@ export const createClient = (config: Config = {}): Client => { } }; + function getValidRequestBody(options: ResolvedRequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + return undefined; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts/src/plugins/@hey-api/client-angular/__tests__/client.test.ts b/packages/openapi-ts/src/plugins/@hey-api/client-angular/__tests__/client.test.ts index 528434d2b..6de439b6b 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/client-angular/__tests__/client.test.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/client-angular/__tests__/client.test.ts @@ -1,4 +1,6 @@ -import { describe, expect, it } from 'vitest'; +import type { HttpClient } from '@angular/common/http'; +import { HttpHeaders } from '@angular/common/http'; +import { describe, expect, it, vi } from 'vitest'; import { createClient } from '../bundle/client'; @@ -68,3 +70,89 @@ describe('buildUrl', () => { expect(client.buildUrl(options)).toBe(url); }); }); + +describe('unserialized request body handling', () => { + const client = createClient({ baseUrl: 'https://example.com' }); + + const scenarios = [ + { body: 0 }, + { body: false }, + { body: 'test string' }, + { body: '' }, + ]; + + it.each(scenarios)( + 'handles plain text body with $body value', + async ({ body }) => { + const spy = vi.spyOn(HttpHeaders.prototype, 'delete'); + + const request = client.requestOptions({ + body, + bodySerializer: null, + httpClient: vi.fn() as Partial as HttpClient, + url: '/test', + }); + + expect(request).toMatchObject( + expect.objectContaining({ + body, + }), + ); + + expect(spy).toHaveBeenCalledTimes(0); + }, + ); +}); + +describe('requestOptions serialized request body handling', () => { + const client = createClient({ baseUrl: 'https://example.com' }); + + const scenarios = [ + { + body: '', + expectBodyValue: false, + expectDeleteHeader: 1, + serializedBody: '', + }, + { + body: 0, + expectBodyValue: true, + expectDeleteHeader: 0, + serializedBody: 0, + }, + { + body: false, + expectBodyValue: true, + expectDeleteHeader: 0, + serializedBody: false, + }, + { + body: {}, + expectBodyValue: true, + expectDeleteHeader: 0, + serializedBody: '{"key":"value"}', + }, + ]; + + it.each(scenarios)( + 'handles $serializedBody serializedBody value', + async ({ body, expectBodyValue, expectDeleteHeader, serializedBody }) => { + const spy = vi.spyOn(HttpHeaders.prototype, 'delete'); + + const request = client.requestOptions({ + body, + bodySerializer: () => serializedBody, + httpClient: vi.fn() as Partial as HttpClient, + url: '/test', + }); + + expect(request).toMatchObject( + expect.objectContaining({ + body: expectBodyValue ? serializedBody : null, + }), + ); + + expect(spy).toHaveBeenCalledTimes(expectDeleteHeader); + }, + ); +}); diff --git a/packages/openapi-ts/src/plugins/@hey-api/client-angular/bundle/client.ts b/packages/openapi-ts/src/plugins/@hey-api/client-angular/bundle/client.ts index 9a9b6b7b6..6dd96d7ab 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/client-angular/bundle/client.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/client-angular/bundle/client.ts @@ -67,7 +67,7 @@ export const createClient = (config: Config = {}): Client => { ...options, headers: mergeHeaders(_config.headers, options.headers), httpClient: options.httpClient ?? _config.httpClient, - serializedBody: options.body as any, + serializedBody: undefined, }; if (!opts.httpClient) { @@ -81,12 +81,12 @@ export const createClient = (config: Config = {}): Client => { } } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.serializedBody = opts.bodySerializer(opts.body); } // remove Content-Type header if body is empty to avoid sending invalid requests - if (opts.serializedBody === undefined || opts.serializedBody === '') { + if (opts.body === undefined || opts.serializedBody === '') { opts.headers.delete('Content-Type'); } @@ -95,7 +95,7 @@ export const createClient = (config: Config = {}): Client => { const req = new HttpRequest( opts.method ?? 'GET', url, - opts.serializedBody || null, + getValidRequestBody(opts), { redirect: 'follow', ...opts, @@ -199,6 +199,25 @@ export const createClient = (config: Config = {}): Client => { } }; + function getValidRequestBody(options: ResolvedRequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + return undefined; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); -- 2.51.2 From c97e7a8c8b1d24747356feb9a15840c296a9c1c8 Mon Sep 17 00:00:00 2001 From: carson <137903252+carson2222@users.noreply.github.com> Date: Thu, 4 Sep 2025 08:47:27 +0200 Subject: [PATCH 20/46] Create sharp-rules-eat.md --- .changeset/sharp-rules-eat.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/sharp-rules-eat.md diff --git a/.changeset/sharp-rules-eat.md b/.changeset/sharp-rules-eat.md new file mode 100644 index 000000000..6bdbe32a4 --- /dev/null +++ b/.changeset/sharp-rules-eat.md @@ -0,0 +1,5 @@ +--- +"@test/openapi-ts": patch +--- + +fix(parser): improve $ref handling -- 2.51.2 From 8b8c368f878ed967dfc20e419e0648580d4d7772 Mon Sep 17 00:00:00 2001 From: carson <137903252+carson2222@users.noreply.github.com> Date: Thu, 4 Sep 2025 13:46:16 +0200 Subject: [PATCH 21/46] Update sharp-rules-eat.md --- .changeset/sharp-rules-eat.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.changeset/sharp-rules-eat.md b/.changeset/sharp-rules-eat.md index 6bdbe32a4..96806360d 100644 --- a/.changeset/sharp-rules-eat.md +++ b/.changeset/sharp-rules-eat.md @@ -1,5 +1,5 @@ --- -"@test/openapi-ts": patch +"@hey-api/openapi-ts": patch --- fix(parser): improve $ref handling -- 2.51.2 From e5bf56b372eaffb38c42dfb828c3301964f106fd Mon Sep 17 00:00:00 2001 From: Dmitriy Brolnickij Date: Thu, 4 Sep 2025 19:54:28 +0700 Subject: [PATCH 22/46] fix(pinia-colada): optional `options` in mutation factory --- .../src/plugins/@pinia/colada/mutationOptions.ts | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/packages/openapi-ts/src/plugins/@pinia/colada/mutationOptions.ts b/packages/openapi-ts/src/plugins/@pinia/colada/mutationOptions.ts index 9e278ed6b..0b34c9b30 100644 --- a/packages/openapi-ts/src/plugins/@pinia/colada/mutationOptions.ts +++ b/packages/openapi-ts/src/plugins/@pinia/colada/mutationOptions.ts @@ -3,10 +3,7 @@ import type ts from 'typescript'; import type { GeneratedFile } from '../../../generate/file'; import type { IR } from '../../../ir/types'; import { tsc } from '../../../tsc'; -import { - createOperationComment, - isOperationOptionsRequired, -} from '../../shared/utils/operation'; +import { createOperationComment } from '../../shared/utils/operation'; import { handleMeta } from './meta'; import type { PluginState } from './state'; import type { PiniaColadaPlugin } from './types'; @@ -129,11 +126,6 @@ export const createMutationOptions = ({ }); } - const isRequiredOptionsForMutation = isOperationOptionsRequired({ - context: plugin.context, - operation, - }); - const statement = tsc.constVariable({ comment: plugin.config.comments ? createOperationComment({ operation }) @@ -142,9 +134,9 @@ export const createMutationOptions = ({ expression: tsc.arrowFunction({ parameters: [ { - isRequired: isRequiredOptionsForMutation, + isRequired: false, name: 'options', - type: typeData, + type: `Partial<${typeData}>`, }, ], // TODO: better types syntax -- 2.51.2 From 413744572f403f605c0ba6a69f3614da69fc6f15 Mon Sep 17 00:00:00 2001 From: Dmitriy Brolnickij Date: Thu, 4 Sep 2025 19:56:30 +0700 Subject: [PATCH 23/46] chore: init changeset --- .changeset/optional-options-in-mutation-factory.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/optional-options-in-mutation-factory.md diff --git a/.changeset/optional-options-in-mutation-factory.md b/.changeset/optional-options-in-mutation-factory.md new file mode 100644 index 000000000..573246732 --- /dev/null +++ b/.changeset/optional-options-in-mutation-factory.md @@ -0,0 +1,5 @@ +--- +"@hey-api/openapi-ts": patch +--- + +fix(pinia-colada): optional `options` in mutation factory -- 2.51.2 From 9bcf2a869efc10aaf00d074b12a03dfc0509454a Mon Sep 17 00:00:00 2001 From: Dmitriy Brolnickij Date: Thu, 4 Sep 2025 19:57:38 +0700 Subject: [PATCH 24/46] test(pinia-colada): update snapshots --- .../@pinia/colada/fetch/@pinia/colada.gen.ts | 40 ++++++------- .../@pinia/colada/Defaults.gen.ts | 4 +- .../@pinia/colada/Descriptions.gen.ts | 2 +- .../@pinia/colada/Duplicate.gen.ts | 6 +- .../group-by-tag/@pinia/colada/Error.gen.ts | 2 +- .../group-by-tag/@pinia/colada/Header.gen.ts | 2 +- ...05\303\266\303\264\303\252\303\212.gen.ts" | 2 +- .../@pinia/colada/Parameters.gen.ts | 4 +- .../@pinia/colada/Response.gen.ts | 4 +- .../group-by-tag/@pinia/colada/Simple.gen.ts | 8 +-- .../group-by-tag/@pinia/colada/default.gen.ts | 6 +- .../@pinia/colada/fetch/@pinia/colada.gen.ts | 58 +++++++++---------- .../group-by-tag/@pinia/colada/Complex.gen.ts | 2 +- .../@pinia/colada/Defaults.gen.ts | 4 +- .../@pinia/colada/Deprecated.gen.ts | 2 +- .../@pinia/colada/Descriptions.gen.ts | 2 +- .../@pinia/colada/Duplicate.gen.ts | 6 +- .../group-by-tag/@pinia/colada/Error.gen.ts | 2 +- .../@pinia/colada/FormData.gen.ts | 2 +- .../group-by-tag/@pinia/colada/Header.gen.ts | 2 +- ...05\303\266\303\264\303\252\303\212.gen.ts" | 4 +- .../@pinia/colada/Parameters.gen.ts | 8 +-- .../@pinia/colada/RequestBody.gen.ts | 2 +- .../@pinia/colada/Response.gen.ts | 4 +- .../group-by-tag/@pinia/colada/Simple.gen.ts | 8 +-- .../group-by-tag/@pinia/colada/Upload.gen.ts | 2 +- .../group-by-tag/@pinia/colada/default.gen.ts | 6 +- .../@pinia/colada/multipart.gen.ts | 2 +- .../@pinia/colada/fetch/@pinia/colada.gen.ts | 58 +++++++++---------- .../group-by-tag/@pinia/colada/Complex.gen.ts | 2 +- .../@pinia/colada/Defaults.gen.ts | 4 +- .../@pinia/colada/Deprecated.gen.ts | 2 +- .../@pinia/colada/Descriptions.gen.ts | 2 +- .../@pinia/colada/Duplicate.gen.ts | 6 +- .../group-by-tag/@pinia/colada/Error.gen.ts | 2 +- .../@pinia/colada/FormData.gen.ts | 2 +- .../group-by-tag/@pinia/colada/Header.gen.ts | 2 +- ...05\303\266\303\264\303\252\303\212.gen.ts" | 4 +- .../@pinia/colada/Parameters.gen.ts | 8 +-- .../@pinia/colada/RequestBody.gen.ts | 2 +- .../@pinia/colada/Response.gen.ts | 4 +- .../group-by-tag/@pinia/colada/Simple.gen.ts | 8 +-- .../group-by-tag/@pinia/colada/Upload.gen.ts | 2 +- .../group-by-tag/@pinia/colada/default.gen.ts | 6 +- .../@pinia/colada/multipart.gen.ts | 2 +- 45 files changed, 156 insertions(+), 156 deletions(-) diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@pinia/colada/fetch/@pinia/colada.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@pinia/colada/fetch/@pinia/colada.gen.ts index d76d2345b..da88d80b0 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@pinia/colada/fetch/@pinia/colada.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@pinia/colada/fetch/@pinia/colada.gen.ts @@ -55,7 +55,7 @@ export const serviceWithEmptyTagQuery = (options?: Options): UseMutationOptions, Error> => { +export const patchApiVbyApiVersionNoTagMutation = (options?: Partial>): UseMutationOptions, Error> => { return { mutation: async (fnOptions) => { const { data } = await patchApiVbyApiVersionNoTag({ @@ -68,7 +68,7 @@ export const patchApiVbyApiVersionNoTagMutation = (options?: Options): UseMutationOptions, Error> => { +export const fooWowMutation = (options?: Partial>): UseMutationOptions, Error> => { return { mutation: async (fnOptions) => { const { data } = await fooWow({ @@ -81,7 +81,7 @@ export const fooWowMutation = (options?: Options): UseMutationOption }; }; -export const deleteCallWithoutParametersAndResponseMutation = (options?: Options): UseMutationOptions, Error> => { +export const deleteCallWithoutParametersAndResponseMutation = (options?: Partial>): UseMutationOptions, Error> => { return { mutation: async (fnOptions) => { const { data } = await deleteCallWithoutParametersAndResponse({ @@ -110,7 +110,7 @@ export const getCallWithoutParametersAndResponseQuery = (options?: Options): UseMutationOptions, Error> => { +export const patchCallWithoutParametersAndResponseMutation = (options?: Partial>): UseMutationOptions, Error> => { return { mutation: async (fnOptions) => { const { data } = await patchCallWithoutParametersAndResponse({ @@ -123,7 +123,7 @@ export const patchCallWithoutParametersAndResponseMutation = (options?: Options< }; }; -export const postCallWithoutParametersAndResponseMutation = (options?: Options): UseMutationOptions, Error> => { +export const postCallWithoutParametersAndResponseMutation = (options?: Partial>): UseMutationOptions, Error> => { return { mutation: async (fnOptions) => { const { data } = await postCallWithoutParametersAndResponse({ @@ -136,7 +136,7 @@ export const postCallWithoutParametersAndResponseMutation = (options?: Options

): UseMutationOptions, Error> => { +export const putCallWithoutParametersAndResponseMutation = (options?: Partial>): UseMutationOptions, Error> => { return { mutation: async (fnOptions) => { const { data } = await putCallWithoutParametersAndResponse({ @@ -149,7 +149,7 @@ export const putCallWithoutParametersAndResponseMutation = (options?: Options): UseMutationOptions, Error> => { +export const callWithDescriptionsMutation = (options?: Partial>): UseMutationOptions, Error> => { return { mutation: async (fnOptions) => { const { data } = await callWithDescriptions({ @@ -162,7 +162,7 @@ export const callWithDescriptionsMutation = (options?: Options): UseMutationOptions, Error> => { +export const callWithParametersMutation = (options?: Partial>): UseMutationOptions, Error> => { return { mutation: async (fnOptions) => { const { data } = await callWithParameters({ @@ -175,7 +175,7 @@ export const callWithParametersMutation = (options: Options): UseMutationOptions, Error> => { +export const callWithWeirdParameterNamesMutation = (options?: Partial>): UseMutationOptions, Error> => { return { mutation: async (fnOptions) => { const { data } = await callWithWeirdParameterNames({ @@ -204,7 +204,7 @@ export const callWithDefaultParametersQuery = (options: Options): UseMutationOptions, Error> => { +export const callWithDefaultOptionalParametersMutation = (options?: Partial>): UseMutationOptions, Error> => { return { mutation: async (fnOptions) => { const { data } = await callWithDefaultOptionalParameters({ @@ -217,7 +217,7 @@ export const callWithDefaultOptionalParametersMutation = (options?: Options): UseMutationOptions, Error> => { +export const callToTestOrderOfParamsMutation = (options?: Partial>): UseMutationOptions, Error> => { return { mutation: async (fnOptions) => { const { data } = await callToTestOrderOfParams({ @@ -230,7 +230,7 @@ export const callToTestOrderOfParamsMutation = (options: Options): UseMutationOptions, Error> => { +export const duplicateNameMutation = (options?: Partial>): UseMutationOptions, Error> => { return { mutation: async (fnOptions) => { const { data } = await duplicateName({ @@ -259,7 +259,7 @@ export const duplicateName2Query = (options?: Options): UseQ }; }; -export const duplicateName3Mutation = (options?: Options): UseMutationOptions, Error> => { +export const duplicateName3Mutation = (options?: Partial>): UseMutationOptions, Error> => { return { mutation: async (fnOptions) => { const { data } = await duplicateName3({ @@ -272,7 +272,7 @@ export const duplicateName3Mutation = (options?: Options): U }; }; -export const duplicateName4Mutation = (options?: Options): UseMutationOptions, Error> => { +export const duplicateName4Mutation = (options?: Partial>): UseMutationOptions, Error> => { return { mutation: async (fnOptions) => { const { data } = await duplicateName4({ @@ -365,7 +365,7 @@ export const callWithResponseQuery = (options?: Options): }; }; -export const callWithDuplicateResponsesMutation = (options?: Options): UseMutationOptions, CallWithDuplicateResponsesError> => { +export const callWithDuplicateResponsesMutation = (options?: Partial>): UseMutationOptions, CallWithDuplicateResponsesError> => { return { mutation: async (fnOptions) => { const { data } = await callWithDuplicateResponses({ @@ -378,7 +378,7 @@ export const callWithDuplicateResponsesMutation = (options?: Options): UseMutationOptions, CallWithResponsesError> => { +export const callWithResponsesMutation = (options?: Partial>): UseMutationOptions, CallWithResponsesError> => { return { mutation: async (fnOptions) => { const { data } = await callWithResponses({ @@ -439,7 +439,7 @@ export const complexTypesQuery = (options: Options): UseQueryO }; }; -export const callWithResultFromHeaderMutation = (options?: Options): UseMutationOptions, Error> => { +export const callWithResultFromHeaderMutation = (options?: Partial>): UseMutationOptions, Error> => { return { mutation: async (fnOptions) => { const { data } = await callWithResultFromHeader({ @@ -452,7 +452,7 @@ export const callWithResultFromHeaderMutation = (options?: Options): UseMutationOptions, Error> => { +export const testErrorCodeMutation = (options?: Partial>): UseMutationOptions, Error> => { return { mutation: async (fnOptions) => { const { data } = await testErrorCode({ @@ -465,7 +465,7 @@ export const testErrorCodeMutation = (options: Options): UseM }; }; -export const nonAsciiæøåÆøÅöôêÊ字符串Mutation = (options: Options): UseMutationOptions, Error> => { +export const nonAsciiæøåÆøÅöôêÊ字符串Mutation = (options?: Partial>): UseMutationOptions, Error> => { return { mutation: async (fnOptions) => { const { data } = await nonAsciiæøåÆøÅöôêÊ字符串({ @@ -482,7 +482,7 @@ export const nonAsciiæøåÆøÅöôêÊ字符串Mutation = (options: Options): UseMutationOptions, PostApiVbyApiVersionBodyError> => { +export const postApiVbyApiVersionBodyMutation = (options?: Partial>): UseMutationOptions, PostApiVbyApiVersionBodyError> => { return { mutation: async (fnOptions) => { const { data } = await postApiVbyApiVersionBody({ diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/Defaults.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/Defaults.gen.ts index 47f7894bf..3fb9c1261 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/Defaults.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/Defaults.gen.ts @@ -55,7 +55,7 @@ export const callWithDefaultParametersQuery = (options: Options): UseMutationOptions, Error> => { +export const callWithDefaultOptionalParametersMutation = (options?: Partial>): UseMutationOptions, Error> => { return { mutation: async (fnOptions) => { const { data } = await callWithDefaultOptionalParameters({ @@ -68,7 +68,7 @@ export const callWithDefaultOptionalParametersMutation = (options?: Options): UseMutationOptions, Error> => { +export const callToTestOrderOfParamsMutation = (options?: Partial>): UseMutationOptions, Error> => { return { mutation: async (fnOptions) => { const { data } = await callToTestOrderOfParams({ diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/Descriptions.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/Descriptions.gen.ts index 05f30e6d1..9d0e7fc0d 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/Descriptions.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/Descriptions.gen.ts @@ -4,7 +4,7 @@ import { type Options, callWithDescriptions } from '../../sdk.gen'; import type { UseMutationOptions } from '@pinia/colada'; import type { CallWithDescriptionsData } from '../../types.gen'; -export const callWithDescriptionsMutation = (options?: Options): UseMutationOptions, Error> => { +export const callWithDescriptionsMutation = (options?: Partial>): UseMutationOptions, Error> => { return { mutation: async (fnOptions) => { const { data } = await callWithDescriptions({ diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/Duplicate.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/Duplicate.gen.ts index ed05f186b..4c88c207a 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/Duplicate.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/Duplicate.gen.ts @@ -5,7 +5,7 @@ import type { UseMutationOptions, _JSONValue, UseQueryOptions } from '@pinia/col import type { DuplicateNameData, DuplicateName2Data, DuplicateName3Data, DuplicateName4Data } from '../../types.gen'; import { client as _heyApiClient } from '../../client.gen'; -export const duplicateNameMutation = (options?: Options): UseMutationOptions, Error> => { +export const duplicateNameMutation = (options?: Partial>): UseMutationOptions, Error> => { return { mutation: async (fnOptions) => { const { data } = await duplicateName({ @@ -68,7 +68,7 @@ export const duplicateName2Query = (options?: Options): UseQ }; }; -export const duplicateName3Mutation = (options?: Options): UseMutationOptions, Error> => { +export const duplicateName3Mutation = (options?: Partial>): UseMutationOptions, Error> => { return { mutation: async (fnOptions) => { const { data } = await duplicateName3({ @@ -81,7 +81,7 @@ export const duplicateName3Mutation = (options?: Options): U }; }; -export const duplicateName4Mutation = (options?: Options): UseMutationOptions, Error> => { +export const duplicateName4Mutation = (options?: Partial>): UseMutationOptions, Error> => { return { mutation: async (fnOptions) => { const { data } = await duplicateName4({ diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/Error.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/Error.gen.ts index 90dc048d7..c438a52f8 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/Error.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/Error.gen.ts @@ -4,7 +4,7 @@ import { type Options, testErrorCode } from '../../sdk.gen'; import type { UseMutationOptions } from '@pinia/colada'; import type { TestErrorCodeData } from '../../types.gen'; -export const testErrorCodeMutation = (options: Options): UseMutationOptions, Error> => { +export const testErrorCodeMutation = (options?: Partial>): UseMutationOptions, Error> => { return { mutation: async (fnOptions) => { const { data } = await testErrorCode({ diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/Header.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/Header.gen.ts index 2100075e4..d11830657 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/Header.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/Header.gen.ts @@ -4,7 +4,7 @@ import { type Options, callWithResultFromHeader } from '../../sdk.gen'; import type { UseMutationOptions } from '@pinia/colada'; import type { CallWithResultFromHeaderData } from '../../types.gen'; -export const callWithResultFromHeaderMutation = (options?: Options): UseMutationOptions, Error> => { +export const callWithResultFromHeaderMutation = (options?: Partial>): UseMutationOptions, Error> => { return { mutation: async (fnOptions) => { const { data } = await callWithResultFromHeader({ diff --git "a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/Non-Ascii-\303\246\303\270\303\245\303\206\303\230\303\205\303\266\303\264\303\252\303\212.gen.ts" "b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/Non-Ascii-\303\246\303\270\303\245\303\206\303\230\303\205\303\266\303\264\303\252\303\212.gen.ts" index dc4daddff..73f1365e3 100644 --- "a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/Non-Ascii-\303\246\303\270\303\245\303\206\303\230\303\205\303\266\303\264\303\252\303\212.gen.ts" +++ "b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/Non-Ascii-\303\246\303\270\303\245\303\206\303\230\303\205\303\266\303\264\303\252\303\212.gen.ts" @@ -4,7 +4,7 @@ import { type Options, nonAsciiæøåÆøÅöôêÊ字符串 } from '../../sdk.g import type { UseMutationOptions } from '@pinia/colada'; import type { NonAsciiæøåÆøÅöôêÊ字符串Data, NonAsciiæøåÆøÅöôêÊ字符串Response } from '../../types.gen'; -export const nonAsciiæøåÆøÅöôêÊ字符串Mutation = (options: Options): UseMutationOptions, Error> => { +export const nonAsciiæøåÆøÅöôêÊ字符串Mutation = (options?: Partial>): UseMutationOptions, Error> => { return { mutation: async (fnOptions) => { const { data } = await nonAsciiæøåÆøÅöôêÊ字符串({ diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/Parameters.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/Parameters.gen.ts index b9c052e6f..77fae6a2c 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/Parameters.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/Parameters.gen.ts @@ -4,7 +4,7 @@ import { type Options, callWithParameters, callWithWeirdParameterNames } from '. import type { UseMutationOptions } from '@pinia/colada'; import type { CallWithParametersData, CallWithWeirdParameterNamesData } from '../../types.gen'; -export const callWithParametersMutation = (options: Options): UseMutationOptions, Error> => { +export const callWithParametersMutation = (options?: Partial>): UseMutationOptions, Error> => { return { mutation: async (fnOptions) => { const { data } = await callWithParameters({ @@ -17,7 +17,7 @@ export const callWithParametersMutation = (options: Options): UseMutationOptions, Error> => { +export const callWithWeirdParameterNamesMutation = (options?: Partial>): UseMutationOptions, Error> => { return { mutation: async (fnOptions) => { const { data } = await callWithWeirdParameterNames({ diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/Response.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/Response.gen.ts index fb4f50eab..89530aef9 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/Response.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/Response.gen.ts @@ -71,7 +71,7 @@ export const callWithResponseQuery = (options?: Options): }; }; -export const callWithDuplicateResponsesMutation = (options?: Options): UseMutationOptions, CallWithDuplicateResponsesError> => { +export const callWithDuplicateResponsesMutation = (options?: Partial>): UseMutationOptions, CallWithDuplicateResponsesError> => { return { mutation: async (fnOptions) => { const { data } = await callWithDuplicateResponses({ @@ -84,7 +84,7 @@ export const callWithDuplicateResponsesMutation = (options?: Options): UseMutationOptions, CallWithResponsesError> => { +export const callWithResponsesMutation = (options?: Partial>): UseMutationOptions, CallWithResponsesError> => { return { mutation: async (fnOptions) => { const { data } = await callWithResponses({ diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/Simple.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/Simple.gen.ts index 138835de5..366f5f955 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/Simple.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/Simple.gen.ts @@ -5,7 +5,7 @@ import type { UseMutationOptions, _JSONValue, UseQueryOptions } from '@pinia/col import type { DeleteCallWithoutParametersAndResponseData, GetCallWithoutParametersAndResponseData, PatchCallWithoutParametersAndResponseData, PostCallWithoutParametersAndResponseData, PutCallWithoutParametersAndResponseData } from '../../types.gen'; import { client as _heyApiClient } from '../../client.gen'; -export const deleteCallWithoutParametersAndResponseMutation = (options?: Options): UseMutationOptions, Error> => { +export const deleteCallWithoutParametersAndResponseMutation = (options?: Partial>): UseMutationOptions, Error> => { return { mutation: async (fnOptions) => { const { data } = await deleteCallWithoutParametersAndResponse({ @@ -68,7 +68,7 @@ export const getCallWithoutParametersAndResponseQuery = (options?: Options): UseMutationOptions, Error> => { +export const patchCallWithoutParametersAndResponseMutation = (options?: Partial>): UseMutationOptions, Error> => { return { mutation: async (fnOptions) => { const { data } = await patchCallWithoutParametersAndResponse({ @@ -81,7 +81,7 @@ export const patchCallWithoutParametersAndResponseMutation = (options?: Options< }; }; -export const postCallWithoutParametersAndResponseMutation = (options?: Options): UseMutationOptions, Error> => { +export const postCallWithoutParametersAndResponseMutation = (options?: Partial>): UseMutationOptions, Error> => { return { mutation: async (fnOptions) => { const { data } = await postCallWithoutParametersAndResponse({ @@ -94,7 +94,7 @@ export const postCallWithoutParametersAndResponseMutation = (options?: Options

): UseMutationOptions, Error> => { +export const putCallWithoutParametersAndResponseMutation = (options?: Partial>): UseMutationOptions, Error> => { return { mutation: async (fnOptions) => { const { data } = await putCallWithoutParametersAndResponse({ diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/default.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/default.gen.ts index 33f8fcf53..dd8703b04 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/default.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/default.gen.ts @@ -55,7 +55,7 @@ export const serviceWithEmptyTagQuery = (options?: Options): UseMutationOptions, Error> => { +export const patchApiVbyApiVersionNoTagMutation = (options?: Partial>): UseMutationOptions, Error> => { return { mutation: async (fnOptions) => { const { data } = await patchApiVbyApiVersionNoTag({ @@ -68,7 +68,7 @@ export const patchApiVbyApiVersionNoTagMutation = (options?: Options): UseMutationOptions, Error> => { +export const fooWowMutation = (options?: Partial>): UseMutationOptions, Error> => { return { mutation: async (fnOptions) => { const { data } = await fooWow({ @@ -85,7 +85,7 @@ export const fooWowMutation = (options?: Options): UseMutationOption * Body should not be unknown * Body should not be unknown */ -export const postApiVbyApiVersionBodyMutation = (options: Options): UseMutationOptions, PostApiVbyApiVersionBodyError> => { +export const postApiVbyApiVersionBodyMutation = (options?: Partial>): UseMutationOptions, PostApiVbyApiVersionBodyError> => { return { mutation: async (fnOptions) => { const { data } = await postApiVbyApiVersionBody({ diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@pinia/colada/fetch/@pinia/colada.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@pinia/colada/fetch/@pinia/colada.gen.ts index ce759964c..3b3787901 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@pinia/colada/fetch/@pinia/colada.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@pinia/colada/fetch/@pinia/colada.gen.ts @@ -55,7 +55,7 @@ export const exportQuery = (options?: Options): UseQueryOptions): UseMutationOptions, Error> => { +export const patchApiVbyApiVersionNoTagMutation = (options?: Partial>): UseMutationOptions, Error> => { return { mutation: async (fnOptions) => { const { data } = await patchApiVbyApiVersionNoTag({ @@ -68,7 +68,7 @@ export const patchApiVbyApiVersionNoTagMutation = (options?: Options): UseMutationOptions, Error> => { +export const importMutation = (options?: Partial>): UseMutationOptions, Error> => { return { mutation: async (fnOptions) => { const { data } = await import_({ @@ -81,7 +81,7 @@ export const importMutation = (options: Options): UseMutationOptions }; }; -export const fooWowMutation = (options?: Options): UseMutationOptions, Error> => { +export const fooWowMutation = (options?: Partial>): UseMutationOptions, Error> => { return { mutation: async (fnOptions) => { const { data } = await fooWow({ @@ -126,7 +126,7 @@ export const getApiVbyApiVersionSimpleOperationQuery = (options: Options): UseMutationOptions, Error> => { +export const deleteCallWithoutParametersAndResponseMutation = (options?: Partial>): UseMutationOptions, Error> => { return { mutation: async (fnOptions) => { const { data } = await deleteCallWithoutParametersAndResponse({ @@ -155,7 +155,7 @@ export const getCallWithoutParametersAndResponseQuery = (options?: Options): UseMutationOptions, Error> => { +export const patchCallWithoutParametersAndResponseMutation = (options?: Partial>): UseMutationOptions, Error> => { return { mutation: async (fnOptions) => { const { data } = await patchCallWithoutParametersAndResponse({ @@ -168,7 +168,7 @@ export const patchCallWithoutParametersAndResponseMutation = (options?: Options< }; }; -export const postCallWithoutParametersAndResponseMutation = (options?: Options): UseMutationOptions, Error> => { +export const postCallWithoutParametersAndResponseMutation = (options?: Partial>): UseMutationOptions, Error> => { return { mutation: async (fnOptions) => { const { data } = await postCallWithoutParametersAndResponse({ @@ -181,7 +181,7 @@ export const postCallWithoutParametersAndResponseMutation = (options?: Options

): UseMutationOptions, Error> => { +export const putCallWithoutParametersAndResponseMutation = (options?: Partial>): UseMutationOptions, Error> => { return { mutation: async (fnOptions) => { const { data } = await putCallWithoutParametersAndResponse({ @@ -194,7 +194,7 @@ export const putCallWithoutParametersAndResponseMutation = (options?: Options): UseMutationOptions, Error> => { +export const deleteFooMutation = (options?: Partial>): UseMutationOptions, Error> => { return { mutation: async (fnOptions) => { const { data } = await deleteFoo({ @@ -207,7 +207,7 @@ export const deleteFooMutation = (options: Options): UseMutation }; }; -export const callWithDescriptionsMutation = (options?: Options): UseMutationOptions, Error> => { +export const callWithDescriptionsMutation = (options?: Partial>): UseMutationOptions, Error> => { return { mutation: async (fnOptions) => { const { data } = await callWithDescriptions({ @@ -223,7 +223,7 @@ export const callWithDescriptionsMutation = (options?: Options): UseMutationOptions, Error> => { +export const deprecatedCallMutation = (options?: Partial>): UseMutationOptions, Error> => { return { mutation: async (fnOptions) => { const { data } = await deprecatedCall({ @@ -236,7 +236,7 @@ export const deprecatedCallMutation = (options: Options): Us }; }; -export const callWithParametersMutation = (options: Options): UseMutationOptions, Error> => { +export const callWithParametersMutation = (options?: Partial>): UseMutationOptions, Error> => { return { mutation: async (fnOptions) => { const { data } = await callWithParameters({ @@ -249,7 +249,7 @@ export const callWithParametersMutation = (options: Options): UseMutationOptions, Error> => { +export const callWithWeirdParameterNamesMutation = (options?: Partial>): UseMutationOptions, Error> => { return { mutation: async (fnOptions) => { const { data } = await callWithWeirdParameterNames({ @@ -278,7 +278,7 @@ export const getCallWithOptionalParamQuery = (options: Options): UseMutationOptions, Error> => { +export const postCallWithOptionalParamMutation = (options?: Partial>): UseMutationOptions, Error> => { return { mutation: async (fnOptions) => { const { data } = await postCallWithOptionalParam({ @@ -291,7 +291,7 @@ export const postCallWithOptionalParamMutation = (options: Options): UseMutationOptions, Error> => { +export const postApiVbyApiVersionRequestBodyMutation = (options?: Partial>): UseMutationOptions, Error> => { return { mutation: async (fnOptions) => { const { data } = await postApiVbyApiVersionRequestBody({ @@ -304,7 +304,7 @@ export const postApiVbyApiVersionRequestBodyMutation = (options?: Options): UseMutationOptions, Error> => { +export const postApiVbyApiVersionFormDataMutation = (options?: Partial>): UseMutationOptions, Error> => { return { mutation: async (fnOptions) => { const { data } = await postApiVbyApiVersionFormData({ @@ -333,7 +333,7 @@ export const callWithDefaultParametersQuery = (options?: Options): UseMutationOptions, Error> => { +export const callWithDefaultOptionalParametersMutation = (options?: Partial>): UseMutationOptions, Error> => { return { mutation: async (fnOptions) => { const { data } = await callWithDefaultOptionalParameters({ @@ -346,7 +346,7 @@ export const callWithDefaultOptionalParametersMutation = (options?: Options): UseMutationOptions, Error> => { +export const callToTestOrderOfParamsMutation = (options?: Partial>): UseMutationOptions, Error> => { return { mutation: async (fnOptions) => { const { data } = await callToTestOrderOfParams({ @@ -359,7 +359,7 @@ export const callToTestOrderOfParamsMutation = (options: Options): UseMutationOptions, Error> => { +export const duplicateNameMutation = (options?: Partial>): UseMutationOptions, Error> => { return { mutation: async (fnOptions) => { const { data } = await duplicateName({ @@ -388,7 +388,7 @@ export const duplicateName2Query = (options?: Options): UseQ }; }; -export const duplicateName3Mutation = (options?: Options): UseMutationOptions, Error> => { +export const duplicateName3Mutation = (options?: Partial>): UseMutationOptions, Error> => { return { mutation: async (fnOptions) => { const { data } = await duplicateName3({ @@ -401,7 +401,7 @@ export const duplicateName3Mutation = (options?: Options): U }; }; -export const duplicateName4Mutation = (options?: Options): UseMutationOptions, Error> => { +export const duplicateName4Mutation = (options?: Partial>): UseMutationOptions, Error> => { return { mutation: async (fnOptions) => { const { data } = await duplicateName4({ @@ -494,7 +494,7 @@ export const callWithResponseQuery = (options?: Options): }; }; -export const callWithDuplicateResponsesMutation = (options?: Options): UseMutationOptions, CallWithDuplicateResponsesError> => { +export const callWithDuplicateResponsesMutation = (options?: Partial>): UseMutationOptions, CallWithDuplicateResponsesError> => { return { mutation: async (fnOptions) => { const { data } = await callWithDuplicateResponses({ @@ -507,7 +507,7 @@ export const callWithDuplicateResponsesMutation = (options?: Options): UseMutationOptions, CallWithResponsesError> => { +export const callWithResponsesMutation = (options?: Partial>): UseMutationOptions, CallWithResponsesError> => { return { mutation: async (fnOptions) => { const { data } = await callWithResponses({ @@ -552,7 +552,7 @@ export const typesQuery = (options: Options): UseQueryOptions): UseMutationOptions, Error> => { +export const uploadFileMutation = (options?: Partial>): UseMutationOptions, Error> => { return { mutation: async (fnOptions) => { const { data } = await uploadFile({ @@ -613,7 +613,7 @@ export const multipartResponseQuery = (options?: Options) }; }; -export const multipartRequestMutation = (options?: Options): UseMutationOptions, Error> => { +export const multipartRequestMutation = (options?: Partial>): UseMutationOptions, Error> => { return { mutation: async (fnOptions) => { const { data } = await multipartRequest({ @@ -626,7 +626,7 @@ export const multipartRequestMutation = (options?: Options }; }; -export const complexParamsMutation = (options: Options): UseMutationOptions, Error> => { +export const complexParamsMutation = (options?: Partial>): UseMutationOptions, Error> => { return { mutation: async (fnOptions) => { const { data } = await complexParams({ @@ -639,7 +639,7 @@ export const complexParamsMutation = (options: Options): UseM }; }; -export const callWithResultFromHeaderMutation = (options?: Options): UseMutationOptions, Error> => { +export const callWithResultFromHeaderMutation = (options?: Partial>): UseMutationOptions, Error> => { return { mutation: async (fnOptions) => { const { data } = await callWithResultFromHeader({ @@ -652,7 +652,7 @@ export const callWithResultFromHeaderMutation = (options?: Options): UseMutationOptions, Error> => { +export const testErrorCodeMutation = (options?: Partial>): UseMutationOptions, Error> => { return { mutation: async (fnOptions) => { const { data } = await testErrorCode({ @@ -665,7 +665,7 @@ export const testErrorCodeMutation = (options: Options): UseM }; }; -export const nonAsciiæøåÆøÅöôêÊ字符串Mutation = (options: Options): UseMutationOptions, Error> => { +export const nonAsciiæøåÆøÅöôêÊ字符串Mutation = (options?: Partial>): UseMutationOptions, Error> => { return { mutation: async (fnOptions) => { const { data } = await nonAsciiæøåÆøÅöôêÊ字符串({ @@ -681,7 +681,7 @@ export const nonAsciiæøåÆøÅöôêÊ字符串Mutation = (options: Options): UseMutationOptions, Error> => { +export const putWithFormUrlEncodedMutation = (options?: Partial>): UseMutationOptions, Error> => { return { mutation: async (fnOptions) => { const { data } = await putWithFormUrlEncoded({ diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/Complex.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/Complex.gen.ts index 2d73a2a25..a677a01e8 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/Complex.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/Complex.gen.ts @@ -55,7 +55,7 @@ export const complexTypesQuery = (options: Options): UseQueryO }; }; -export const complexParamsMutation = (options: Options): UseMutationOptions, Error> => { +export const complexParamsMutation = (options?: Partial>): UseMutationOptions, Error> => { return { mutation: async (fnOptions) => { const { data } = await complexParams({ diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/Defaults.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/Defaults.gen.ts index 1b5096aea..640f39a27 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/Defaults.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/Defaults.gen.ts @@ -55,7 +55,7 @@ export const callWithDefaultParametersQuery = (options?: Options): UseMutationOptions, Error> => { +export const callWithDefaultOptionalParametersMutation = (options?: Partial>): UseMutationOptions, Error> => { return { mutation: async (fnOptions) => { const { data } = await callWithDefaultOptionalParameters({ @@ -68,7 +68,7 @@ export const callWithDefaultOptionalParametersMutation = (options?: Options): UseMutationOptions, Error> => { +export const callToTestOrderOfParamsMutation = (options?: Partial>): UseMutationOptions, Error> => { return { mutation: async (fnOptions) => { const { data } = await callToTestOrderOfParams({ diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/Deprecated.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/Deprecated.gen.ts index b35ad56ae..d3263121f 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/Deprecated.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/Deprecated.gen.ts @@ -7,7 +7,7 @@ import type { DeprecatedCallData } from '../../types.gen'; /** * @deprecated */ -export const deprecatedCallMutation = (options: Options): UseMutationOptions, Error> => { +export const deprecatedCallMutation = (options?: Partial>): UseMutationOptions, Error> => { return { mutation: async (fnOptions) => { const { data } = await deprecatedCall({ diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/Descriptions.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/Descriptions.gen.ts index 05f30e6d1..9d0e7fc0d 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/Descriptions.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/Descriptions.gen.ts @@ -4,7 +4,7 @@ import { type Options, callWithDescriptions } from '../../sdk.gen'; import type { UseMutationOptions } from '@pinia/colada'; import type { CallWithDescriptionsData } from '../../types.gen'; -export const callWithDescriptionsMutation = (options?: Options): UseMutationOptions, Error> => { +export const callWithDescriptionsMutation = (options?: Partial>): UseMutationOptions, Error> => { return { mutation: async (fnOptions) => { const { data } = await callWithDescriptions({ diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/Duplicate.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/Duplicate.gen.ts index ed05f186b..4c88c207a 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/Duplicate.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/Duplicate.gen.ts @@ -5,7 +5,7 @@ import type { UseMutationOptions, _JSONValue, UseQueryOptions } from '@pinia/col import type { DuplicateNameData, DuplicateName2Data, DuplicateName3Data, DuplicateName4Data } from '../../types.gen'; import { client as _heyApiClient } from '../../client.gen'; -export const duplicateNameMutation = (options?: Options): UseMutationOptions, Error> => { +export const duplicateNameMutation = (options?: Partial>): UseMutationOptions, Error> => { return { mutation: async (fnOptions) => { const { data } = await duplicateName({ @@ -68,7 +68,7 @@ export const duplicateName2Query = (options?: Options): UseQ }; }; -export const duplicateName3Mutation = (options?: Options): UseMutationOptions, Error> => { +export const duplicateName3Mutation = (options?: Partial>): UseMutationOptions, Error> => { return { mutation: async (fnOptions) => { const { data } = await duplicateName3({ @@ -81,7 +81,7 @@ export const duplicateName3Mutation = (options?: Options): U }; }; -export const duplicateName4Mutation = (options?: Options): UseMutationOptions, Error> => { +export const duplicateName4Mutation = (options?: Partial>): UseMutationOptions, Error> => { return { mutation: async (fnOptions) => { const { data } = await duplicateName4({ diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/Error.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/Error.gen.ts index 90dc048d7..c438a52f8 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/Error.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/Error.gen.ts @@ -4,7 +4,7 @@ import { type Options, testErrorCode } from '../../sdk.gen'; import type { UseMutationOptions } from '@pinia/colada'; import type { TestErrorCodeData } from '../../types.gen'; -export const testErrorCodeMutation = (options: Options): UseMutationOptions, Error> => { +export const testErrorCodeMutation = (options?: Partial>): UseMutationOptions, Error> => { return { mutation: async (fnOptions) => { const { data } = await testErrorCode({ diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/FormData.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/FormData.gen.ts index 64656dee0..56e66a88a 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/FormData.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/FormData.gen.ts @@ -4,7 +4,7 @@ import { type Options, postApiVbyApiVersionFormData } from '../../sdk.gen'; import type { UseMutationOptions } from '@pinia/colada'; import type { PostApiVbyApiVersionFormDataData } from '../../types.gen'; -export const postApiVbyApiVersionFormDataMutation = (options?: Options): UseMutationOptions, Error> => { +export const postApiVbyApiVersionFormDataMutation = (options?: Partial>): UseMutationOptions, Error> => { return { mutation: async (fnOptions) => { const { data } = await postApiVbyApiVersionFormData({ diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/Header.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/Header.gen.ts index 2100075e4..d11830657 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/Header.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/Header.gen.ts @@ -4,7 +4,7 @@ import { type Options, callWithResultFromHeader } from '../../sdk.gen'; import type { UseMutationOptions } from '@pinia/colada'; import type { CallWithResultFromHeaderData } from '../../types.gen'; -export const callWithResultFromHeaderMutation = (options?: Options): UseMutationOptions, Error> => { +export const callWithResultFromHeaderMutation = (options?: Partial>): UseMutationOptions, Error> => { return { mutation: async (fnOptions) => { const { data } = await callWithResultFromHeader({ diff --git "a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/Non-Ascii-\303\246\303\270\303\245\303\206\303\230\303\205\303\266\303\264\303\252\303\212.gen.ts" "b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/Non-Ascii-\303\246\303\270\303\245\303\206\303\230\303\205\303\266\303\264\303\252\303\212.gen.ts" index a01de3df0..8a3c6775a 100644 --- "a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/Non-Ascii-\303\246\303\270\303\245\303\206\303\230\303\205\303\266\303\264\303\252\303\212.gen.ts" +++ "b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/Non-Ascii-\303\246\303\270\303\245\303\206\303\230\303\205\303\266\303\264\303\252\303\212.gen.ts" @@ -4,7 +4,7 @@ import { type Options, nonAsciiæøåÆøÅöôêÊ字符串, putWithFormUrlEnco import type { UseMutationOptions } from '@pinia/colada'; import type { NonAsciiæøåÆøÅöôêÊ字符串Data, NonAsciiæøåÆøÅöôêÊ字符串Response, PutWithFormUrlEncodedData } from '../../types.gen'; -export const nonAsciiæøåÆøÅöôêÊ字符串Mutation = (options: Options): UseMutationOptions, Error> => { +export const nonAsciiæøåÆøÅöôêÊ字符串Mutation = (options?: Partial>): UseMutationOptions, Error> => { return { mutation: async (fnOptions) => { const { data } = await nonAsciiæøåÆøÅöôêÊ字符串({ @@ -20,7 +20,7 @@ export const nonAsciiæøåÆøÅöôêÊ字符串Mutation = (options: Options): UseMutationOptions, Error> => { +export const putWithFormUrlEncodedMutation = (options?: Partial>): UseMutationOptions, Error> => { return { mutation: async (fnOptions) => { const { data } = await putWithFormUrlEncoded({ diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/Parameters.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/Parameters.gen.ts index 6c54734b5..2deb2891a 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/Parameters.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/Parameters.gen.ts @@ -5,7 +5,7 @@ import type { UseMutationOptions, _JSONValue, UseQueryOptions } from '@pinia/col import type { DeleteFooData3, CallWithParametersData, CallWithWeirdParameterNamesData, GetCallWithOptionalParamData, PostCallWithOptionalParamData, PostCallWithOptionalParamResponse } from '../../types.gen'; import { client as _heyApiClient } from '../../client.gen'; -export const deleteFooMutation = (options: Options): UseMutationOptions, Error> => { +export const deleteFooMutation = (options?: Partial>): UseMutationOptions, Error> => { return { mutation: async (fnOptions) => { const { data } = await deleteFoo({ @@ -18,7 +18,7 @@ export const deleteFooMutation = (options: Options): UseMutation }; }; -export const callWithParametersMutation = (options: Options): UseMutationOptions, Error> => { +export const callWithParametersMutation = (options?: Partial>): UseMutationOptions, Error> => { return { mutation: async (fnOptions) => { const { data } = await callWithParameters({ @@ -31,7 +31,7 @@ export const callWithParametersMutation = (options: Options): UseMutationOptions, Error> => { +export const callWithWeirdParameterNamesMutation = (options?: Partial>): UseMutationOptions, Error> => { return { mutation: async (fnOptions) => { const { data } = await callWithWeirdParameterNames({ @@ -94,7 +94,7 @@ export const getCallWithOptionalParamQuery = (options: Options): UseMutationOptions, Error> => { +export const postCallWithOptionalParamMutation = (options?: Partial>): UseMutationOptions, Error> => { return { mutation: async (fnOptions) => { const { data } = await postCallWithOptionalParam({ diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/RequestBody.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/RequestBody.gen.ts index 843f64910..c9ddd05a4 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/RequestBody.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/RequestBody.gen.ts @@ -4,7 +4,7 @@ import { type Options, postApiVbyApiVersionRequestBody } from '../../sdk.gen'; import type { UseMutationOptions } from '@pinia/colada'; import type { PostApiVbyApiVersionRequestBodyData } from '../../types.gen'; -export const postApiVbyApiVersionRequestBodyMutation = (options?: Options): UseMutationOptions, Error> => { +export const postApiVbyApiVersionRequestBodyMutation = (options?: Partial>): UseMutationOptions, Error> => { return { mutation: async (fnOptions) => { const { data } = await postApiVbyApiVersionRequestBody({ diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/Response.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/Response.gen.ts index fb4f50eab..89530aef9 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/Response.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/Response.gen.ts @@ -71,7 +71,7 @@ export const callWithResponseQuery = (options?: Options): }; }; -export const callWithDuplicateResponsesMutation = (options?: Options): UseMutationOptions, CallWithDuplicateResponsesError> => { +export const callWithDuplicateResponsesMutation = (options?: Partial>): UseMutationOptions, CallWithDuplicateResponsesError> => { return { mutation: async (fnOptions) => { const { data } = await callWithDuplicateResponses({ @@ -84,7 +84,7 @@ export const callWithDuplicateResponsesMutation = (options?: Options): UseMutationOptions, CallWithResponsesError> => { +export const callWithResponsesMutation = (options?: Partial>): UseMutationOptions, CallWithResponsesError> => { return { mutation: async (fnOptions) => { const { data } = await callWithResponses({ diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/Simple.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/Simple.gen.ts index e4d9c13d7..a65455dee 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/Simple.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/Simple.gen.ts @@ -55,7 +55,7 @@ export const apiVVersionODataControllerCountQuery = (options?: Options): UseMutationOptions, Error> => { +export const deleteCallWithoutParametersAndResponseMutation = (options?: Partial>): UseMutationOptions, Error> => { return { mutation: async (fnOptions) => { const { data } = await deleteCallWithoutParametersAndResponse({ @@ -84,7 +84,7 @@ export const getCallWithoutParametersAndResponseQuery = (options?: Options): UseMutationOptions, Error> => { +export const patchCallWithoutParametersAndResponseMutation = (options?: Partial>): UseMutationOptions, Error> => { return { mutation: async (fnOptions) => { const { data } = await patchCallWithoutParametersAndResponse({ @@ -97,7 +97,7 @@ export const patchCallWithoutParametersAndResponseMutation = (options?: Options< }; }; -export const postCallWithoutParametersAndResponseMutation = (options?: Options): UseMutationOptions, Error> => { +export const postCallWithoutParametersAndResponseMutation = (options?: Partial>): UseMutationOptions, Error> => { return { mutation: async (fnOptions) => { const { data } = await postCallWithoutParametersAndResponse({ @@ -110,7 +110,7 @@ export const postCallWithoutParametersAndResponseMutation = (options?: Options

): UseMutationOptions, Error> => { +export const putCallWithoutParametersAndResponseMutation = (options?: Partial>): UseMutationOptions, Error> => { return { mutation: async (fnOptions) => { const { data } = await putCallWithoutParametersAndResponse({ diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/Upload.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/Upload.gen.ts index 444d8f9ec..1283b29e6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/Upload.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/Upload.gen.ts @@ -4,7 +4,7 @@ import { type Options, uploadFile } from '../../sdk.gen'; import type { UseMutationOptions } from '@pinia/colada'; import type { UploadFileData, UploadFileResponse } from '../../types.gen'; -export const uploadFileMutation = (options: Options): UseMutationOptions, Error> => { +export const uploadFileMutation = (options?: Partial>): UseMutationOptions, Error> => { return { mutation: async (fnOptions) => { const { data } = await uploadFile({ diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/default.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/default.gen.ts index f11c6546a..fe770278b 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/default.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/default.gen.ts @@ -55,7 +55,7 @@ export const exportQuery = (options?: Options): UseQueryOptions): UseMutationOptions, Error> => { +export const patchApiVbyApiVersionNoTagMutation = (options?: Partial>): UseMutationOptions, Error> => { return { mutation: async (fnOptions) => { const { data } = await patchApiVbyApiVersionNoTag({ @@ -68,7 +68,7 @@ export const patchApiVbyApiVersionNoTagMutation = (options?: Options): UseMutationOptions, Error> => { +export const importMutation = (options?: Partial>): UseMutationOptions, Error> => { return { mutation: async (fnOptions) => { const { data } = await import_({ @@ -81,7 +81,7 @@ export const importMutation = (options: Options): UseMutationOptions }; }; -export const fooWowMutation = (options?: Options): UseMutationOptions, Error> => { +export const fooWowMutation = (options?: Partial>): UseMutationOptions, Error> => { return { mutation: async (fnOptions) => { const { data } = await fooWow({ diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/multipart.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/multipart.gen.ts index e47a721b5..3e923414b 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/multipart.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/multipart.gen.ts @@ -55,7 +55,7 @@ export const multipartResponseQuery = (options?: Options) }; }; -export const multipartRequestMutation = (options?: Options): UseMutationOptions, Error> => { +export const multipartRequestMutation = (options?: Partial>): UseMutationOptions, Error> => { return { mutation: async (fnOptions) => { const { data } = await multipartRequest({ diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@pinia/colada/fetch/@pinia/colada.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@pinia/colada/fetch/@pinia/colada.gen.ts index ce759964c..3b3787901 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@pinia/colada/fetch/@pinia/colada.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@pinia/colada/fetch/@pinia/colada.gen.ts @@ -55,7 +55,7 @@ export const exportQuery = (options?: Options): UseQueryOptions): UseMutationOptions, Error> => { +export const patchApiVbyApiVersionNoTagMutation = (options?: Partial>): UseMutationOptions, Error> => { return { mutation: async (fnOptions) => { const { data } = await patchApiVbyApiVersionNoTag({ @@ -68,7 +68,7 @@ export const patchApiVbyApiVersionNoTagMutation = (options?: Options): UseMutationOptions, Error> => { +export const importMutation = (options?: Partial>): UseMutationOptions, Error> => { return { mutation: async (fnOptions) => { const { data } = await import_({ @@ -81,7 +81,7 @@ export const importMutation = (options: Options): UseMutationOptions }; }; -export const fooWowMutation = (options?: Options): UseMutationOptions, Error> => { +export const fooWowMutation = (options?: Partial>): UseMutationOptions, Error> => { return { mutation: async (fnOptions) => { const { data } = await fooWow({ @@ -126,7 +126,7 @@ export const getApiVbyApiVersionSimpleOperationQuery = (options: Options): UseMutationOptions, Error> => { +export const deleteCallWithoutParametersAndResponseMutation = (options?: Partial>): UseMutationOptions, Error> => { return { mutation: async (fnOptions) => { const { data } = await deleteCallWithoutParametersAndResponse({ @@ -155,7 +155,7 @@ export const getCallWithoutParametersAndResponseQuery = (options?: Options): UseMutationOptions, Error> => { +export const patchCallWithoutParametersAndResponseMutation = (options?: Partial>): UseMutationOptions, Error> => { return { mutation: async (fnOptions) => { const { data } = await patchCallWithoutParametersAndResponse({ @@ -168,7 +168,7 @@ export const patchCallWithoutParametersAndResponseMutation = (options?: Options< }; }; -export const postCallWithoutParametersAndResponseMutation = (options?: Options): UseMutationOptions, Error> => { +export const postCallWithoutParametersAndResponseMutation = (options?: Partial>): UseMutationOptions, Error> => { return { mutation: async (fnOptions) => { const { data } = await postCallWithoutParametersAndResponse({ @@ -181,7 +181,7 @@ export const postCallWithoutParametersAndResponseMutation = (options?: Options

): UseMutationOptions, Error> => { +export const putCallWithoutParametersAndResponseMutation = (options?: Partial>): UseMutationOptions, Error> => { return { mutation: async (fnOptions) => { const { data } = await putCallWithoutParametersAndResponse({ @@ -194,7 +194,7 @@ export const putCallWithoutParametersAndResponseMutation = (options?: Options): UseMutationOptions, Error> => { +export const deleteFooMutation = (options?: Partial>): UseMutationOptions, Error> => { return { mutation: async (fnOptions) => { const { data } = await deleteFoo({ @@ -207,7 +207,7 @@ export const deleteFooMutation = (options: Options): UseMutation }; }; -export const callWithDescriptionsMutation = (options?: Options): UseMutationOptions, Error> => { +export const callWithDescriptionsMutation = (options?: Partial>): UseMutationOptions, Error> => { return { mutation: async (fnOptions) => { const { data } = await callWithDescriptions({ @@ -223,7 +223,7 @@ export const callWithDescriptionsMutation = (options?: Options): UseMutationOptions, Error> => { +export const deprecatedCallMutation = (options?: Partial>): UseMutationOptions, Error> => { return { mutation: async (fnOptions) => { const { data } = await deprecatedCall({ @@ -236,7 +236,7 @@ export const deprecatedCallMutation = (options: Options): Us }; }; -export const callWithParametersMutation = (options: Options): UseMutationOptions, Error> => { +export const callWithParametersMutation = (options?: Partial>): UseMutationOptions, Error> => { return { mutation: async (fnOptions) => { const { data } = await callWithParameters({ @@ -249,7 +249,7 @@ export const callWithParametersMutation = (options: Options): UseMutationOptions, Error> => { +export const callWithWeirdParameterNamesMutation = (options?: Partial>): UseMutationOptions, Error> => { return { mutation: async (fnOptions) => { const { data } = await callWithWeirdParameterNames({ @@ -278,7 +278,7 @@ export const getCallWithOptionalParamQuery = (options: Options): UseMutationOptions, Error> => { +export const postCallWithOptionalParamMutation = (options?: Partial>): UseMutationOptions, Error> => { return { mutation: async (fnOptions) => { const { data } = await postCallWithOptionalParam({ @@ -291,7 +291,7 @@ export const postCallWithOptionalParamMutation = (options: Options): UseMutationOptions, Error> => { +export const postApiVbyApiVersionRequestBodyMutation = (options?: Partial>): UseMutationOptions, Error> => { return { mutation: async (fnOptions) => { const { data } = await postApiVbyApiVersionRequestBody({ @@ -304,7 +304,7 @@ export const postApiVbyApiVersionRequestBodyMutation = (options?: Options): UseMutationOptions, Error> => { +export const postApiVbyApiVersionFormDataMutation = (options?: Partial>): UseMutationOptions, Error> => { return { mutation: async (fnOptions) => { const { data } = await postApiVbyApiVersionFormData({ @@ -333,7 +333,7 @@ export const callWithDefaultParametersQuery = (options?: Options): UseMutationOptions, Error> => { +export const callWithDefaultOptionalParametersMutation = (options?: Partial>): UseMutationOptions, Error> => { return { mutation: async (fnOptions) => { const { data } = await callWithDefaultOptionalParameters({ @@ -346,7 +346,7 @@ export const callWithDefaultOptionalParametersMutation = (options?: Options): UseMutationOptions, Error> => { +export const callToTestOrderOfParamsMutation = (options?: Partial>): UseMutationOptions, Error> => { return { mutation: async (fnOptions) => { const { data } = await callToTestOrderOfParams({ @@ -359,7 +359,7 @@ export const callToTestOrderOfParamsMutation = (options: Options): UseMutationOptions, Error> => { +export const duplicateNameMutation = (options?: Partial>): UseMutationOptions, Error> => { return { mutation: async (fnOptions) => { const { data } = await duplicateName({ @@ -388,7 +388,7 @@ export const duplicateName2Query = (options?: Options): UseQ }; }; -export const duplicateName3Mutation = (options?: Options): UseMutationOptions, Error> => { +export const duplicateName3Mutation = (options?: Partial>): UseMutationOptions, Error> => { return { mutation: async (fnOptions) => { const { data } = await duplicateName3({ @@ -401,7 +401,7 @@ export const duplicateName3Mutation = (options?: Options): U }; }; -export const duplicateName4Mutation = (options?: Options): UseMutationOptions, Error> => { +export const duplicateName4Mutation = (options?: Partial>): UseMutationOptions, Error> => { return { mutation: async (fnOptions) => { const { data } = await duplicateName4({ @@ -494,7 +494,7 @@ export const callWithResponseQuery = (options?: Options): }; }; -export const callWithDuplicateResponsesMutation = (options?: Options): UseMutationOptions, CallWithDuplicateResponsesError> => { +export const callWithDuplicateResponsesMutation = (options?: Partial>): UseMutationOptions, CallWithDuplicateResponsesError> => { return { mutation: async (fnOptions) => { const { data } = await callWithDuplicateResponses({ @@ -507,7 +507,7 @@ export const callWithDuplicateResponsesMutation = (options?: Options): UseMutationOptions, CallWithResponsesError> => { +export const callWithResponsesMutation = (options?: Partial>): UseMutationOptions, CallWithResponsesError> => { return { mutation: async (fnOptions) => { const { data } = await callWithResponses({ @@ -552,7 +552,7 @@ export const typesQuery = (options: Options): UseQueryOptions): UseMutationOptions, Error> => { +export const uploadFileMutation = (options?: Partial>): UseMutationOptions, Error> => { return { mutation: async (fnOptions) => { const { data } = await uploadFile({ @@ -613,7 +613,7 @@ export const multipartResponseQuery = (options?: Options) }; }; -export const multipartRequestMutation = (options?: Options): UseMutationOptions, Error> => { +export const multipartRequestMutation = (options?: Partial>): UseMutationOptions, Error> => { return { mutation: async (fnOptions) => { const { data } = await multipartRequest({ @@ -626,7 +626,7 @@ export const multipartRequestMutation = (options?: Options }; }; -export const complexParamsMutation = (options: Options): UseMutationOptions, Error> => { +export const complexParamsMutation = (options?: Partial>): UseMutationOptions, Error> => { return { mutation: async (fnOptions) => { const { data } = await complexParams({ @@ -639,7 +639,7 @@ export const complexParamsMutation = (options: Options): UseM }; }; -export const callWithResultFromHeaderMutation = (options?: Options): UseMutationOptions, Error> => { +export const callWithResultFromHeaderMutation = (options?: Partial>): UseMutationOptions, Error> => { return { mutation: async (fnOptions) => { const { data } = await callWithResultFromHeader({ @@ -652,7 +652,7 @@ export const callWithResultFromHeaderMutation = (options?: Options): UseMutationOptions, Error> => { +export const testErrorCodeMutation = (options?: Partial>): UseMutationOptions, Error> => { return { mutation: async (fnOptions) => { const { data } = await testErrorCode({ @@ -665,7 +665,7 @@ export const testErrorCodeMutation = (options: Options): UseM }; }; -export const nonAsciiæøåÆøÅöôêÊ字符串Mutation = (options: Options): UseMutationOptions, Error> => { +export const nonAsciiæøåÆøÅöôêÊ字符串Mutation = (options?: Partial>): UseMutationOptions, Error> => { return { mutation: async (fnOptions) => { const { data } = await nonAsciiæøåÆøÅöôêÊ字符串({ @@ -681,7 +681,7 @@ export const nonAsciiæøåÆøÅöôêÊ字符串Mutation = (options: Options): UseMutationOptions, Error> => { +export const putWithFormUrlEncodedMutation = (options?: Partial>): UseMutationOptions, Error> => { return { mutation: async (fnOptions) => { const { data } = await putWithFormUrlEncoded({ diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/Complex.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/Complex.gen.ts index 2d73a2a25..a677a01e8 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/Complex.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/Complex.gen.ts @@ -55,7 +55,7 @@ export const complexTypesQuery = (options: Options): UseQueryO }; }; -export const complexParamsMutation = (options: Options): UseMutationOptions, Error> => { +export const complexParamsMutation = (options?: Partial>): UseMutationOptions, Error> => { return { mutation: async (fnOptions) => { const { data } = await complexParams({ diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/Defaults.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/Defaults.gen.ts index 1b5096aea..640f39a27 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/Defaults.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/Defaults.gen.ts @@ -55,7 +55,7 @@ export const callWithDefaultParametersQuery = (options?: Options): UseMutationOptions, Error> => { +export const callWithDefaultOptionalParametersMutation = (options?: Partial>): UseMutationOptions, Error> => { return { mutation: async (fnOptions) => { const { data } = await callWithDefaultOptionalParameters({ @@ -68,7 +68,7 @@ export const callWithDefaultOptionalParametersMutation = (options?: Options): UseMutationOptions, Error> => { +export const callToTestOrderOfParamsMutation = (options?: Partial>): UseMutationOptions, Error> => { return { mutation: async (fnOptions) => { const { data } = await callToTestOrderOfParams({ diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/Deprecated.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/Deprecated.gen.ts index b35ad56ae..d3263121f 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/Deprecated.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/Deprecated.gen.ts @@ -7,7 +7,7 @@ import type { DeprecatedCallData } from '../../types.gen'; /** * @deprecated */ -export const deprecatedCallMutation = (options: Options): UseMutationOptions, Error> => { +export const deprecatedCallMutation = (options?: Partial>): UseMutationOptions, Error> => { return { mutation: async (fnOptions) => { const { data } = await deprecatedCall({ diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/Descriptions.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/Descriptions.gen.ts index 05f30e6d1..9d0e7fc0d 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/Descriptions.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/Descriptions.gen.ts @@ -4,7 +4,7 @@ import { type Options, callWithDescriptions } from '../../sdk.gen'; import type { UseMutationOptions } from '@pinia/colada'; import type { CallWithDescriptionsData } from '../../types.gen'; -export const callWithDescriptionsMutation = (options?: Options): UseMutationOptions, Error> => { +export const callWithDescriptionsMutation = (options?: Partial>): UseMutationOptions, Error> => { return { mutation: async (fnOptions) => { const { data } = await callWithDescriptions({ diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/Duplicate.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/Duplicate.gen.ts index ed05f186b..4c88c207a 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/Duplicate.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/Duplicate.gen.ts @@ -5,7 +5,7 @@ import type { UseMutationOptions, _JSONValue, UseQueryOptions } from '@pinia/col import type { DuplicateNameData, DuplicateName2Data, DuplicateName3Data, DuplicateName4Data } from '../../types.gen'; import { client as _heyApiClient } from '../../client.gen'; -export const duplicateNameMutation = (options?: Options): UseMutationOptions, Error> => { +export const duplicateNameMutation = (options?: Partial>): UseMutationOptions, Error> => { return { mutation: async (fnOptions) => { const { data } = await duplicateName({ @@ -68,7 +68,7 @@ export const duplicateName2Query = (options?: Options): UseQ }; }; -export const duplicateName3Mutation = (options?: Options): UseMutationOptions, Error> => { +export const duplicateName3Mutation = (options?: Partial>): UseMutationOptions, Error> => { return { mutation: async (fnOptions) => { const { data } = await duplicateName3({ @@ -81,7 +81,7 @@ export const duplicateName3Mutation = (options?: Options): U }; }; -export const duplicateName4Mutation = (options?: Options): UseMutationOptions, Error> => { +export const duplicateName4Mutation = (options?: Partial>): UseMutationOptions, Error> => { return { mutation: async (fnOptions) => { const { data } = await duplicateName4({ diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/Error.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/Error.gen.ts index 90dc048d7..c438a52f8 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/Error.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/Error.gen.ts @@ -4,7 +4,7 @@ import { type Options, testErrorCode } from '../../sdk.gen'; import type { UseMutationOptions } from '@pinia/colada'; import type { TestErrorCodeData } from '../../types.gen'; -export const testErrorCodeMutation = (options: Options): UseMutationOptions, Error> => { +export const testErrorCodeMutation = (options?: Partial>): UseMutationOptions, Error> => { return { mutation: async (fnOptions) => { const { data } = await testErrorCode({ diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/FormData.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/FormData.gen.ts index 64656dee0..56e66a88a 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/FormData.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/FormData.gen.ts @@ -4,7 +4,7 @@ import { type Options, postApiVbyApiVersionFormData } from '../../sdk.gen'; import type { UseMutationOptions } from '@pinia/colada'; import type { PostApiVbyApiVersionFormDataData } from '../../types.gen'; -export const postApiVbyApiVersionFormDataMutation = (options?: Options): UseMutationOptions, Error> => { +export const postApiVbyApiVersionFormDataMutation = (options?: Partial>): UseMutationOptions, Error> => { return { mutation: async (fnOptions) => { const { data } = await postApiVbyApiVersionFormData({ diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/Header.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/Header.gen.ts index 2100075e4..d11830657 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/Header.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/Header.gen.ts @@ -4,7 +4,7 @@ import { type Options, callWithResultFromHeader } from '../../sdk.gen'; import type { UseMutationOptions } from '@pinia/colada'; import type { CallWithResultFromHeaderData } from '../../types.gen'; -export const callWithResultFromHeaderMutation = (options?: Options): UseMutationOptions, Error> => { +export const callWithResultFromHeaderMutation = (options?: Partial>): UseMutationOptions, Error> => { return { mutation: async (fnOptions) => { const { data } = await callWithResultFromHeader({ diff --git "a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/Non-Ascii-\303\246\303\270\303\245\303\206\303\230\303\205\303\266\303\264\303\252\303\212.gen.ts" "b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/Non-Ascii-\303\246\303\270\303\245\303\206\303\230\303\205\303\266\303\264\303\252\303\212.gen.ts" index a01de3df0..8a3c6775a 100644 --- "a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/Non-Ascii-\303\246\303\270\303\245\303\206\303\230\303\205\303\266\303\264\303\252\303\212.gen.ts" +++ "b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/Non-Ascii-\303\246\303\270\303\245\303\206\303\230\303\205\303\266\303\264\303\252\303\212.gen.ts" @@ -4,7 +4,7 @@ import { type Options, nonAsciiæøåÆøÅöôêÊ字符串, putWithFormUrlEnco import type { UseMutationOptions } from '@pinia/colada'; import type { NonAsciiæøåÆøÅöôêÊ字符串Data, NonAsciiæøåÆøÅöôêÊ字符串Response, PutWithFormUrlEncodedData } from '../../types.gen'; -export const nonAsciiæøåÆøÅöôêÊ字符串Mutation = (options: Options): UseMutationOptions, Error> => { +export const nonAsciiæøåÆøÅöôêÊ字符串Mutation = (options?: Partial>): UseMutationOptions, Error> => { return { mutation: async (fnOptions) => { const { data } = await nonAsciiæøåÆøÅöôêÊ字符串({ @@ -20,7 +20,7 @@ export const nonAsciiæøåÆøÅöôêÊ字符串Mutation = (options: Options): UseMutationOptions, Error> => { +export const putWithFormUrlEncodedMutation = (options?: Partial>): UseMutationOptions, Error> => { return { mutation: async (fnOptions) => { const { data } = await putWithFormUrlEncoded({ diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/Parameters.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/Parameters.gen.ts index 6c54734b5..2deb2891a 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/Parameters.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/Parameters.gen.ts @@ -5,7 +5,7 @@ import type { UseMutationOptions, _JSONValue, UseQueryOptions } from '@pinia/col import type { DeleteFooData3, CallWithParametersData, CallWithWeirdParameterNamesData, GetCallWithOptionalParamData, PostCallWithOptionalParamData, PostCallWithOptionalParamResponse } from '../../types.gen'; import { client as _heyApiClient } from '../../client.gen'; -export const deleteFooMutation = (options: Options): UseMutationOptions, Error> => { +export const deleteFooMutation = (options?: Partial>): UseMutationOptions, Error> => { return { mutation: async (fnOptions) => { const { data } = await deleteFoo({ @@ -18,7 +18,7 @@ export const deleteFooMutation = (options: Options): UseMutation }; }; -export const callWithParametersMutation = (options: Options): UseMutationOptions, Error> => { +export const callWithParametersMutation = (options?: Partial>): UseMutationOptions, Error> => { return { mutation: async (fnOptions) => { const { data } = await callWithParameters({ @@ -31,7 +31,7 @@ export const callWithParametersMutation = (options: Options): UseMutationOptions, Error> => { +export const callWithWeirdParameterNamesMutation = (options?: Partial>): UseMutationOptions, Error> => { return { mutation: async (fnOptions) => { const { data } = await callWithWeirdParameterNames({ @@ -94,7 +94,7 @@ export const getCallWithOptionalParamQuery = (options: Options): UseMutationOptions, Error> => { +export const postCallWithOptionalParamMutation = (options?: Partial>): UseMutationOptions, Error> => { return { mutation: async (fnOptions) => { const { data } = await postCallWithOptionalParam({ diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/RequestBody.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/RequestBody.gen.ts index 843f64910..c9ddd05a4 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/RequestBody.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/RequestBody.gen.ts @@ -4,7 +4,7 @@ import { type Options, postApiVbyApiVersionRequestBody } from '../../sdk.gen'; import type { UseMutationOptions } from '@pinia/colada'; import type { PostApiVbyApiVersionRequestBodyData } from '../../types.gen'; -export const postApiVbyApiVersionRequestBodyMutation = (options?: Options): UseMutationOptions, Error> => { +export const postApiVbyApiVersionRequestBodyMutation = (options?: Partial>): UseMutationOptions, Error> => { return { mutation: async (fnOptions) => { const { data } = await postApiVbyApiVersionRequestBody({ diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/Response.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/Response.gen.ts index fb4f50eab..89530aef9 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/Response.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/Response.gen.ts @@ -71,7 +71,7 @@ export const callWithResponseQuery = (options?: Options): }; }; -export const callWithDuplicateResponsesMutation = (options?: Options): UseMutationOptions, CallWithDuplicateResponsesError> => { +export const callWithDuplicateResponsesMutation = (options?: Partial>): UseMutationOptions, CallWithDuplicateResponsesError> => { return { mutation: async (fnOptions) => { const { data } = await callWithDuplicateResponses({ @@ -84,7 +84,7 @@ export const callWithDuplicateResponsesMutation = (options?: Options): UseMutationOptions, CallWithResponsesError> => { +export const callWithResponsesMutation = (options?: Partial>): UseMutationOptions, CallWithResponsesError> => { return { mutation: async (fnOptions) => { const { data } = await callWithResponses({ diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/Simple.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/Simple.gen.ts index e4d9c13d7..a65455dee 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/Simple.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/Simple.gen.ts @@ -55,7 +55,7 @@ export const apiVVersionODataControllerCountQuery = (options?: Options): UseMutationOptions, Error> => { +export const deleteCallWithoutParametersAndResponseMutation = (options?: Partial>): UseMutationOptions, Error> => { return { mutation: async (fnOptions) => { const { data } = await deleteCallWithoutParametersAndResponse({ @@ -84,7 +84,7 @@ export const getCallWithoutParametersAndResponseQuery = (options?: Options): UseMutationOptions, Error> => { +export const patchCallWithoutParametersAndResponseMutation = (options?: Partial>): UseMutationOptions, Error> => { return { mutation: async (fnOptions) => { const { data } = await patchCallWithoutParametersAndResponse({ @@ -97,7 +97,7 @@ export const patchCallWithoutParametersAndResponseMutation = (options?: Options< }; }; -export const postCallWithoutParametersAndResponseMutation = (options?: Options): UseMutationOptions, Error> => { +export const postCallWithoutParametersAndResponseMutation = (options?: Partial>): UseMutationOptions, Error> => { return { mutation: async (fnOptions) => { const { data } = await postCallWithoutParametersAndResponse({ @@ -110,7 +110,7 @@ export const postCallWithoutParametersAndResponseMutation = (options?: Options

): UseMutationOptions, Error> => { +export const putCallWithoutParametersAndResponseMutation = (options?: Partial>): UseMutationOptions, Error> => { return { mutation: async (fnOptions) => { const { data } = await putCallWithoutParametersAndResponse({ diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/Upload.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/Upload.gen.ts index 444d8f9ec..1283b29e6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/Upload.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/Upload.gen.ts @@ -4,7 +4,7 @@ import { type Options, uploadFile } from '../../sdk.gen'; import type { UseMutationOptions } from '@pinia/colada'; import type { UploadFileData, UploadFileResponse } from '../../types.gen'; -export const uploadFileMutation = (options: Options): UseMutationOptions, Error> => { +export const uploadFileMutation = (options?: Partial>): UseMutationOptions, Error> => { return { mutation: async (fnOptions) => { const { data } = await uploadFile({ diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/default.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/default.gen.ts index f11c6546a..fe770278b 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/default.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/default.gen.ts @@ -55,7 +55,7 @@ export const exportQuery = (options?: Options): UseQueryOptions): UseMutationOptions, Error> => { +export const patchApiVbyApiVersionNoTagMutation = (options?: Partial>): UseMutationOptions, Error> => { return { mutation: async (fnOptions) => { const { data } = await patchApiVbyApiVersionNoTag({ @@ -68,7 +68,7 @@ export const patchApiVbyApiVersionNoTagMutation = (options?: Options): UseMutationOptions, Error> => { +export const importMutation = (options?: Partial>): UseMutationOptions, Error> => { return { mutation: async (fnOptions) => { const { data } = await import_({ @@ -81,7 +81,7 @@ export const importMutation = (options: Options): UseMutationOptions }; }; -export const fooWowMutation = (options?: Options): UseMutationOptions, Error> => { +export const fooWowMutation = (options?: Partial>): UseMutationOptions, Error> => { return { mutation: async (fnOptions) => { const { data } = await fooWow({ diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/multipart.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/multipart.gen.ts index e47a721b5..3e923414b 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/multipart.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@pinia/colada/group-by-tag/@pinia/colada/multipart.gen.ts @@ -55,7 +55,7 @@ export const multipartResponseQuery = (options?: Options) }; }; -export const multipartRequestMutation = (options?: Options): UseMutationOptions, Error> => { +export const multipartRequestMutation = (options?: Partial>): UseMutationOptions, Error> => { return { mutation: async (fnOptions) => { const { data } = await multipartRequest({ -- 2.51.2 From 074a4598c050036b161a9e04a4b5acae98d97b82 Mon Sep 17 00:00:00 2001 From: Lubos Date: Thu, 4 Sep 2025 23:05:10 +0800 Subject: [PATCH 25/46] Create brave-seahorses-dream.md --- .changeset/brave-seahorses-dream.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/brave-seahorses-dream.md diff --git a/.changeset/brave-seahorses-dream.md b/.changeset/brave-seahorses-dream.md new file mode 100644 index 000000000..aec726579 --- /dev/null +++ b/.changeset/brave-seahorses-dream.md @@ -0,0 +1,5 @@ +--- +"@hey-api/openapi-ts": patch +--- + +fix(client): improve handling of plain text, falsy, and unserialized request bodies -- 2.51.2 From 876482dcdcd38598d911fdcd307ec90bcb991305 Mon Sep 17 00:00:00 2001 From: Dmitriy Brolnickij Date: Fri, 5 Sep 2025 05:26:41 +0700 Subject: [PATCH 26/46] docs(client-nuxt): add note about default `$fetch` for `composable` key --- docs/openapi-ts/clients/nuxt.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/openapi-ts/clients/nuxt.md b/docs/openapi-ts/clients/nuxt.md index 75280bf96..333914f49 100644 --- a/docs/openapi-ts/clients/nuxt.md +++ b/docs/openapi-ts/clients/nuxt.md @@ -175,6 +175,10 @@ Interceptors (middleware) can be used to modify requests before they're sent or You can pass any Nuxt/ofetch arguments to the client instance. +::: tip +If you omit `composable`, `$fetch` is used by default. +::: + ```js import { client } from 'client/client.gen'; -- 2.51.2 From 67e7b6304633a6a2cf1d8c15a7570a1f16977803 Mon Sep 17 00:00:00 2001 From: Dmitriy Brolnickij Date: Fri, 5 Sep 2025 05:29:01 +0700 Subject: [PATCH 27/46] feat(client-nuxt): set default `composable` to `$fetch` --- .../plugins/@hey-api/client-nuxt/bundle/client.ts | 2 +- .../src/plugins/@hey-api/client-nuxt/bundle/types.ts | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/packages/openapi-ts/src/plugins/@hey-api/client-nuxt/bundle/client.ts b/packages/openapi-ts/src/plugins/@hey-api/client-nuxt/bundle/client.ts index 636fad064..432ffbd40 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/client-nuxt/bundle/client.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/client-nuxt/bundle/client.ts @@ -59,7 +59,7 @@ export const createClient = (config: Config = {}): Client => { const request: Client['request'] = ({ asyncDataOptions, - composable, + composable = '$fetch', ...options }) => { const key = options.key; diff --git a/packages/openapi-ts/src/plugins/@hey-api/client-nuxt/bundle/types.ts b/packages/openapi-ts/src/plugins/@hey-api/client-nuxt/bundle/types.ts index 5d12b5c52..0290d9ec4 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/client-nuxt/bundle/types.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/client-nuxt/bundle/types.ts @@ -62,7 +62,7 @@ export interface Config } export interface RequestOptions< - TComposable extends Composable = Composable, + TComposable extends Composable = '$fetch', ResT = unknown, DefaultT = undefined, Url extends string = string, @@ -87,7 +87,7 @@ export interface RequestOptions< | 'sseMaxRetryDelay' > { asyncDataOptions?: AsyncDataOptions, DefaultT>; - composable: TComposable; + composable?: TComposable; key?: string; /** * Security mechanism(s) to use for the request. @@ -117,7 +117,7 @@ export interface ClientOptions { } type MethodFn = < - TComposable extends Composable, + TComposable extends Composable = '$fetch', ResT = unknown, TError = unknown, DefaultT = undefined, @@ -126,7 +126,7 @@ type MethodFn = < ) => RequestResult; type SseFn = < - TComposable extends Composable, + TComposable extends Composable = '$fetch', ResT = unknown, TError = unknown, DefaultT = undefined, @@ -135,7 +135,7 @@ type SseFn = < ) => Promise>>; type RequestFn = < - TComposable extends Composable, + TComposable extends Composable = '$fetch', ResT = unknown, TError = unknown, DefaultT = undefined, @@ -179,7 +179,7 @@ export type Client = CoreClient; type OmitKeys = Pick>; export type Options< - TComposable extends Composable, + TComposable extends Composable = '$fetch', TData extends TDataShape = TDataShape, ResT = unknown, DefaultT = undefined, -- 2.51.2 From 3b086651519283dec663a76e2af99fd9018393ca Mon Sep 17 00:00:00 2001 From: Dmitriy Brolnickij Date: Fri, 5 Sep 2025 05:34:28 +0700 Subject: [PATCH 28/46] feat(sdk): add default generic `$fetch` for `TComposable` in SDK options / methods for `client-nuxt` --- packages/openapi-ts/src/plugins/@hey-api/sdk/plugin.ts | 4 ++-- packages/openapi-ts/src/plugins/@hey-api/sdk/typeOptions.ts | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/openapi-ts/src/plugins/@hey-api/sdk/plugin.ts b/packages/openapi-ts/src/plugins/@hey-api/sdk/plugin.ts index 5466af08c..9673e225f 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/sdk/plugin.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/sdk/plugin.ts @@ -205,7 +205,7 @@ const generateClassSdk = ({ types: isNuxtClient ? [ { - // default: tsc.ots.string('$fetch'), + default: tsc.ots.string('$fetch'), extends: tsc.typeNode('Composable'), name: nuxtTypeComposable, }, @@ -379,7 +379,7 @@ const generateFlatSdk = ({ types: isNuxtClient ? [ { - // default: tsc.ots.string('$fetch'), + default: tsc.ots.string('$fetch'), extends: tsc.typeNode('Composable'), name: nuxtTypeComposable, }, diff --git a/packages/openapi-ts/src/plugins/@hey-api/sdk/typeOptions.ts b/packages/openapi-ts/src/plugins/@hey-api/sdk/typeOptions.ts index 50be94f18..64cfc8dee 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/sdk/typeOptions.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/sdk/typeOptions.ts @@ -86,6 +86,7 @@ export const createTypeOptions = ({ ? [ tsc.typeParameterDeclaration({ constraint: tsc.typeReferenceNode({ typeName: 'Composable' }), + defaultType: tsc.typeNode("'$fetch'"), name: 'TComposable', }), tsc.typeParameterDeclaration({ -- 2.51.2 From 1cd56c2ff44fee156707974e344e89d3a6fcb929 Mon Sep 17 00:00:00 2001 From: Dmitriy Brolnickij Date: Fri, 5 Sep 2025 05:50:25 +0700 Subject: [PATCH 29/46] fix(colada): isolate `client-nuxt` specific options shape (`composable`) --- .../plugins/@pinia/colada/mutationOptions.ts | 27 ++++++++++++++----- .../src/plugins/@pinia/colada/queryKey.ts | 5 ++-- .../src/plugins/@pinia/colada/queryOptions.ts | 27 ++++++++++++++----- .../src/plugins/@pinia/colada/utils.ts | 19 +++++++++++-- 4 files changed, 60 insertions(+), 18 deletions(-) diff --git a/packages/openapi-ts/src/plugins/@pinia/colada/mutationOptions.ts b/packages/openapi-ts/src/plugins/@pinia/colada/mutationOptions.ts index 0b34c9b30..d8d684b51 100644 --- a/packages/openapi-ts/src/plugins/@pinia/colada/mutationOptions.ts +++ b/packages/openapi-ts/src/plugins/@pinia/colada/mutationOptions.ts @@ -7,7 +7,12 @@ import { createOperationComment } from '../../shared/utils/operation'; import { handleMeta } from './meta'; import type { PluginState } from './state'; import type { PiniaColadaPlugin } from './types'; -import { useTypeData, useTypeError, useTypeResponse } from './utils'; +import { + getPublicTypeData, + useTypeData, + useTypeError, + useTypeResponse, +} from './utils'; const mutationOptionsType = 'UseMutationOptions'; @@ -46,6 +51,10 @@ export const createMutationOptions = ({ const typeData = useTypeData({ file, operation, plugin }); const typeError = useTypeError({ file, operation, plugin }); const typeResponse = useTypeResponse({ file, operation, plugin }); + const { isNuxtClient, strippedTypeData } = getPublicTypeData({ + plugin, + typeData, + }); const identifierMutationOptions = file.identifier({ $ref: `#/pinia-colada-mutation-options/${operation.id}`, @@ -108,9 +117,12 @@ export const createMutationOptions = ({ async: true, multiLine: true, parameters: [ - { - name: fnOptions, - }, + isNuxtClient + ? { + name: fnOptions, + type: `Partial<${strippedTypeData}>`, + } + : { name: fnOptions }, ], statements, }), @@ -136,11 +148,12 @@ export const createMutationOptions = ({ { isRequired: false, name: 'options', - type: `Partial<${typeData}>`, + type: `Partial<${strippedTypeData}>`, }, ], - // TODO: better types syntax - returnType: `${mutationOptionsType}<${typeResponse}, ${typeData}, ${typeError.name}>`, + returnType: isNuxtClient + ? `${mutationOptionsType}<${typeResponse}, ${strippedTypeData}, ${typeError.name}>` + : `${mutationOptionsType}<${typeResponse}, ${typeData}, ${typeError.name}>`, statements: [ tsc.returnStatement({ expression: tsc.objectExpression({ diff --git a/packages/openapi-ts/src/plugins/@pinia/colada/queryKey.ts b/packages/openapi-ts/src/plugins/@pinia/colada/queryKey.ts index 2209a813a..7d41ad3fe 100644 --- a/packages/openapi-ts/src/plugins/@pinia/colada/queryKey.ts +++ b/packages/openapi-ts/src/plugins/@pinia/colada/queryKey.ts @@ -7,7 +7,7 @@ import type { IR } from '../../../ir/types'; import { type Property, tsc } from '../../../tsc'; import { getClientBaseUrlKey } from '../../@hey-api/client-core/utils'; import type { PiniaColadaPlugin } from './types'; -import { useTypeData } from './utils'; +import { getPublicTypeData, useTypeData } from './utils'; const createQueryKeyFn = 'createQueryKey'; const queryKeyName = 'QueryKey'; @@ -352,6 +352,7 @@ export const queryKeyStatement = ({ plugin: PiniaColadaPlugin['Instance']; }) => { const typeData = useTypeData({ file, operation, plugin }); + const { strippedTypeData } = getPublicTypeData({ plugin, typeData }); const identifier = file.identifier({ // TODO: refactor for better cross-plugin compatibility $ref: `#/pinia-colada-query-key/${operation.id}`, @@ -367,7 +368,7 @@ export const queryKeyStatement = ({ { isRequired: hasOperationDataRequired(operation), name: 'options', - type: typeData, + type: strippedTypeData, }, ], statements: createQueryKeyLiteral({ diff --git a/packages/openapi-ts/src/plugins/@pinia/colada/queryOptions.ts b/packages/openapi-ts/src/plugins/@pinia/colada/queryOptions.ts index 78bf9fe0b..ada1e5e5d 100644 --- a/packages/openapi-ts/src/plugins/@pinia/colada/queryOptions.ts +++ b/packages/openapi-ts/src/plugins/@pinia/colada/queryOptions.ts @@ -16,7 +16,12 @@ import { } from './queryKey'; import type { PluginState } from './state'; import type { PiniaColadaPlugin } from './types'; -import { useTypeData, useTypeError, useTypeResponse } from './utils'; +import { + getPublicTypeData, + useTypeData, + useTypeError, + useTypeResponse, +} from './utils'; const queryOptionsType = 'UseQueryOptions'; const optionsParamName = 'options'; @@ -75,6 +80,10 @@ export const createQueryOptions = ({ const typeData = useTypeData({ file, operation, plugin }); const typeError = useTypeError({ file, operation, plugin }); const typeResponse = useTypeResponse({ file, operation, plugin }); + const { isNuxtClient, strippedTypeData } = getPublicTypeData({ + plugin, + typeData, + }); const identifierQueryOptions = file.identifier({ $ref: `#/pinia-colada-query-options/${operation.id}`, @@ -152,9 +161,12 @@ export const createQueryOptions = ({ async: true, multiLine: true, parameters: [ - { - name: fnOptions, - }, + isNuxtClient + ? { + name: fnOptions, + type: `Partial<${strippedTypeData}>`, + } + : { name: fnOptions }, ], statements, }), @@ -180,11 +192,12 @@ export const createQueryOptions = ({ { isRequired: isRequiredOptions, name: optionsParamName, - type: typeData, + type: strippedTypeData, }, ], - // TODO: better types syntax - returnType: `${queryOptionsType}<${typeResponse}, ${typeError.name}>`, + returnType: isNuxtClient + ? `${queryOptionsType}<${typeResponse}, ${strippedTypeData}, ${typeError.name}>` + : `${queryOptionsType}<${typeResponse}, ${typeError.name}>`, statements: [ tsc.returnStatement({ expression: tsc.objectExpression({ diff --git a/packages/openapi-ts/src/plugins/@pinia/colada/utils.ts b/packages/openapi-ts/src/plugins/@pinia/colada/utils.ts index 1856d8aab..f3fea9505 100644 --- a/packages/openapi-ts/src/plugins/@pinia/colada/utils.ts +++ b/packages/openapi-ts/src/plugins/@pinia/colada/utils.ts @@ -49,6 +49,22 @@ export const getFileForOperation = ({ }; }; +export const getPublicTypeData = ({ + plugin, + typeData, +}: { + plugin: PiniaColadaPlugin['Instance']; + typeData: string; +}) => { + const client = getClientPlugin(plugin.context.config); + const isNuxtClient = client.name === '@hey-api/client-nuxt'; + const strippedTypeData = isNuxtClient + ? `Omit<${typeData}, 'composable'>` + : typeData; + + return { isNuxtClient, strippedTypeData }; +}; + export const useTypeData = ({ file, operation, @@ -59,8 +75,7 @@ export const useTypeData = ({ plugin: PiniaColadaPlugin['Instance']; }) => { const pluginSdk = plugin.getPlugin('@hey-api/sdk')!; - const typeData = operationOptionsType({ file, operation, plugin: pluginSdk }); - return typeData; + return operationOptionsType({ file, operation, plugin: pluginSdk }); }; export const useTypeError = ({ -- 2.51.2 From 045c1edd3fd475547ae0ce8ce39ac0d1763a6833 Mon Sep 17 00:00:00 2001 From: Dmitriy Brolnickij Date: Fri, 5 Sep 2025 05:51:44 +0700 Subject: [PATCH 30/46] test(client-nuxt): update snapshots --- .../base-url-false/client/client.gen.ts | 2 +- .../base-url-false/client/types.gen.ts | 12 +-- .../base-url-number/client/client.gen.ts | 2 +- .../base-url-number/client/types.gen.ts | 12 +-- .../base-url-strict/client/client.gen.ts | 2 +- .../base-url-strict/client/types.gen.ts | 12 +-- .../base-url-string/client/client.gen.ts | 2 +- .../base-url-string/client/types.gen.ts | 12 +-- .../clean-false/client/client.gen.ts | 2 +- .../clean-false/client/types.gen.ts | 12 +-- .../client-nuxt/clean-false/sdk.gen.ts | 98 +++++++++---------- .../client-nuxt/default/client/client.gen.ts | 2 +- .../client-nuxt/default/client/types.gen.ts | 12 +-- .../@hey-api/client-nuxt/default/sdk.gen.ts | 98 +++++++++---------- .../sdk-client-optional/client/client.gen.ts | 2 +- .../sdk-client-optional/client/types.gen.ts | 12 +-- .../sdk-client-optional/sdk.gen.ts | 98 +++++++++---------- .../sdk-client-required/client/client.gen.ts | 2 +- .../sdk-client-required/client/types.gen.ts | 12 +-- .../sdk-client-required/sdk.gen.ts | 98 +++++++++---------- .../client/client.gen.ts | 2 +- .../tsconfig-nodenext-sdk/client/types.gen.ts | 12 +-- .../tsconfig-nodenext-sdk/sdk.gen.ts | 98 +++++++++---------- 23 files changed, 308 insertions(+), 308 deletions(-) diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/base-url-false/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/base-url-false/client/client.gen.ts index 60ad3b228..3dbbcd126 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/base-url-false/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/base-url-false/client/client.gen.ts @@ -61,7 +61,7 @@ export const createClient = (config: Config = {}): Client => { const request: Client['request'] = ({ asyncDataOptions, - composable, + composable = '$fetch', ...options }) => { const key = options.key; diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/base-url-false/client/types.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/base-url-false/client/types.gen.ts index c7c5399ca..ac663764d 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/base-url-false/client/types.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/base-url-false/client/types.gen.ts @@ -64,7 +64,7 @@ export interface Config } export interface RequestOptions< - TComposable extends Composable = Composable, + TComposable extends Composable = '$fetch', ResT = unknown, DefaultT = undefined, Url extends string = string, @@ -89,7 +89,7 @@ export interface RequestOptions< | 'sseMaxRetryDelay' > { asyncDataOptions?: AsyncDataOptions, DefaultT>; - composable: TComposable; + composable?: TComposable; key?: string; /** * Security mechanism(s) to use for the request. @@ -119,7 +119,7 @@ export interface ClientOptions { } type MethodFn = < - TComposable extends Composable, + TComposable extends Composable = '$fetch', ResT = unknown, TError = unknown, DefaultT = undefined, @@ -128,7 +128,7 @@ type MethodFn = < ) => RequestResult; type SseFn = < - TComposable extends Composable, + TComposable extends Composable = '$fetch', ResT = unknown, TError = unknown, DefaultT = undefined, @@ -137,7 +137,7 @@ type SseFn = < ) => Promise>>; type RequestFn = < - TComposable extends Composable, + TComposable extends Composable = '$fetch', ResT = unknown, TError = unknown, DefaultT = undefined, @@ -181,7 +181,7 @@ export type Client = CoreClient; type OmitKeys = Pick>; export type Options< - TComposable extends Composable, + TComposable extends Composable = '$fetch', TData extends TDataShape = TDataShape, ResT = unknown, DefaultT = undefined, diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/base-url-number/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/base-url-number/client/client.gen.ts index 60ad3b228..3dbbcd126 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/base-url-number/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/base-url-number/client/client.gen.ts @@ -61,7 +61,7 @@ export const createClient = (config: Config = {}): Client => { const request: Client['request'] = ({ asyncDataOptions, - composable, + composable = '$fetch', ...options }) => { const key = options.key; diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/base-url-number/client/types.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/base-url-number/client/types.gen.ts index c7c5399ca..ac663764d 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/base-url-number/client/types.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/base-url-number/client/types.gen.ts @@ -64,7 +64,7 @@ export interface Config } export interface RequestOptions< - TComposable extends Composable = Composable, + TComposable extends Composable = '$fetch', ResT = unknown, DefaultT = undefined, Url extends string = string, @@ -89,7 +89,7 @@ export interface RequestOptions< | 'sseMaxRetryDelay' > { asyncDataOptions?: AsyncDataOptions, DefaultT>; - composable: TComposable; + composable?: TComposable; key?: string; /** * Security mechanism(s) to use for the request. @@ -119,7 +119,7 @@ export interface ClientOptions { } type MethodFn = < - TComposable extends Composable, + TComposable extends Composable = '$fetch', ResT = unknown, TError = unknown, DefaultT = undefined, @@ -128,7 +128,7 @@ type MethodFn = < ) => RequestResult; type SseFn = < - TComposable extends Composable, + TComposable extends Composable = '$fetch', ResT = unknown, TError = unknown, DefaultT = undefined, @@ -137,7 +137,7 @@ type SseFn = < ) => Promise>>; type RequestFn = < - TComposable extends Composable, + TComposable extends Composable = '$fetch', ResT = unknown, TError = unknown, DefaultT = undefined, @@ -181,7 +181,7 @@ export type Client = CoreClient; type OmitKeys = Pick>; export type Options< - TComposable extends Composable, + TComposable extends Composable = '$fetch', TData extends TDataShape = TDataShape, ResT = unknown, DefaultT = undefined, diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/base-url-strict/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/base-url-strict/client/client.gen.ts index 60ad3b228..3dbbcd126 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/base-url-strict/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/base-url-strict/client/client.gen.ts @@ -61,7 +61,7 @@ export const createClient = (config: Config = {}): Client => { const request: Client['request'] = ({ asyncDataOptions, - composable, + composable = '$fetch', ...options }) => { const key = options.key; diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/base-url-strict/client/types.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/base-url-strict/client/types.gen.ts index c7c5399ca..ac663764d 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/base-url-strict/client/types.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/base-url-strict/client/types.gen.ts @@ -64,7 +64,7 @@ export interface Config } export interface RequestOptions< - TComposable extends Composable = Composable, + TComposable extends Composable = '$fetch', ResT = unknown, DefaultT = undefined, Url extends string = string, @@ -89,7 +89,7 @@ export interface RequestOptions< | 'sseMaxRetryDelay' > { asyncDataOptions?: AsyncDataOptions, DefaultT>; - composable: TComposable; + composable?: TComposable; key?: string; /** * Security mechanism(s) to use for the request. @@ -119,7 +119,7 @@ export interface ClientOptions { } type MethodFn = < - TComposable extends Composable, + TComposable extends Composable = '$fetch', ResT = unknown, TError = unknown, DefaultT = undefined, @@ -128,7 +128,7 @@ type MethodFn = < ) => RequestResult; type SseFn = < - TComposable extends Composable, + TComposable extends Composable = '$fetch', ResT = unknown, TError = unknown, DefaultT = undefined, @@ -137,7 +137,7 @@ type SseFn = < ) => Promise>>; type RequestFn = < - TComposable extends Composable, + TComposable extends Composable = '$fetch', ResT = unknown, TError = unknown, DefaultT = undefined, @@ -181,7 +181,7 @@ export type Client = CoreClient; type OmitKeys = Pick>; export type Options< - TComposable extends Composable, + TComposable extends Composable = '$fetch', TData extends TDataShape = TDataShape, ResT = unknown, DefaultT = undefined, diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/base-url-string/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/base-url-string/client/client.gen.ts index 60ad3b228..3dbbcd126 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/base-url-string/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/base-url-string/client/client.gen.ts @@ -61,7 +61,7 @@ export const createClient = (config: Config = {}): Client => { const request: Client['request'] = ({ asyncDataOptions, - composable, + composable = '$fetch', ...options }) => { const key = options.key; diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/base-url-string/client/types.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/base-url-string/client/types.gen.ts index c7c5399ca..ac663764d 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/base-url-string/client/types.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/base-url-string/client/types.gen.ts @@ -64,7 +64,7 @@ export interface Config } export interface RequestOptions< - TComposable extends Composable = Composable, + TComposable extends Composable = '$fetch', ResT = unknown, DefaultT = undefined, Url extends string = string, @@ -89,7 +89,7 @@ export interface RequestOptions< | 'sseMaxRetryDelay' > { asyncDataOptions?: AsyncDataOptions, DefaultT>; - composable: TComposable; + composable?: TComposable; key?: string; /** * Security mechanism(s) to use for the request. @@ -119,7 +119,7 @@ export interface ClientOptions { } type MethodFn = < - TComposable extends Composable, + TComposable extends Composable = '$fetch', ResT = unknown, TError = unknown, DefaultT = undefined, @@ -128,7 +128,7 @@ type MethodFn = < ) => RequestResult; type SseFn = < - TComposable extends Composable, + TComposable extends Composable = '$fetch', ResT = unknown, TError = unknown, DefaultT = undefined, @@ -137,7 +137,7 @@ type SseFn = < ) => Promise>>; type RequestFn = < - TComposable extends Composable, + TComposable extends Composable = '$fetch', ResT = unknown, TError = unknown, DefaultT = undefined, @@ -181,7 +181,7 @@ export type Client = CoreClient; type OmitKeys = Pick>; export type Options< - TComposable extends Composable, + TComposable extends Composable = '$fetch', TData extends TDataShape = TDataShape, ResT = unknown, DefaultT = undefined, diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/clean-false/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/clean-false/client/client.gen.ts index 60ad3b228..3dbbcd126 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/clean-false/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/clean-false/client/client.gen.ts @@ -61,7 +61,7 @@ export const createClient = (config: Config = {}): Client => { const request: Client['request'] = ({ asyncDataOptions, - composable, + composable = '$fetch', ...options }) => { const key = options.key; diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/clean-false/client/types.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/clean-false/client/types.gen.ts index c7c5399ca..ac663764d 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/clean-false/client/types.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/clean-false/client/types.gen.ts @@ -64,7 +64,7 @@ export interface Config } export interface RequestOptions< - TComposable extends Composable = Composable, + TComposable extends Composable = '$fetch', ResT = unknown, DefaultT = undefined, Url extends string = string, @@ -89,7 +89,7 @@ export interface RequestOptions< | 'sseMaxRetryDelay' > { asyncDataOptions?: AsyncDataOptions, DefaultT>; - composable: TComposable; + composable?: TComposable; key?: string; /** * Security mechanism(s) to use for the request. @@ -119,7 +119,7 @@ export interface ClientOptions { } type MethodFn = < - TComposable extends Composable, + TComposable extends Composable = '$fetch', ResT = unknown, TError = unknown, DefaultT = undefined, @@ -128,7 +128,7 @@ type MethodFn = < ) => RequestResult; type SseFn = < - TComposable extends Composable, + TComposable extends Composable = '$fetch', ResT = unknown, TError = unknown, DefaultT = undefined, @@ -137,7 +137,7 @@ type SseFn = < ) => Promise>>; type RequestFn = < - TComposable extends Composable, + TComposable extends Composable = '$fetch', ResT = unknown, TError = unknown, DefaultT = undefined, @@ -181,7 +181,7 @@ export type Client = CoreClient; type OmitKeys = Pick>; export type Options< - TComposable extends Composable, + TComposable extends Composable = '$fetch', TData extends TDataShape = TDataShape, ResT = unknown, DefaultT = undefined, diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/clean-false/sdk.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/clean-false/sdk.gen.ts index 06ac36806..44a4ecdf5 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/clean-false/sdk.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/clean-false/sdk.gen.ts @@ -4,7 +4,7 @@ import { type Options as ClientOptions, type Composable, type TDataShape, type C import type { ExportData, PatchApiVbyApiVersionNoTagData, ImportResponse, ImportData, FooWowData, ApiVVersionODataControllerCountResponse, ApiVVersionODataControllerCountData, GetApiVbyApiVersionSimpleOperationResponse, GetApiVbyApiVersionSimpleOperationData, GetApiVbyApiVersionSimpleOperationError, DeleteCallWithoutParametersAndResponseData, GetCallWithoutParametersAndResponseData, HeadCallWithoutParametersAndResponseData, OptionsCallWithoutParametersAndResponseData, PatchCallWithoutParametersAndResponseData, PostCallWithoutParametersAndResponseData, PutCallWithoutParametersAndResponseData, DeleteFooData3, CallWithDescriptionsData, DeprecatedCallData, CallWithParametersData, CallWithWeirdParameterNamesData, GetCallWithOptionalParamData, PostCallWithOptionalParamResponse, PostCallWithOptionalParamData, PostApiVbyApiVersionRequestBodyData, PostApiVbyApiVersionFormDataData, CallWithDefaultParametersData, CallWithDefaultOptionalParametersData, CallToTestOrderOfParamsData, DuplicateNameData, DuplicateName2Data, DuplicateName3Data, DuplicateName4Data, CallWithNoContentResponseResponse, CallWithNoContentResponseData, CallWithResponseAndNoContentResponseResponse, CallWithResponseAndNoContentResponseData, DummyAResponse, DummyAData, DummyBResponse, DummyBData, CallWithResponseResponse, CallWithResponseData, CallWithDuplicateResponsesResponse, CallWithDuplicateResponsesData, CallWithDuplicateResponsesError, CallWithResponsesResponse, CallWithResponsesData, CallWithResponsesError, CollectionFormatData, TypesResponse, TypesData, UploadFileResponse, UploadFileData, FileResponseResponse, FileResponseData, ComplexTypesResponse, ComplexTypesData, MultipartResponseResponse, MultipartResponseData, MultipartRequestData, ComplexParamsResponse, ComplexParamsData, CallWithResultFromHeaderData, TestErrorCodeData, NonAsciiæøåÆøÅöôêÊ字符串Response, NonAsciiæøåÆøÅöôêÊ字符串Data, PutWithFormUrlEncodedData } from './types.gen'; import { client as _heyApiClient } from './client.gen'; -export type Options = ClientOptions & { +export type Options = ClientOptions & { /** * You can provide a client instance returned by `createClient()` instead of * individual options. This might be also useful if you want to implement a @@ -18,21 +18,21 @@ export type Options; }; -export const export_ = (options: Options) => { +export const export_ = (options: Options) => { return (options.client ?? _heyApiClient).get({ url: '/api/v{api-version}/no+tag', ...options }); }; -export const patchApiVbyApiVersionNoTag = (options: Options) => { +export const patchApiVbyApiVersionNoTag = (options: Options) => { return (options.client ?? _heyApiClient).patch({ url: '/api/v{api-version}/no+tag', ...options }); }; -export const import_ = (options: Options) => { +export const import_ = (options: Options) => { return (options.client ?? _heyApiClient).post({ url: '/api/v{api-version}/no+tag', ...options, @@ -43,84 +43,84 @@ export const import_ = (options: Options) => { +export const fooWow = (options: Options) => { return (options.client ?? _heyApiClient).put({ url: '/api/v{api-version}/no+tag', ...options }); }; -export const apiVVersionODataControllerCount = (options: Options) => { +export const apiVVersionODataControllerCount = (options: Options) => { return (options.client ?? _heyApiClient).get({ url: '/api/v{api-version}/simple/$count', ...options }); }; -export const getApiVbyApiVersionSimpleOperation = (options: Options) => { +export const getApiVbyApiVersionSimpleOperation = (options: Options) => { return (options.client ?? _heyApiClient).get({ url: '/api/v{api-version}/simple:operation', ...options }); }; -export const deleteCallWithoutParametersAndResponse = (options: Options) => { +export const deleteCallWithoutParametersAndResponse = (options: Options) => { return (options.client ?? _heyApiClient).delete({ url: '/api/v{api-version}/simple', ...options }); }; -export const getCallWithoutParametersAndResponse = (options: Options) => { +export const getCallWithoutParametersAndResponse = (options: Options) => { return (options.client ?? _heyApiClient).get({ url: '/api/v{api-version}/simple', ...options }); }; -export const headCallWithoutParametersAndResponse = (options: Options) => { +export const headCallWithoutParametersAndResponse = (options: Options) => { return (options.client ?? _heyApiClient).head({ url: '/api/v{api-version}/simple', ...options }); }; -export const optionsCallWithoutParametersAndResponse = (options: Options) => { +export const optionsCallWithoutParametersAndResponse = (options: Options) => { return (options.client ?? _heyApiClient).options({ url: '/api/v{api-version}/simple', ...options }); }; -export const patchCallWithoutParametersAndResponse = (options: Options) => { +export const patchCallWithoutParametersAndResponse = (options: Options) => { return (options.client ?? _heyApiClient).patch({ url: '/api/v{api-version}/simple', ...options }); }; -export const postCallWithoutParametersAndResponse = (options: Options) => { +export const postCallWithoutParametersAndResponse = (options: Options) => { return (options.client ?? _heyApiClient).post({ url: '/api/v{api-version}/simple', ...options }); }; -export const putCallWithoutParametersAndResponse = (options: Options) => { +export const putCallWithoutParametersAndResponse = (options: Options) => { return (options.client ?? _heyApiClient).put({ url: '/api/v{api-version}/simple', ...options }); }; -export const deleteFoo = (options: Options) => { +export const deleteFoo = (options: Options) => { return (options.client ?? _heyApiClient).delete({ url: '/api/v{api-version}/foo/{foo_param}/bar/{BarParam}', ...options }); }; -export const callWithDescriptions = (options: Options) => { +export const callWithDescriptions = (options: Options) => { return (options.client ?? _heyApiClient).post({ url: '/api/v{api-version}/descriptions', ...options @@ -130,14 +130,14 @@ export const callWithDescriptions = (options: Options) => { +export const deprecatedCall = (options: Options) => { return (options.client ?? _heyApiClient).post({ url: '/api/v{api-version}/parameters/deprecated', ...options }); }; -export const callWithParameters = (options: Options) => { +export const callWithParameters = (options: Options) => { return (options.client ?? _heyApiClient).post({ url: '/api/v{api-version}/parameters/{parameterPath}', ...options, @@ -148,7 +148,7 @@ export const callWithParameters = (options: Options) => { +export const callWithWeirdParameterNames = (options: Options) => { return (options.client ?? _heyApiClient).post({ url: '/api/v{api-version}/parameters/{parameter.path.1}/{parameter-path-2}/{PARAMETER-PATH-3}', ...options, @@ -159,7 +159,7 @@ export const callWithWeirdParameterNames = (options: Options) => { +export const getCallWithOptionalParam = (options: Options) => { return (options.client ?? _heyApiClient).get({ url: '/api/v{api-version}/parameters', ...options, @@ -170,7 +170,7 @@ export const getCallWithOptionalParam = (options: Options) => { +export const postCallWithOptionalParam = (options: Options) => { return (options.client ?? _heyApiClient).post({ url: '/api/v{api-version}/parameters', ...options, @@ -181,7 +181,7 @@ export const postCallWithOptionalParam = (options: Options) => { +export const postApiVbyApiVersionRequestBody = (options: Options) => { return (options.client ?? _heyApiClient).post({ url: '/api/v{api-version}/requestBody', ...options, @@ -192,7 +192,7 @@ export const postApiVbyApiVersionRequestBody = (options: Options) => { +export const postApiVbyApiVersionFormData = (options: Options) => { return (options.client ?? _heyApiClient).post({ ...formDataBodySerializer, url: '/api/v{api-version}/formData', @@ -204,119 +204,119 @@ export const postApiVbyApiVersionFormData = (options: Options) => { +export const callWithDefaultParameters = (options: Options) => { return (options.client ?? _heyApiClient).get({ url: '/api/v{api-version}/defaults', ...options }); }; -export const callWithDefaultOptionalParameters = (options: Options) => { +export const callWithDefaultOptionalParameters = (options: Options) => { return (options.client ?? _heyApiClient).post({ url: '/api/v{api-version}/defaults', ...options }); }; -export const callToTestOrderOfParams = (options: Options) => { +export const callToTestOrderOfParams = (options: Options) => { return (options.client ?? _heyApiClient).put({ url: '/api/v{api-version}/defaults', ...options }); }; -export const duplicateName = (options: Options) => { +export const duplicateName = (options: Options) => { return (options.client ?? _heyApiClient).delete({ url: '/api/v{api-version}/duplicate', ...options }); }; -export const duplicateName2 = (options: Options) => { +export const duplicateName2 = (options: Options) => { return (options.client ?? _heyApiClient).get({ url: '/api/v{api-version}/duplicate', ...options }); }; -export const duplicateName3 = (options: Options) => { +export const duplicateName3 = (options: Options) => { return (options.client ?? _heyApiClient).post({ url: '/api/v{api-version}/duplicate', ...options }); }; -export const duplicateName4 = (options: Options) => { +export const duplicateName4 = (options: Options) => { return (options.client ?? _heyApiClient).put({ url: '/api/v{api-version}/duplicate', ...options }); }; -export const callWithNoContentResponse = (options: Options) => { +export const callWithNoContentResponse = (options: Options) => { return (options.client ?? _heyApiClient).get({ url: '/api/v{api-version}/no-content', ...options }); }; -export const callWithResponseAndNoContentResponse = (options: Options) => { +export const callWithResponseAndNoContentResponse = (options: Options) => { return (options.client ?? _heyApiClient).get({ url: '/api/v{api-version}/multiple-tags/response-and-no-content', ...options }); }; -export const dummyA = (options: Options) => { +export const dummyA = (options: Options) => { return (options.client ?? _heyApiClient).get({ url: '/api/v{api-version}/multiple-tags/a', ...options }); }; -export const dummyB = (options: Options) => { +export const dummyB = (options: Options) => { return (options.client ?? _heyApiClient).get({ url: '/api/v{api-version}/multiple-tags/b', ...options }); }; -export const callWithResponse = (options: Options) => { +export const callWithResponse = (options: Options) => { return (options.client ?? _heyApiClient).get({ url: '/api/v{api-version}/response', ...options }); }; -export const callWithDuplicateResponses = (options: Options) => { +export const callWithDuplicateResponses = (options: Options) => { return (options.client ?? _heyApiClient).post({ url: '/api/v{api-version}/response', ...options }); }; -export const callWithResponses = (options: Options) => { +export const callWithResponses = (options: Options) => { return (options.client ?? _heyApiClient).put({ url: '/api/v{api-version}/response', ...options }); }; -export const collectionFormat = (options: Options) => { +export const collectionFormat = (options: Options) => { return (options.client ?? _heyApiClient).get({ url: '/api/v{api-version}/collectionFormat', ...options }); }; -export const types = (options: Options) => { +export const types = (options: Options) => { return (options.client ?? _heyApiClient).get({ url: '/api/v{api-version}/types', ...options }); }; -export const uploadFile = (options: Options) => { +export const uploadFile = (options: Options) => { return (options.client ?? _heyApiClient).post({ ...urlSearchParamsBodySerializer, url: '/api/v{api-version}/upload', @@ -328,28 +328,28 @@ export const uploadFile = (options: Options) => { +export const fileResponse = (options: Options) => { return (options.client ?? _heyApiClient).get({ url: '/api/v{api-version}/file/{id}', ...options }); }; -export const complexTypes = (options: Options) => { +export const complexTypes = (options: Options) => { return (options.client ?? _heyApiClient).get({ url: '/api/v{api-version}/complex', ...options }); }; -export const multipartResponse = (options: Options) => { +export const multipartResponse = (options: Options) => { return (options.client ?? _heyApiClient).get({ url: '/api/v{api-version}/multipart', ...options }); }; -export const multipartRequest = (options: Options) => { +export const multipartRequest = (options: Options) => { return (options.client ?? _heyApiClient).post({ ...formDataBodySerializer, url: '/api/v{api-version}/multipart', @@ -361,7 +361,7 @@ export const multipartRequest = (options: Options) => { +export const complexParams = (options: Options) => { return (options.client ?? _heyApiClient).put({ url: '/api/v{api-version}/complex/{id}', ...options, @@ -372,21 +372,21 @@ export const complexParams = (options: Options) => { +export const callWithResultFromHeader = (options: Options) => { return (options.client ?? _heyApiClient).post({ url: '/api/v{api-version}/header', ...options }); }; -export const testErrorCode = (options: Options) => { +export const testErrorCode = (options: Options) => { return (options.client ?? _heyApiClient).post({ url: '/api/v{api-version}/error', ...options }); }; -export const nonAsciiæøåÆøÅöôêÊ字符串 = (options: Options) => { +export const nonAsciiæøåÆøÅöôêÊ字符串 = (options: Options) => { return (options.client ?? _heyApiClient).post({ url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串', ...options @@ -396,7 +396,7 @@ export const nonAsciiæøåÆøÅöôêÊ字符串 = (options: Options) => { +export const putWithFormUrlEncoded = (options: Options) => { return (options.client ?? _heyApiClient).put({ ...urlSearchParamsBodySerializer, url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串', diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/default/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/default/client/client.gen.ts index 60ad3b228..3dbbcd126 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/default/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/default/client/client.gen.ts @@ -61,7 +61,7 @@ export const createClient = (config: Config = {}): Client => { const request: Client['request'] = ({ asyncDataOptions, - composable, + composable = '$fetch', ...options }) => { const key = options.key; diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/default/client/types.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/default/client/types.gen.ts index c7c5399ca..ac663764d 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/default/client/types.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/default/client/types.gen.ts @@ -64,7 +64,7 @@ export interface Config } export interface RequestOptions< - TComposable extends Composable = Composable, + TComposable extends Composable = '$fetch', ResT = unknown, DefaultT = undefined, Url extends string = string, @@ -89,7 +89,7 @@ export interface RequestOptions< | 'sseMaxRetryDelay' > { asyncDataOptions?: AsyncDataOptions, DefaultT>; - composable: TComposable; + composable?: TComposable; key?: string; /** * Security mechanism(s) to use for the request. @@ -119,7 +119,7 @@ export interface ClientOptions { } type MethodFn = < - TComposable extends Composable, + TComposable extends Composable = '$fetch', ResT = unknown, TError = unknown, DefaultT = undefined, @@ -128,7 +128,7 @@ type MethodFn = < ) => RequestResult; type SseFn = < - TComposable extends Composable, + TComposable extends Composable = '$fetch', ResT = unknown, TError = unknown, DefaultT = undefined, @@ -137,7 +137,7 @@ type SseFn = < ) => Promise>>; type RequestFn = < - TComposable extends Composable, + TComposable extends Composable = '$fetch', ResT = unknown, TError = unknown, DefaultT = undefined, @@ -181,7 +181,7 @@ export type Client = CoreClient; type OmitKeys = Pick>; export type Options< - TComposable extends Composable, + TComposable extends Composable = '$fetch', TData extends TDataShape = TDataShape, ResT = unknown, DefaultT = undefined, diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/default/sdk.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/default/sdk.gen.ts index 06ac36806..44a4ecdf5 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/default/sdk.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/default/sdk.gen.ts @@ -4,7 +4,7 @@ import { type Options as ClientOptions, type Composable, type TDataShape, type C import type { ExportData, PatchApiVbyApiVersionNoTagData, ImportResponse, ImportData, FooWowData, ApiVVersionODataControllerCountResponse, ApiVVersionODataControllerCountData, GetApiVbyApiVersionSimpleOperationResponse, GetApiVbyApiVersionSimpleOperationData, GetApiVbyApiVersionSimpleOperationError, DeleteCallWithoutParametersAndResponseData, GetCallWithoutParametersAndResponseData, HeadCallWithoutParametersAndResponseData, OptionsCallWithoutParametersAndResponseData, PatchCallWithoutParametersAndResponseData, PostCallWithoutParametersAndResponseData, PutCallWithoutParametersAndResponseData, DeleteFooData3, CallWithDescriptionsData, DeprecatedCallData, CallWithParametersData, CallWithWeirdParameterNamesData, GetCallWithOptionalParamData, PostCallWithOptionalParamResponse, PostCallWithOptionalParamData, PostApiVbyApiVersionRequestBodyData, PostApiVbyApiVersionFormDataData, CallWithDefaultParametersData, CallWithDefaultOptionalParametersData, CallToTestOrderOfParamsData, DuplicateNameData, DuplicateName2Data, DuplicateName3Data, DuplicateName4Data, CallWithNoContentResponseResponse, CallWithNoContentResponseData, CallWithResponseAndNoContentResponseResponse, CallWithResponseAndNoContentResponseData, DummyAResponse, DummyAData, DummyBResponse, DummyBData, CallWithResponseResponse, CallWithResponseData, CallWithDuplicateResponsesResponse, CallWithDuplicateResponsesData, CallWithDuplicateResponsesError, CallWithResponsesResponse, CallWithResponsesData, CallWithResponsesError, CollectionFormatData, TypesResponse, TypesData, UploadFileResponse, UploadFileData, FileResponseResponse, FileResponseData, ComplexTypesResponse, ComplexTypesData, MultipartResponseResponse, MultipartResponseData, MultipartRequestData, ComplexParamsResponse, ComplexParamsData, CallWithResultFromHeaderData, TestErrorCodeData, NonAsciiæøåÆøÅöôêÊ字符串Response, NonAsciiæøåÆøÅöôêÊ字符串Data, PutWithFormUrlEncodedData } from './types.gen'; import { client as _heyApiClient } from './client.gen'; -export type Options = ClientOptions & { +export type Options = ClientOptions & { /** * You can provide a client instance returned by `createClient()` instead of * individual options. This might be also useful if you want to implement a @@ -18,21 +18,21 @@ export type Options; }; -export const export_ = (options: Options) => { +export const export_ = (options: Options) => { return (options.client ?? _heyApiClient).get({ url: '/api/v{api-version}/no+tag', ...options }); }; -export const patchApiVbyApiVersionNoTag = (options: Options) => { +export const patchApiVbyApiVersionNoTag = (options: Options) => { return (options.client ?? _heyApiClient).patch({ url: '/api/v{api-version}/no+tag', ...options }); }; -export const import_ = (options: Options) => { +export const import_ = (options: Options) => { return (options.client ?? _heyApiClient).post({ url: '/api/v{api-version}/no+tag', ...options, @@ -43,84 +43,84 @@ export const import_ = (options: Options) => { +export const fooWow = (options: Options) => { return (options.client ?? _heyApiClient).put({ url: '/api/v{api-version}/no+tag', ...options }); }; -export const apiVVersionODataControllerCount = (options: Options) => { +export const apiVVersionODataControllerCount = (options: Options) => { return (options.client ?? _heyApiClient).get({ url: '/api/v{api-version}/simple/$count', ...options }); }; -export const getApiVbyApiVersionSimpleOperation = (options: Options) => { +export const getApiVbyApiVersionSimpleOperation = (options: Options) => { return (options.client ?? _heyApiClient).get({ url: '/api/v{api-version}/simple:operation', ...options }); }; -export const deleteCallWithoutParametersAndResponse = (options: Options) => { +export const deleteCallWithoutParametersAndResponse = (options: Options) => { return (options.client ?? _heyApiClient).delete({ url: '/api/v{api-version}/simple', ...options }); }; -export const getCallWithoutParametersAndResponse = (options: Options) => { +export const getCallWithoutParametersAndResponse = (options: Options) => { return (options.client ?? _heyApiClient).get({ url: '/api/v{api-version}/simple', ...options }); }; -export const headCallWithoutParametersAndResponse = (options: Options) => { +export const headCallWithoutParametersAndResponse = (options: Options) => { return (options.client ?? _heyApiClient).head({ url: '/api/v{api-version}/simple', ...options }); }; -export const optionsCallWithoutParametersAndResponse = (options: Options) => { +export const optionsCallWithoutParametersAndResponse = (options: Options) => { return (options.client ?? _heyApiClient).options({ url: '/api/v{api-version}/simple', ...options }); }; -export const patchCallWithoutParametersAndResponse = (options: Options) => { +export const patchCallWithoutParametersAndResponse = (options: Options) => { return (options.client ?? _heyApiClient).patch({ url: '/api/v{api-version}/simple', ...options }); }; -export const postCallWithoutParametersAndResponse = (options: Options) => { +export const postCallWithoutParametersAndResponse = (options: Options) => { return (options.client ?? _heyApiClient).post({ url: '/api/v{api-version}/simple', ...options }); }; -export const putCallWithoutParametersAndResponse = (options: Options) => { +export const putCallWithoutParametersAndResponse = (options: Options) => { return (options.client ?? _heyApiClient).put({ url: '/api/v{api-version}/simple', ...options }); }; -export const deleteFoo = (options: Options) => { +export const deleteFoo = (options: Options) => { return (options.client ?? _heyApiClient).delete({ url: '/api/v{api-version}/foo/{foo_param}/bar/{BarParam}', ...options }); }; -export const callWithDescriptions = (options: Options) => { +export const callWithDescriptions = (options: Options) => { return (options.client ?? _heyApiClient).post({ url: '/api/v{api-version}/descriptions', ...options @@ -130,14 +130,14 @@ export const callWithDescriptions = (options: Options) => { +export const deprecatedCall = (options: Options) => { return (options.client ?? _heyApiClient).post({ url: '/api/v{api-version}/parameters/deprecated', ...options }); }; -export const callWithParameters = (options: Options) => { +export const callWithParameters = (options: Options) => { return (options.client ?? _heyApiClient).post({ url: '/api/v{api-version}/parameters/{parameterPath}', ...options, @@ -148,7 +148,7 @@ export const callWithParameters = (options: Options) => { +export const callWithWeirdParameterNames = (options: Options) => { return (options.client ?? _heyApiClient).post({ url: '/api/v{api-version}/parameters/{parameter.path.1}/{parameter-path-2}/{PARAMETER-PATH-3}', ...options, @@ -159,7 +159,7 @@ export const callWithWeirdParameterNames = (options: Options) => { +export const getCallWithOptionalParam = (options: Options) => { return (options.client ?? _heyApiClient).get({ url: '/api/v{api-version}/parameters', ...options, @@ -170,7 +170,7 @@ export const getCallWithOptionalParam = (options: Options) => { +export const postCallWithOptionalParam = (options: Options) => { return (options.client ?? _heyApiClient).post({ url: '/api/v{api-version}/parameters', ...options, @@ -181,7 +181,7 @@ export const postCallWithOptionalParam = (options: Options) => { +export const postApiVbyApiVersionRequestBody = (options: Options) => { return (options.client ?? _heyApiClient).post({ url: '/api/v{api-version}/requestBody', ...options, @@ -192,7 +192,7 @@ export const postApiVbyApiVersionRequestBody = (options: Options) => { +export const postApiVbyApiVersionFormData = (options: Options) => { return (options.client ?? _heyApiClient).post({ ...formDataBodySerializer, url: '/api/v{api-version}/formData', @@ -204,119 +204,119 @@ export const postApiVbyApiVersionFormData = (options: Options) => { +export const callWithDefaultParameters = (options: Options) => { return (options.client ?? _heyApiClient).get({ url: '/api/v{api-version}/defaults', ...options }); }; -export const callWithDefaultOptionalParameters = (options: Options) => { +export const callWithDefaultOptionalParameters = (options: Options) => { return (options.client ?? _heyApiClient).post({ url: '/api/v{api-version}/defaults', ...options }); }; -export const callToTestOrderOfParams = (options: Options) => { +export const callToTestOrderOfParams = (options: Options) => { return (options.client ?? _heyApiClient).put({ url: '/api/v{api-version}/defaults', ...options }); }; -export const duplicateName = (options: Options) => { +export const duplicateName = (options: Options) => { return (options.client ?? _heyApiClient).delete({ url: '/api/v{api-version}/duplicate', ...options }); }; -export const duplicateName2 = (options: Options) => { +export const duplicateName2 = (options: Options) => { return (options.client ?? _heyApiClient).get({ url: '/api/v{api-version}/duplicate', ...options }); }; -export const duplicateName3 = (options: Options) => { +export const duplicateName3 = (options: Options) => { return (options.client ?? _heyApiClient).post({ url: '/api/v{api-version}/duplicate', ...options }); }; -export const duplicateName4 = (options: Options) => { +export const duplicateName4 = (options: Options) => { return (options.client ?? _heyApiClient).put({ url: '/api/v{api-version}/duplicate', ...options }); }; -export const callWithNoContentResponse = (options: Options) => { +export const callWithNoContentResponse = (options: Options) => { return (options.client ?? _heyApiClient).get({ url: '/api/v{api-version}/no-content', ...options }); }; -export const callWithResponseAndNoContentResponse = (options: Options) => { +export const callWithResponseAndNoContentResponse = (options: Options) => { return (options.client ?? _heyApiClient).get({ url: '/api/v{api-version}/multiple-tags/response-and-no-content', ...options }); }; -export const dummyA = (options: Options) => { +export const dummyA = (options: Options) => { return (options.client ?? _heyApiClient).get({ url: '/api/v{api-version}/multiple-tags/a', ...options }); }; -export const dummyB = (options: Options) => { +export const dummyB = (options: Options) => { return (options.client ?? _heyApiClient).get({ url: '/api/v{api-version}/multiple-tags/b', ...options }); }; -export const callWithResponse = (options: Options) => { +export const callWithResponse = (options: Options) => { return (options.client ?? _heyApiClient).get({ url: '/api/v{api-version}/response', ...options }); }; -export const callWithDuplicateResponses = (options: Options) => { +export const callWithDuplicateResponses = (options: Options) => { return (options.client ?? _heyApiClient).post({ url: '/api/v{api-version}/response', ...options }); }; -export const callWithResponses = (options: Options) => { +export const callWithResponses = (options: Options) => { return (options.client ?? _heyApiClient).put({ url: '/api/v{api-version}/response', ...options }); }; -export const collectionFormat = (options: Options) => { +export const collectionFormat = (options: Options) => { return (options.client ?? _heyApiClient).get({ url: '/api/v{api-version}/collectionFormat', ...options }); }; -export const types = (options: Options) => { +export const types = (options: Options) => { return (options.client ?? _heyApiClient).get({ url: '/api/v{api-version}/types', ...options }); }; -export const uploadFile = (options: Options) => { +export const uploadFile = (options: Options) => { return (options.client ?? _heyApiClient).post({ ...urlSearchParamsBodySerializer, url: '/api/v{api-version}/upload', @@ -328,28 +328,28 @@ export const uploadFile = (options: Options) => { +export const fileResponse = (options: Options) => { return (options.client ?? _heyApiClient).get({ url: '/api/v{api-version}/file/{id}', ...options }); }; -export const complexTypes = (options: Options) => { +export const complexTypes = (options: Options) => { return (options.client ?? _heyApiClient).get({ url: '/api/v{api-version}/complex', ...options }); }; -export const multipartResponse = (options: Options) => { +export const multipartResponse = (options: Options) => { return (options.client ?? _heyApiClient).get({ url: '/api/v{api-version}/multipart', ...options }); }; -export const multipartRequest = (options: Options) => { +export const multipartRequest = (options: Options) => { return (options.client ?? _heyApiClient).post({ ...formDataBodySerializer, url: '/api/v{api-version}/multipart', @@ -361,7 +361,7 @@ export const multipartRequest = (options: Options) => { +export const complexParams = (options: Options) => { return (options.client ?? _heyApiClient).put({ url: '/api/v{api-version}/complex/{id}', ...options, @@ -372,21 +372,21 @@ export const complexParams = (options: Options) => { +export const callWithResultFromHeader = (options: Options) => { return (options.client ?? _heyApiClient).post({ url: '/api/v{api-version}/header', ...options }); }; -export const testErrorCode = (options: Options) => { +export const testErrorCode = (options: Options) => { return (options.client ?? _heyApiClient).post({ url: '/api/v{api-version}/error', ...options }); }; -export const nonAsciiæøåÆøÅöôêÊ字符串 = (options: Options) => { +export const nonAsciiæøåÆøÅöôêÊ字符串 = (options: Options) => { return (options.client ?? _heyApiClient).post({ url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串', ...options @@ -396,7 +396,7 @@ export const nonAsciiæøåÆøÅöôêÊ字符串 = (options: Options) => { +export const putWithFormUrlEncoded = (options: Options) => { return (options.client ?? _heyApiClient).put({ ...urlSearchParamsBodySerializer, url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串', diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/sdk-client-optional/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/sdk-client-optional/client/client.gen.ts index 60ad3b228..3dbbcd126 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/sdk-client-optional/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/sdk-client-optional/client/client.gen.ts @@ -61,7 +61,7 @@ export const createClient = (config: Config = {}): Client => { const request: Client['request'] = ({ asyncDataOptions, - composable, + composable = '$fetch', ...options }) => { const key = options.key; diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/sdk-client-optional/client/types.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/sdk-client-optional/client/types.gen.ts index c7c5399ca..ac663764d 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/sdk-client-optional/client/types.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/sdk-client-optional/client/types.gen.ts @@ -64,7 +64,7 @@ export interface Config } export interface RequestOptions< - TComposable extends Composable = Composable, + TComposable extends Composable = '$fetch', ResT = unknown, DefaultT = undefined, Url extends string = string, @@ -89,7 +89,7 @@ export interface RequestOptions< | 'sseMaxRetryDelay' > { asyncDataOptions?: AsyncDataOptions, DefaultT>; - composable: TComposable; + composable?: TComposable; key?: string; /** * Security mechanism(s) to use for the request. @@ -119,7 +119,7 @@ export interface ClientOptions { } type MethodFn = < - TComposable extends Composable, + TComposable extends Composable = '$fetch', ResT = unknown, TError = unknown, DefaultT = undefined, @@ -128,7 +128,7 @@ type MethodFn = < ) => RequestResult; type SseFn = < - TComposable extends Composable, + TComposable extends Composable = '$fetch', ResT = unknown, TError = unknown, DefaultT = undefined, @@ -137,7 +137,7 @@ type SseFn = < ) => Promise>>; type RequestFn = < - TComposable extends Composable, + TComposable extends Composable = '$fetch', ResT = unknown, TError = unknown, DefaultT = undefined, @@ -181,7 +181,7 @@ export type Client = CoreClient; type OmitKeys = Pick>; export type Options< - TComposable extends Composable, + TComposable extends Composable = '$fetch', TData extends TDataShape = TDataShape, ResT = unknown, DefaultT = undefined, diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/sdk-client-optional/sdk.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/sdk-client-optional/sdk.gen.ts index 06ac36806..44a4ecdf5 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/sdk-client-optional/sdk.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/sdk-client-optional/sdk.gen.ts @@ -4,7 +4,7 @@ import { type Options as ClientOptions, type Composable, type TDataShape, type C import type { ExportData, PatchApiVbyApiVersionNoTagData, ImportResponse, ImportData, FooWowData, ApiVVersionODataControllerCountResponse, ApiVVersionODataControllerCountData, GetApiVbyApiVersionSimpleOperationResponse, GetApiVbyApiVersionSimpleOperationData, GetApiVbyApiVersionSimpleOperationError, DeleteCallWithoutParametersAndResponseData, GetCallWithoutParametersAndResponseData, HeadCallWithoutParametersAndResponseData, OptionsCallWithoutParametersAndResponseData, PatchCallWithoutParametersAndResponseData, PostCallWithoutParametersAndResponseData, PutCallWithoutParametersAndResponseData, DeleteFooData3, CallWithDescriptionsData, DeprecatedCallData, CallWithParametersData, CallWithWeirdParameterNamesData, GetCallWithOptionalParamData, PostCallWithOptionalParamResponse, PostCallWithOptionalParamData, PostApiVbyApiVersionRequestBodyData, PostApiVbyApiVersionFormDataData, CallWithDefaultParametersData, CallWithDefaultOptionalParametersData, CallToTestOrderOfParamsData, DuplicateNameData, DuplicateName2Data, DuplicateName3Data, DuplicateName4Data, CallWithNoContentResponseResponse, CallWithNoContentResponseData, CallWithResponseAndNoContentResponseResponse, CallWithResponseAndNoContentResponseData, DummyAResponse, DummyAData, DummyBResponse, DummyBData, CallWithResponseResponse, CallWithResponseData, CallWithDuplicateResponsesResponse, CallWithDuplicateResponsesData, CallWithDuplicateResponsesError, CallWithResponsesResponse, CallWithResponsesData, CallWithResponsesError, CollectionFormatData, TypesResponse, TypesData, UploadFileResponse, UploadFileData, FileResponseResponse, FileResponseData, ComplexTypesResponse, ComplexTypesData, MultipartResponseResponse, MultipartResponseData, MultipartRequestData, ComplexParamsResponse, ComplexParamsData, CallWithResultFromHeaderData, TestErrorCodeData, NonAsciiæøåÆøÅöôêÊ字符串Response, NonAsciiæøåÆøÅöôêÊ字符串Data, PutWithFormUrlEncodedData } from './types.gen'; import { client as _heyApiClient } from './client.gen'; -export type Options = ClientOptions & { +export type Options = ClientOptions & { /** * You can provide a client instance returned by `createClient()` instead of * individual options. This might be also useful if you want to implement a @@ -18,21 +18,21 @@ export type Options; }; -export const export_ = (options: Options) => { +export const export_ = (options: Options) => { return (options.client ?? _heyApiClient).get({ url: '/api/v{api-version}/no+tag', ...options }); }; -export const patchApiVbyApiVersionNoTag = (options: Options) => { +export const patchApiVbyApiVersionNoTag = (options: Options) => { return (options.client ?? _heyApiClient).patch({ url: '/api/v{api-version}/no+tag', ...options }); }; -export const import_ = (options: Options) => { +export const import_ = (options: Options) => { return (options.client ?? _heyApiClient).post({ url: '/api/v{api-version}/no+tag', ...options, @@ -43,84 +43,84 @@ export const import_ = (options: Options) => { +export const fooWow = (options: Options) => { return (options.client ?? _heyApiClient).put({ url: '/api/v{api-version}/no+tag', ...options }); }; -export const apiVVersionODataControllerCount = (options: Options) => { +export const apiVVersionODataControllerCount = (options: Options) => { return (options.client ?? _heyApiClient).get({ url: '/api/v{api-version}/simple/$count', ...options }); }; -export const getApiVbyApiVersionSimpleOperation = (options: Options) => { +export const getApiVbyApiVersionSimpleOperation = (options: Options) => { return (options.client ?? _heyApiClient).get({ url: '/api/v{api-version}/simple:operation', ...options }); }; -export const deleteCallWithoutParametersAndResponse = (options: Options) => { +export const deleteCallWithoutParametersAndResponse = (options: Options) => { return (options.client ?? _heyApiClient).delete({ url: '/api/v{api-version}/simple', ...options }); }; -export const getCallWithoutParametersAndResponse = (options: Options) => { +export const getCallWithoutParametersAndResponse = (options: Options) => { return (options.client ?? _heyApiClient).get({ url: '/api/v{api-version}/simple', ...options }); }; -export const headCallWithoutParametersAndResponse = (options: Options) => { +export const headCallWithoutParametersAndResponse = (options: Options) => { return (options.client ?? _heyApiClient).head({ url: '/api/v{api-version}/simple', ...options }); }; -export const optionsCallWithoutParametersAndResponse = (options: Options) => { +export const optionsCallWithoutParametersAndResponse = (options: Options) => { return (options.client ?? _heyApiClient).options({ url: '/api/v{api-version}/simple', ...options }); }; -export const patchCallWithoutParametersAndResponse = (options: Options) => { +export const patchCallWithoutParametersAndResponse = (options: Options) => { return (options.client ?? _heyApiClient).patch({ url: '/api/v{api-version}/simple', ...options }); }; -export const postCallWithoutParametersAndResponse = (options: Options) => { +export const postCallWithoutParametersAndResponse = (options: Options) => { return (options.client ?? _heyApiClient).post({ url: '/api/v{api-version}/simple', ...options }); }; -export const putCallWithoutParametersAndResponse = (options: Options) => { +export const putCallWithoutParametersAndResponse = (options: Options) => { return (options.client ?? _heyApiClient).put({ url: '/api/v{api-version}/simple', ...options }); }; -export const deleteFoo = (options: Options) => { +export const deleteFoo = (options: Options) => { return (options.client ?? _heyApiClient).delete({ url: '/api/v{api-version}/foo/{foo_param}/bar/{BarParam}', ...options }); }; -export const callWithDescriptions = (options: Options) => { +export const callWithDescriptions = (options: Options) => { return (options.client ?? _heyApiClient).post({ url: '/api/v{api-version}/descriptions', ...options @@ -130,14 +130,14 @@ export const callWithDescriptions = (options: Options) => { +export const deprecatedCall = (options: Options) => { return (options.client ?? _heyApiClient).post({ url: '/api/v{api-version}/parameters/deprecated', ...options }); }; -export const callWithParameters = (options: Options) => { +export const callWithParameters = (options: Options) => { return (options.client ?? _heyApiClient).post({ url: '/api/v{api-version}/parameters/{parameterPath}', ...options, @@ -148,7 +148,7 @@ export const callWithParameters = (options: Options) => { +export const callWithWeirdParameterNames = (options: Options) => { return (options.client ?? _heyApiClient).post({ url: '/api/v{api-version}/parameters/{parameter.path.1}/{parameter-path-2}/{PARAMETER-PATH-3}', ...options, @@ -159,7 +159,7 @@ export const callWithWeirdParameterNames = (options: Options) => { +export const getCallWithOptionalParam = (options: Options) => { return (options.client ?? _heyApiClient).get({ url: '/api/v{api-version}/parameters', ...options, @@ -170,7 +170,7 @@ export const getCallWithOptionalParam = (options: Options) => { +export const postCallWithOptionalParam = (options: Options) => { return (options.client ?? _heyApiClient).post({ url: '/api/v{api-version}/parameters', ...options, @@ -181,7 +181,7 @@ export const postCallWithOptionalParam = (options: Options) => { +export const postApiVbyApiVersionRequestBody = (options: Options) => { return (options.client ?? _heyApiClient).post({ url: '/api/v{api-version}/requestBody', ...options, @@ -192,7 +192,7 @@ export const postApiVbyApiVersionRequestBody = (options: Options) => { +export const postApiVbyApiVersionFormData = (options: Options) => { return (options.client ?? _heyApiClient).post({ ...formDataBodySerializer, url: '/api/v{api-version}/formData', @@ -204,119 +204,119 @@ export const postApiVbyApiVersionFormData = (options: Options) => { +export const callWithDefaultParameters = (options: Options) => { return (options.client ?? _heyApiClient).get({ url: '/api/v{api-version}/defaults', ...options }); }; -export const callWithDefaultOptionalParameters = (options: Options) => { +export const callWithDefaultOptionalParameters = (options: Options) => { return (options.client ?? _heyApiClient).post({ url: '/api/v{api-version}/defaults', ...options }); }; -export const callToTestOrderOfParams = (options: Options) => { +export const callToTestOrderOfParams = (options: Options) => { return (options.client ?? _heyApiClient).put({ url: '/api/v{api-version}/defaults', ...options }); }; -export const duplicateName = (options: Options) => { +export const duplicateName = (options: Options) => { return (options.client ?? _heyApiClient).delete({ url: '/api/v{api-version}/duplicate', ...options }); }; -export const duplicateName2 = (options: Options) => { +export const duplicateName2 = (options: Options) => { return (options.client ?? _heyApiClient).get({ url: '/api/v{api-version}/duplicate', ...options }); }; -export const duplicateName3 = (options: Options) => { +export const duplicateName3 = (options: Options) => { return (options.client ?? _heyApiClient).post({ url: '/api/v{api-version}/duplicate', ...options }); }; -export const duplicateName4 = (options: Options) => { +export const duplicateName4 = (options: Options) => { return (options.client ?? _heyApiClient).put({ url: '/api/v{api-version}/duplicate', ...options }); }; -export const callWithNoContentResponse = (options: Options) => { +export const callWithNoContentResponse = (options: Options) => { return (options.client ?? _heyApiClient).get({ url: '/api/v{api-version}/no-content', ...options }); }; -export const callWithResponseAndNoContentResponse = (options: Options) => { +export const callWithResponseAndNoContentResponse = (options: Options) => { return (options.client ?? _heyApiClient).get({ url: '/api/v{api-version}/multiple-tags/response-and-no-content', ...options }); }; -export const dummyA = (options: Options) => { +export const dummyA = (options: Options) => { return (options.client ?? _heyApiClient).get({ url: '/api/v{api-version}/multiple-tags/a', ...options }); }; -export const dummyB = (options: Options) => { +export const dummyB = (options: Options) => { return (options.client ?? _heyApiClient).get({ url: '/api/v{api-version}/multiple-tags/b', ...options }); }; -export const callWithResponse = (options: Options) => { +export const callWithResponse = (options: Options) => { return (options.client ?? _heyApiClient).get({ url: '/api/v{api-version}/response', ...options }); }; -export const callWithDuplicateResponses = (options: Options) => { +export const callWithDuplicateResponses = (options: Options) => { return (options.client ?? _heyApiClient).post({ url: '/api/v{api-version}/response', ...options }); }; -export const callWithResponses = (options: Options) => { +export const callWithResponses = (options: Options) => { return (options.client ?? _heyApiClient).put({ url: '/api/v{api-version}/response', ...options }); }; -export const collectionFormat = (options: Options) => { +export const collectionFormat = (options: Options) => { return (options.client ?? _heyApiClient).get({ url: '/api/v{api-version}/collectionFormat', ...options }); }; -export const types = (options: Options) => { +export const types = (options: Options) => { return (options.client ?? _heyApiClient).get({ url: '/api/v{api-version}/types', ...options }); }; -export const uploadFile = (options: Options) => { +export const uploadFile = (options: Options) => { return (options.client ?? _heyApiClient).post({ ...urlSearchParamsBodySerializer, url: '/api/v{api-version}/upload', @@ -328,28 +328,28 @@ export const uploadFile = (options: Options) => { +export const fileResponse = (options: Options) => { return (options.client ?? _heyApiClient).get({ url: '/api/v{api-version}/file/{id}', ...options }); }; -export const complexTypes = (options: Options) => { +export const complexTypes = (options: Options) => { return (options.client ?? _heyApiClient).get({ url: '/api/v{api-version}/complex', ...options }); }; -export const multipartResponse = (options: Options) => { +export const multipartResponse = (options: Options) => { return (options.client ?? _heyApiClient).get({ url: '/api/v{api-version}/multipart', ...options }); }; -export const multipartRequest = (options: Options) => { +export const multipartRequest = (options: Options) => { return (options.client ?? _heyApiClient).post({ ...formDataBodySerializer, url: '/api/v{api-version}/multipart', @@ -361,7 +361,7 @@ export const multipartRequest = (options: Options) => { +export const complexParams = (options: Options) => { return (options.client ?? _heyApiClient).put({ url: '/api/v{api-version}/complex/{id}', ...options, @@ -372,21 +372,21 @@ export const complexParams = (options: Options) => { +export const callWithResultFromHeader = (options: Options) => { return (options.client ?? _heyApiClient).post({ url: '/api/v{api-version}/header', ...options }); }; -export const testErrorCode = (options: Options) => { +export const testErrorCode = (options: Options) => { return (options.client ?? _heyApiClient).post({ url: '/api/v{api-version}/error', ...options }); }; -export const nonAsciiæøåÆøÅöôêÊ字符串 = (options: Options) => { +export const nonAsciiæøåÆøÅöôêÊ字符串 = (options: Options) => { return (options.client ?? _heyApiClient).post({ url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串', ...options @@ -396,7 +396,7 @@ export const nonAsciiæøåÆøÅöôêÊ字符串 = (options: Options) => { +export const putWithFormUrlEncoded = (options: Options) => { return (options.client ?? _heyApiClient).put({ ...urlSearchParamsBodySerializer, url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串', diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/sdk-client-required/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/sdk-client-required/client/client.gen.ts index 60ad3b228..3dbbcd126 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/sdk-client-required/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/sdk-client-required/client/client.gen.ts @@ -61,7 +61,7 @@ export const createClient = (config: Config = {}): Client => { const request: Client['request'] = ({ asyncDataOptions, - composable, + composable = '$fetch', ...options }) => { const key = options.key; diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/sdk-client-required/client/types.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/sdk-client-required/client/types.gen.ts index c7c5399ca..ac663764d 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/sdk-client-required/client/types.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/sdk-client-required/client/types.gen.ts @@ -64,7 +64,7 @@ export interface Config } export interface RequestOptions< - TComposable extends Composable = Composable, + TComposable extends Composable = '$fetch', ResT = unknown, DefaultT = undefined, Url extends string = string, @@ -89,7 +89,7 @@ export interface RequestOptions< | 'sseMaxRetryDelay' > { asyncDataOptions?: AsyncDataOptions, DefaultT>; - composable: TComposable; + composable?: TComposable; key?: string; /** * Security mechanism(s) to use for the request. @@ -119,7 +119,7 @@ export interface ClientOptions { } type MethodFn = < - TComposable extends Composable, + TComposable extends Composable = '$fetch', ResT = unknown, TError = unknown, DefaultT = undefined, @@ -128,7 +128,7 @@ type MethodFn = < ) => RequestResult; type SseFn = < - TComposable extends Composable, + TComposable extends Composable = '$fetch', ResT = unknown, TError = unknown, DefaultT = undefined, @@ -137,7 +137,7 @@ type SseFn = < ) => Promise>>; type RequestFn = < - TComposable extends Composable, + TComposable extends Composable = '$fetch', ResT = unknown, TError = unknown, DefaultT = undefined, @@ -181,7 +181,7 @@ export type Client = CoreClient; type OmitKeys = Pick>; export type Options< - TComposable extends Composable, + TComposable extends Composable = '$fetch', TData extends TDataShape = TDataShape, ResT = unknown, DefaultT = undefined, diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/sdk-client-required/sdk.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/sdk-client-required/sdk.gen.ts index ea28cfbc7..072f4f212 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/sdk-client-required/sdk.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/sdk-client-required/sdk.gen.ts @@ -3,7 +3,7 @@ import { type Options as ClientOptions, type Composable, type TDataShape, type Client, formDataBodySerializer, urlSearchParamsBodySerializer } from './client'; import type { ExportData, PatchApiVbyApiVersionNoTagData, ImportResponse, ImportData, FooWowData, ApiVVersionODataControllerCountResponse, ApiVVersionODataControllerCountData, GetApiVbyApiVersionSimpleOperationResponse, GetApiVbyApiVersionSimpleOperationData, GetApiVbyApiVersionSimpleOperationError, DeleteCallWithoutParametersAndResponseData, GetCallWithoutParametersAndResponseData, HeadCallWithoutParametersAndResponseData, OptionsCallWithoutParametersAndResponseData, PatchCallWithoutParametersAndResponseData, PostCallWithoutParametersAndResponseData, PutCallWithoutParametersAndResponseData, DeleteFooData3, CallWithDescriptionsData, DeprecatedCallData, CallWithParametersData, CallWithWeirdParameterNamesData, GetCallWithOptionalParamData, PostCallWithOptionalParamResponse, PostCallWithOptionalParamData, PostApiVbyApiVersionRequestBodyData, PostApiVbyApiVersionFormDataData, CallWithDefaultParametersData, CallWithDefaultOptionalParametersData, CallToTestOrderOfParamsData, DuplicateNameData, DuplicateName2Data, DuplicateName3Data, DuplicateName4Data, CallWithNoContentResponseResponse, CallWithNoContentResponseData, CallWithResponseAndNoContentResponseResponse, CallWithResponseAndNoContentResponseData, DummyAResponse, DummyAData, DummyBResponse, DummyBData, CallWithResponseResponse, CallWithResponseData, CallWithDuplicateResponsesResponse, CallWithDuplicateResponsesData, CallWithDuplicateResponsesError, CallWithResponsesResponse, CallWithResponsesData, CallWithResponsesError, CollectionFormatData, TypesResponse, TypesData, UploadFileResponse, UploadFileData, FileResponseResponse, FileResponseData, ComplexTypesResponse, ComplexTypesData, MultipartResponseResponse, MultipartResponseData, MultipartRequestData, ComplexParamsResponse, ComplexParamsData, CallWithResultFromHeaderData, TestErrorCodeData, NonAsciiæøåÆøÅöôêÊ字符串Response, NonAsciiæøåÆøÅöôêÊ字符串Data, PutWithFormUrlEncodedData } from './types.gen'; -export type Options = ClientOptions & { +export type Options = ClientOptions & { /** * You can provide a client instance returned by `createClient()` instead of * individual options. This might be also useful if you want to implement a @@ -17,21 +17,21 @@ export type Options; }; -export const export_ = (options: Options) => { +export const export_ = (options: Options) => { return options.client.get({ url: '/api/v{api-version}/no+tag', ...options }); }; -export const patchApiVbyApiVersionNoTag = (options: Options) => { +export const patchApiVbyApiVersionNoTag = (options: Options) => { return options.client.patch({ url: '/api/v{api-version}/no+tag', ...options }); }; -export const import_ = (options: Options) => { +export const import_ = (options: Options) => { return options.client.post({ url: '/api/v{api-version}/no+tag', ...options, @@ -42,84 +42,84 @@ export const import_ = (options: Options) => { +export const fooWow = (options: Options) => { return options.client.put({ url: '/api/v{api-version}/no+tag', ...options }); }; -export const apiVVersionODataControllerCount = (options: Options) => { +export const apiVVersionODataControllerCount = (options: Options) => { return options.client.get({ url: '/api/v{api-version}/simple/$count', ...options }); }; -export const getApiVbyApiVersionSimpleOperation = (options: Options) => { +export const getApiVbyApiVersionSimpleOperation = (options: Options) => { return options.client.get({ url: '/api/v{api-version}/simple:operation', ...options }); }; -export const deleteCallWithoutParametersAndResponse = (options: Options) => { +export const deleteCallWithoutParametersAndResponse = (options: Options) => { return options.client.delete({ url: '/api/v{api-version}/simple', ...options }); }; -export const getCallWithoutParametersAndResponse = (options: Options) => { +export const getCallWithoutParametersAndResponse = (options: Options) => { return options.client.get({ url: '/api/v{api-version}/simple', ...options }); }; -export const headCallWithoutParametersAndResponse = (options: Options) => { +export const headCallWithoutParametersAndResponse = (options: Options) => { return options.client.head({ url: '/api/v{api-version}/simple', ...options }); }; -export const optionsCallWithoutParametersAndResponse = (options: Options) => { +export const optionsCallWithoutParametersAndResponse = (options: Options) => { return options.client.options({ url: '/api/v{api-version}/simple', ...options }); }; -export const patchCallWithoutParametersAndResponse = (options: Options) => { +export const patchCallWithoutParametersAndResponse = (options: Options) => { return options.client.patch({ url: '/api/v{api-version}/simple', ...options }); }; -export const postCallWithoutParametersAndResponse = (options: Options) => { +export const postCallWithoutParametersAndResponse = (options: Options) => { return options.client.post({ url: '/api/v{api-version}/simple', ...options }); }; -export const putCallWithoutParametersAndResponse = (options: Options) => { +export const putCallWithoutParametersAndResponse = (options: Options) => { return options.client.put({ url: '/api/v{api-version}/simple', ...options }); }; -export const deleteFoo = (options: Options) => { +export const deleteFoo = (options: Options) => { return options.client.delete({ url: '/api/v{api-version}/foo/{foo_param}/bar/{BarParam}', ...options }); }; -export const callWithDescriptions = (options: Options) => { +export const callWithDescriptions = (options: Options) => { return options.client.post({ url: '/api/v{api-version}/descriptions', ...options @@ -129,14 +129,14 @@ export const callWithDescriptions = (options: Options) => { +export const deprecatedCall = (options: Options) => { return options.client.post({ url: '/api/v{api-version}/parameters/deprecated', ...options }); }; -export const callWithParameters = (options: Options) => { +export const callWithParameters = (options: Options) => { return options.client.post({ url: '/api/v{api-version}/parameters/{parameterPath}', ...options, @@ -147,7 +147,7 @@ export const callWithParameters = (options: Options) => { +export const callWithWeirdParameterNames = (options: Options) => { return options.client.post({ url: '/api/v{api-version}/parameters/{parameter.path.1}/{parameter-path-2}/{PARAMETER-PATH-3}', ...options, @@ -158,7 +158,7 @@ export const callWithWeirdParameterNames = (options: Options) => { +export const getCallWithOptionalParam = (options: Options) => { return options.client.get({ url: '/api/v{api-version}/parameters', ...options, @@ -169,7 +169,7 @@ export const getCallWithOptionalParam = (options: Options) => { +export const postCallWithOptionalParam = (options: Options) => { return options.client.post({ url: '/api/v{api-version}/parameters', ...options, @@ -180,7 +180,7 @@ export const postCallWithOptionalParam = (options: Options) => { +export const postApiVbyApiVersionRequestBody = (options: Options) => { return options.client.post({ url: '/api/v{api-version}/requestBody', ...options, @@ -191,7 +191,7 @@ export const postApiVbyApiVersionRequestBody = (options: Options) => { +export const postApiVbyApiVersionFormData = (options: Options) => { return options.client.post({ ...formDataBodySerializer, url: '/api/v{api-version}/formData', @@ -203,119 +203,119 @@ export const postApiVbyApiVersionFormData = (options: Options) => { +export const callWithDefaultParameters = (options: Options) => { return options.client.get({ url: '/api/v{api-version}/defaults', ...options }); }; -export const callWithDefaultOptionalParameters = (options: Options) => { +export const callWithDefaultOptionalParameters = (options: Options) => { return options.client.post({ url: '/api/v{api-version}/defaults', ...options }); }; -export const callToTestOrderOfParams = (options: Options) => { +export const callToTestOrderOfParams = (options: Options) => { return options.client.put({ url: '/api/v{api-version}/defaults', ...options }); }; -export const duplicateName = (options: Options) => { +export const duplicateName = (options: Options) => { return options.client.delete({ url: '/api/v{api-version}/duplicate', ...options }); }; -export const duplicateName2 = (options: Options) => { +export const duplicateName2 = (options: Options) => { return options.client.get({ url: '/api/v{api-version}/duplicate', ...options }); }; -export const duplicateName3 = (options: Options) => { +export const duplicateName3 = (options: Options) => { return options.client.post({ url: '/api/v{api-version}/duplicate', ...options }); }; -export const duplicateName4 = (options: Options) => { +export const duplicateName4 = (options: Options) => { return options.client.put({ url: '/api/v{api-version}/duplicate', ...options }); }; -export const callWithNoContentResponse = (options: Options) => { +export const callWithNoContentResponse = (options: Options) => { return options.client.get({ url: '/api/v{api-version}/no-content', ...options }); }; -export const callWithResponseAndNoContentResponse = (options: Options) => { +export const callWithResponseAndNoContentResponse = (options: Options) => { return options.client.get({ url: '/api/v{api-version}/multiple-tags/response-and-no-content', ...options }); }; -export const dummyA = (options: Options) => { +export const dummyA = (options: Options) => { return options.client.get({ url: '/api/v{api-version}/multiple-tags/a', ...options }); }; -export const dummyB = (options: Options) => { +export const dummyB = (options: Options) => { return options.client.get({ url: '/api/v{api-version}/multiple-tags/b', ...options }); }; -export const callWithResponse = (options: Options) => { +export const callWithResponse = (options: Options) => { return options.client.get({ url: '/api/v{api-version}/response', ...options }); }; -export const callWithDuplicateResponses = (options: Options) => { +export const callWithDuplicateResponses = (options: Options) => { return options.client.post({ url: '/api/v{api-version}/response', ...options }); }; -export const callWithResponses = (options: Options) => { +export const callWithResponses = (options: Options) => { return options.client.put({ url: '/api/v{api-version}/response', ...options }); }; -export const collectionFormat = (options: Options) => { +export const collectionFormat = (options: Options) => { return options.client.get({ url: '/api/v{api-version}/collectionFormat', ...options }); }; -export const types = (options: Options) => { +export const types = (options: Options) => { return options.client.get({ url: '/api/v{api-version}/types', ...options }); }; -export const uploadFile = (options: Options) => { +export const uploadFile = (options: Options) => { return options.client.post({ ...urlSearchParamsBodySerializer, url: '/api/v{api-version}/upload', @@ -327,28 +327,28 @@ export const uploadFile = (options: Options) => { +export const fileResponse = (options: Options) => { return options.client.get({ url: '/api/v{api-version}/file/{id}', ...options }); }; -export const complexTypes = (options: Options) => { +export const complexTypes = (options: Options) => { return options.client.get({ url: '/api/v{api-version}/complex', ...options }); }; -export const multipartResponse = (options: Options) => { +export const multipartResponse = (options: Options) => { return options.client.get({ url: '/api/v{api-version}/multipart', ...options }); }; -export const multipartRequest = (options: Options) => { +export const multipartRequest = (options: Options) => { return options.client.post({ ...formDataBodySerializer, url: '/api/v{api-version}/multipart', @@ -360,7 +360,7 @@ export const multipartRequest = (options: Options) => { +export const complexParams = (options: Options) => { return options.client.put({ url: '/api/v{api-version}/complex/{id}', ...options, @@ -371,21 +371,21 @@ export const complexParams = (options: Options) => { +export const callWithResultFromHeader = (options: Options) => { return options.client.post({ url: '/api/v{api-version}/header', ...options }); }; -export const testErrorCode = (options: Options) => { +export const testErrorCode = (options: Options) => { return options.client.post({ url: '/api/v{api-version}/error', ...options }); }; -export const nonAsciiæøåÆøÅöôêÊ字符串 = (options: Options) => { +export const nonAsciiæøåÆøÅöôêÊ字符串 = (options: Options) => { return options.client.post({ url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串', ...options @@ -395,7 +395,7 @@ export const nonAsciiæøåÆøÅöôêÊ字符串 = (options: Options) => { +export const putWithFormUrlEncoded = (options: Options) => { return options.client.put({ ...urlSearchParamsBodySerializer, url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串', diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/tsconfig-nodenext-sdk/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/tsconfig-nodenext-sdk/client/client.gen.ts index 6d493327e..5bb268ce4 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/tsconfig-nodenext-sdk/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/tsconfig-nodenext-sdk/client/client.gen.ts @@ -61,7 +61,7 @@ export const createClient = (config: Config = {}): Client => { const request: Client['request'] = ({ asyncDataOptions, - composable, + composable = '$fetch', ...options }) => { const key = options.key; diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/tsconfig-nodenext-sdk/client/types.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/tsconfig-nodenext-sdk/client/types.gen.ts index 8f2449bf2..588c13b49 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/tsconfig-nodenext-sdk/client/types.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/tsconfig-nodenext-sdk/client/types.gen.ts @@ -64,7 +64,7 @@ export interface Config } export interface RequestOptions< - TComposable extends Composable = Composable, + TComposable extends Composable = '$fetch', ResT = unknown, DefaultT = undefined, Url extends string = string, @@ -89,7 +89,7 @@ export interface RequestOptions< | 'sseMaxRetryDelay' > { asyncDataOptions?: AsyncDataOptions, DefaultT>; - composable: TComposable; + composable?: TComposable; key?: string; /** * Security mechanism(s) to use for the request. @@ -119,7 +119,7 @@ export interface ClientOptions { } type MethodFn = < - TComposable extends Composable, + TComposable extends Composable = '$fetch', ResT = unknown, TError = unknown, DefaultT = undefined, @@ -128,7 +128,7 @@ type MethodFn = < ) => RequestResult; type SseFn = < - TComposable extends Composable, + TComposable extends Composable = '$fetch', ResT = unknown, TError = unknown, DefaultT = undefined, @@ -137,7 +137,7 @@ type SseFn = < ) => Promise>>; type RequestFn = < - TComposable extends Composable, + TComposable extends Composable = '$fetch', ResT = unknown, TError = unknown, DefaultT = undefined, @@ -181,7 +181,7 @@ export type Client = CoreClient; type OmitKeys = Pick>; export type Options< - TComposable extends Composable, + TComposable extends Composable = '$fetch', TData extends TDataShape = TDataShape, ResT = unknown, DefaultT = undefined, diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/tsconfig-nodenext-sdk/sdk.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/tsconfig-nodenext-sdk/sdk.gen.ts index c864e7df4..e8f4ff3c2 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/tsconfig-nodenext-sdk/sdk.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/tsconfig-nodenext-sdk/sdk.gen.ts @@ -4,7 +4,7 @@ import { type Options as ClientOptions, type Composable, type TDataShape, type C import type { ExportData, PatchApiVbyApiVersionNoTagData, ImportResponse, ImportData, FooWowData, ApiVVersionODataControllerCountResponse, ApiVVersionODataControllerCountData, GetApiVbyApiVersionSimpleOperationResponse, GetApiVbyApiVersionSimpleOperationData, GetApiVbyApiVersionSimpleOperationError, DeleteCallWithoutParametersAndResponseData, GetCallWithoutParametersAndResponseData, HeadCallWithoutParametersAndResponseData, OptionsCallWithoutParametersAndResponseData, PatchCallWithoutParametersAndResponseData, PostCallWithoutParametersAndResponseData, PutCallWithoutParametersAndResponseData, DeleteFooData3, CallWithDescriptionsData, DeprecatedCallData, CallWithParametersData, CallWithWeirdParameterNamesData, GetCallWithOptionalParamData, PostCallWithOptionalParamResponse, PostCallWithOptionalParamData, PostApiVbyApiVersionRequestBodyData, PostApiVbyApiVersionFormDataData, CallWithDefaultParametersData, CallWithDefaultOptionalParametersData, CallToTestOrderOfParamsData, DuplicateNameData, DuplicateName2Data, DuplicateName3Data, DuplicateName4Data, CallWithNoContentResponseResponse, CallWithNoContentResponseData, CallWithResponseAndNoContentResponseResponse, CallWithResponseAndNoContentResponseData, DummyAResponse, DummyAData, DummyBResponse, DummyBData, CallWithResponseResponse, CallWithResponseData, CallWithDuplicateResponsesResponse, CallWithDuplicateResponsesData, CallWithDuplicateResponsesError, CallWithResponsesResponse, CallWithResponsesData, CallWithResponsesError, CollectionFormatData, TypesResponse, TypesData, UploadFileResponse, UploadFileData, FileResponseResponse, FileResponseData, ComplexTypesResponse, ComplexTypesData, MultipartResponseResponse, MultipartResponseData, MultipartRequestData, ComplexParamsResponse, ComplexParamsData, CallWithResultFromHeaderData, TestErrorCodeData, NonAsciiæøåÆøÅöôêÊ字符串Response, NonAsciiæøåÆøÅöôêÊ字符串Data, PutWithFormUrlEncodedData } from './types.gen.js'; import { client as _heyApiClient } from './client.gen.js'; -export type Options = ClientOptions & { +export type Options = ClientOptions & { /** * You can provide a client instance returned by `createClient()` instead of * individual options. This might be also useful if you want to implement a @@ -18,21 +18,21 @@ export type Options; }; -export const export_ = (options: Options) => { +export const export_ = (options: Options) => { return (options.client ?? _heyApiClient).get({ url: '/api/v{api-version}/no+tag', ...options }); }; -export const patchApiVbyApiVersionNoTag = (options: Options) => { +export const patchApiVbyApiVersionNoTag = (options: Options) => { return (options.client ?? _heyApiClient).patch({ url: '/api/v{api-version}/no+tag', ...options }); }; -export const import_ = (options: Options) => { +export const import_ = (options: Options) => { return (options.client ?? _heyApiClient).post({ url: '/api/v{api-version}/no+tag', ...options, @@ -43,84 +43,84 @@ export const import_ = (options: Options) => { +export const fooWow = (options: Options) => { return (options.client ?? _heyApiClient).put({ url: '/api/v{api-version}/no+tag', ...options }); }; -export const apiVVersionODataControllerCount = (options: Options) => { +export const apiVVersionODataControllerCount = (options: Options) => { return (options.client ?? _heyApiClient).get({ url: '/api/v{api-version}/simple/$count', ...options }); }; -export const getApiVbyApiVersionSimpleOperation = (options: Options) => { +export const getApiVbyApiVersionSimpleOperation = (options: Options) => { return (options.client ?? _heyApiClient).get({ url: '/api/v{api-version}/simple:operation', ...options }); }; -export const deleteCallWithoutParametersAndResponse = (options: Options) => { +export const deleteCallWithoutParametersAndResponse = (options: Options) => { return (options.client ?? _heyApiClient).delete({ url: '/api/v{api-version}/simple', ...options }); }; -export const getCallWithoutParametersAndResponse = (options: Options) => { +export const getCallWithoutParametersAndResponse = (options: Options) => { return (options.client ?? _heyApiClient).get({ url: '/api/v{api-version}/simple', ...options }); }; -export const headCallWithoutParametersAndResponse = (options: Options) => { +export const headCallWithoutParametersAndResponse = (options: Options) => { return (options.client ?? _heyApiClient).head({ url: '/api/v{api-version}/simple', ...options }); }; -export const optionsCallWithoutParametersAndResponse = (options: Options) => { +export const optionsCallWithoutParametersAndResponse = (options: Options) => { return (options.client ?? _heyApiClient).options({ url: '/api/v{api-version}/simple', ...options }); }; -export const patchCallWithoutParametersAndResponse = (options: Options) => { +export const patchCallWithoutParametersAndResponse = (options: Options) => { return (options.client ?? _heyApiClient).patch({ url: '/api/v{api-version}/simple', ...options }); }; -export const postCallWithoutParametersAndResponse = (options: Options) => { +export const postCallWithoutParametersAndResponse = (options: Options) => { return (options.client ?? _heyApiClient).post({ url: '/api/v{api-version}/simple', ...options }); }; -export const putCallWithoutParametersAndResponse = (options: Options) => { +export const putCallWithoutParametersAndResponse = (options: Options) => { return (options.client ?? _heyApiClient).put({ url: '/api/v{api-version}/simple', ...options }); }; -export const deleteFoo = (options: Options) => { +export const deleteFoo = (options: Options) => { return (options.client ?? _heyApiClient).delete({ url: '/api/v{api-version}/foo/{foo_param}/bar/{BarParam}', ...options }); }; -export const callWithDescriptions = (options: Options) => { +export const callWithDescriptions = (options: Options) => { return (options.client ?? _heyApiClient).post({ url: '/api/v{api-version}/descriptions', ...options @@ -130,14 +130,14 @@ export const callWithDescriptions = (options: Options) => { +export const deprecatedCall = (options: Options) => { return (options.client ?? _heyApiClient).post({ url: '/api/v{api-version}/parameters/deprecated', ...options }); }; -export const callWithParameters = (options: Options) => { +export const callWithParameters = (options: Options) => { return (options.client ?? _heyApiClient).post({ url: '/api/v{api-version}/parameters/{parameterPath}', ...options, @@ -148,7 +148,7 @@ export const callWithParameters = (options: Options) => { +export const callWithWeirdParameterNames = (options: Options) => { return (options.client ?? _heyApiClient).post({ url: '/api/v{api-version}/parameters/{parameter.path.1}/{parameter-path-2}/{PARAMETER-PATH-3}', ...options, @@ -159,7 +159,7 @@ export const callWithWeirdParameterNames = (options: Options) => { +export const getCallWithOptionalParam = (options: Options) => { return (options.client ?? _heyApiClient).get({ url: '/api/v{api-version}/parameters', ...options, @@ -170,7 +170,7 @@ export const getCallWithOptionalParam = (options: Options) => { +export const postCallWithOptionalParam = (options: Options) => { return (options.client ?? _heyApiClient).post({ url: '/api/v{api-version}/parameters', ...options, @@ -181,7 +181,7 @@ export const postCallWithOptionalParam = (options: Options) => { +export const postApiVbyApiVersionRequestBody = (options: Options) => { return (options.client ?? _heyApiClient).post({ url: '/api/v{api-version}/requestBody', ...options, @@ -192,7 +192,7 @@ export const postApiVbyApiVersionRequestBody = (options: Options) => { +export const postApiVbyApiVersionFormData = (options: Options) => { return (options.client ?? _heyApiClient).post({ ...formDataBodySerializer, url: '/api/v{api-version}/formData', @@ -204,119 +204,119 @@ export const postApiVbyApiVersionFormData = (options: Options) => { +export const callWithDefaultParameters = (options: Options) => { return (options.client ?? _heyApiClient).get({ url: '/api/v{api-version}/defaults', ...options }); }; -export const callWithDefaultOptionalParameters = (options: Options) => { +export const callWithDefaultOptionalParameters = (options: Options) => { return (options.client ?? _heyApiClient).post({ url: '/api/v{api-version}/defaults', ...options }); }; -export const callToTestOrderOfParams = (options: Options) => { +export const callToTestOrderOfParams = (options: Options) => { return (options.client ?? _heyApiClient).put({ url: '/api/v{api-version}/defaults', ...options }); }; -export const duplicateName = (options: Options) => { +export const duplicateName = (options: Options) => { return (options.client ?? _heyApiClient).delete({ url: '/api/v{api-version}/duplicate', ...options }); }; -export const duplicateName2 = (options: Options) => { +export const duplicateName2 = (options: Options) => { return (options.client ?? _heyApiClient).get({ url: '/api/v{api-version}/duplicate', ...options }); }; -export const duplicateName3 = (options: Options) => { +export const duplicateName3 = (options: Options) => { return (options.client ?? _heyApiClient).post({ url: '/api/v{api-version}/duplicate', ...options }); }; -export const duplicateName4 = (options: Options) => { +export const duplicateName4 = (options: Options) => { return (options.client ?? _heyApiClient).put({ url: '/api/v{api-version}/duplicate', ...options }); }; -export const callWithNoContentResponse = (options: Options) => { +export const callWithNoContentResponse = (options: Options) => { return (options.client ?? _heyApiClient).get({ url: '/api/v{api-version}/no-content', ...options }); }; -export const callWithResponseAndNoContentResponse = (options: Options) => { +export const callWithResponseAndNoContentResponse = (options: Options) => { return (options.client ?? _heyApiClient).get({ url: '/api/v{api-version}/multiple-tags/response-and-no-content', ...options }); }; -export const dummyA = (options: Options) => { +export const dummyA = (options: Options) => { return (options.client ?? _heyApiClient).get({ url: '/api/v{api-version}/multiple-tags/a', ...options }); }; -export const dummyB = (options: Options) => { +export const dummyB = (options: Options) => { return (options.client ?? _heyApiClient).get({ url: '/api/v{api-version}/multiple-tags/b', ...options }); }; -export const callWithResponse = (options: Options) => { +export const callWithResponse = (options: Options) => { return (options.client ?? _heyApiClient).get({ url: '/api/v{api-version}/response', ...options }); }; -export const callWithDuplicateResponses = (options: Options) => { +export const callWithDuplicateResponses = (options: Options) => { return (options.client ?? _heyApiClient).post({ url: '/api/v{api-version}/response', ...options }); }; -export const callWithResponses = (options: Options) => { +export const callWithResponses = (options: Options) => { return (options.client ?? _heyApiClient).put({ url: '/api/v{api-version}/response', ...options }); }; -export const collectionFormat = (options: Options) => { +export const collectionFormat = (options: Options) => { return (options.client ?? _heyApiClient).get({ url: '/api/v{api-version}/collectionFormat', ...options }); }; -export const types = (options: Options) => { +export const types = (options: Options) => { return (options.client ?? _heyApiClient).get({ url: '/api/v{api-version}/types', ...options }); }; -export const uploadFile = (options: Options) => { +export const uploadFile = (options: Options) => { return (options.client ?? _heyApiClient).post({ ...urlSearchParamsBodySerializer, url: '/api/v{api-version}/upload', @@ -328,28 +328,28 @@ export const uploadFile = (options: Options) => { +export const fileResponse = (options: Options) => { return (options.client ?? _heyApiClient).get({ url: '/api/v{api-version}/file/{id}', ...options }); }; -export const complexTypes = (options: Options) => { +export const complexTypes = (options: Options) => { return (options.client ?? _heyApiClient).get({ url: '/api/v{api-version}/complex', ...options }); }; -export const multipartResponse = (options: Options) => { +export const multipartResponse = (options: Options) => { return (options.client ?? _heyApiClient).get({ url: '/api/v{api-version}/multipart', ...options }); }; -export const multipartRequest = (options: Options) => { +export const multipartRequest = (options: Options) => { return (options.client ?? _heyApiClient).post({ ...formDataBodySerializer, url: '/api/v{api-version}/multipart', @@ -361,7 +361,7 @@ export const multipartRequest = (options: Options) => { +export const complexParams = (options: Options) => { return (options.client ?? _heyApiClient).put({ url: '/api/v{api-version}/complex/{id}', ...options, @@ -372,21 +372,21 @@ export const complexParams = (options: Options) => { +export const callWithResultFromHeader = (options: Options) => { return (options.client ?? _heyApiClient).post({ url: '/api/v{api-version}/header', ...options }); }; -export const testErrorCode = (options: Options) => { +export const testErrorCode = (options: Options) => { return (options.client ?? _heyApiClient).post({ url: '/api/v{api-version}/error', ...options }); }; -export const nonAsciiæøåÆøÅöôêÊ字符串 = (options: Options) => { +export const nonAsciiæøåÆøÅöôêÊ字符串 = (options: Options) => { return (options.client ?? _heyApiClient).post({ url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串', ...options @@ -396,7 +396,7 @@ export const nonAsciiæøåÆøÅöôêÊ字符串 = (options: Options) => { +export const putWithFormUrlEncoded = (options: Options) => { return (options.client ?? _heyApiClient).put({ ...urlSearchParamsBodySerializer, url: '/api/v{api-version}/non-ascii-æøåÆØÅöôêÊ字符串', -- 2.51.2 From b5f57d1e2614bbf3c8a75d736ea4da69a77b1cbf Mon Sep 17 00:00:00 2001 From: Dmitriy Brolnickij Date: Fri, 5 Sep 2025 05:52:38 +0700 Subject: [PATCH 31/46] test(sse-nuxt): update snapshots --- .../3.1.x/sse-nuxt/client/client.gen.ts | 2 +- .../__snapshots__/3.1.x/sse-nuxt/client/types.gen.ts | 12 ++++++------ .../test/__snapshots__/3.1.x/sse-nuxt/sdk.gen.ts | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-nuxt/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-nuxt/client/client.gen.ts index 60ad3b228..3dbbcd126 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-nuxt/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-nuxt/client/client.gen.ts @@ -61,7 +61,7 @@ export const createClient = (config: Config = {}): Client => { const request: Client['request'] = ({ asyncDataOptions, - composable, + composable = '$fetch', ...options }) => { const key = options.key; diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-nuxt/client/types.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-nuxt/client/types.gen.ts index c7c5399ca..ac663764d 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-nuxt/client/types.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-nuxt/client/types.gen.ts @@ -64,7 +64,7 @@ export interface Config } export interface RequestOptions< - TComposable extends Composable = Composable, + TComposable extends Composable = '$fetch', ResT = unknown, DefaultT = undefined, Url extends string = string, @@ -89,7 +89,7 @@ export interface RequestOptions< | 'sseMaxRetryDelay' > { asyncDataOptions?: AsyncDataOptions, DefaultT>; - composable: TComposable; + composable?: TComposable; key?: string; /** * Security mechanism(s) to use for the request. @@ -119,7 +119,7 @@ export interface ClientOptions { } type MethodFn = < - TComposable extends Composable, + TComposable extends Composable = '$fetch', ResT = unknown, TError = unknown, DefaultT = undefined, @@ -128,7 +128,7 @@ type MethodFn = < ) => RequestResult; type SseFn = < - TComposable extends Composable, + TComposable extends Composable = '$fetch', ResT = unknown, TError = unknown, DefaultT = undefined, @@ -137,7 +137,7 @@ type SseFn = < ) => Promise>>; type RequestFn = < - TComposable extends Composable, + TComposable extends Composable = '$fetch', ResT = unknown, TError = unknown, DefaultT = undefined, @@ -181,7 +181,7 @@ export type Client = CoreClient; type OmitKeys = Pick>; export type Options< - TComposable extends Composable, + TComposable extends Composable = '$fetch', TData extends TDataShape = TDataShape, ResT = unknown, DefaultT = undefined, diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-nuxt/sdk.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-nuxt/sdk.gen.ts index 7f13d88c6..8ea786ea5 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-nuxt/sdk.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-nuxt/sdk.gen.ts @@ -4,7 +4,7 @@ import type { Options as ClientOptions, Composable, TDataShape, Client } from '. import type { EventSubscribeResponse, EventSubscribeData } from './types.gen'; import { client as _heyApiClient } from './client.gen'; -export type Options = ClientOptions & { +export type Options = ClientOptions & { /** * You can provide a client instance returned by `createClient()` instead of * individual options. This might be also useful if you want to implement a @@ -21,7 +21,7 @@ export type Options(options: Options) => { +export const eventSubscribe = (options: Options) => { return (options.client ?? _heyApiClient).sse.get({ url: '/event', ...options -- 2.51.2 From 7143078fde06b5b2fe00e7a7045317a2f5b40bb7 Mon Sep 17 00:00:00 2001 From: Dmitriy Brolnickij Date: Fri, 5 Sep 2025 06:11:14 +0700 Subject: [PATCH 32/46] chore: init changeset --- .changeset/implicit-fetch.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/implicit-fetch.md diff --git a/.changeset/implicit-fetch.md b/.changeset/implicit-fetch.md new file mode 100644 index 000000000..468fecb4d --- /dev/null +++ b/.changeset/implicit-fetch.md @@ -0,0 +1,5 @@ +--- +"@hey-api/openapi-ts": patch +--- + +feat(pinia-colada): implicit `$fetch` for `client-nuxt` (hide `composable`) -- 2.51.2 From f33bc1defa8a5dc4828f3cd1fe2268c1b3cf4398 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Fri, 5 Sep 2025 00:50:48 +0000 Subject: [PATCH 33/46] chore(docs): update contributors list --- docs/partials/contributors-list.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/partials/contributors-list.md b/docs/partials/contributors-list.md index 1896f9ef8..0f43a6f57 100644 --- a/docs/partials/contributors-list.md +++ b/docs/partials/contributors-list.md @@ -17,6 +17,7 @@ - [Daschi](https://github.com/Daschi1) - [David Bieregger](https://github.com/BierDav) - [David Ovčačík](https://github.com/dovca) +- [Dmitriy Brolnickij](https://github.com/brolnickij) - [Finn Poppinga](https://github.com/fpoppinga) - [Florian Lutze](https://github.com/flow96) - [Francisco García](https://github.com/goltra) -- 2.51.2 From c15b19a6e34a0501bed5b30f92be0f556110dd55 Mon Sep 17 00:00:00 2001 From: Fransis Young Date: Thu, 4 Sep 2025 23:19:13 -0400 Subject: [PATCH 34/46] fix(client-axios): ensures falsy request body can be serialized ensures request is sent with valid serialized or unserialized data resolves: #2599, related: #2553 --- .../client-axios/__tests__/client.test.ts | 87 ++++++++++++++++++- .../@hey-api/client-axios/bundle/client.ts | 21 ++++- 2 files changed, 105 insertions(+), 3 deletions(-) diff --git a/packages/openapi-ts/src/plugins/@hey-api/client-axios/__tests__/client.test.ts b/packages/openapi-ts/src/plugins/@hey-api/client-axios/__tests__/client.test.ts index 7291a0620..47f8ccb7a 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/client-axios/__tests__/client.test.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/client-axios/__tests__/client.test.ts @@ -1,5 +1,6 @@ +import type { AxiosInstance } from 'axios'; import axios from 'axios'; -import { describe, expect, it } from 'vitest'; +import { describe, expect, it, vi } from 'vitest'; import { createClient } from '../bundle/client'; @@ -83,3 +84,87 @@ describe('AxiosInstance', () => { ); }); }); + +describe('unserialized request body handling', () => { + const client = createClient({ baseURL: 'https://example.com' }); + + const scenarios = [ + { body: 0 }, + { body: false }, + { body: 'test string' }, + { body: '' }, + ]; + + it.each(scenarios)( + 'handles plain text body with $body value', + async ({ body }) => { + const mockAxios = vi.fn(); + + await client.post({ + axios: mockAxios as Partial as AxiosInstance, + body, + bodySerializer: null, + headers: { + 'Content-Type': 'text/plain', + }, + url: '/test', + }); + + expect(mockAxios).toHaveBeenCalledWith( + expect.objectContaining({ + data: body, + }), + ); + }, + ); +}); + +describe('serialized request body handling', () => { + const client = createClient({ baseURL: 'https://example.com' }); + + const scenarios = [ + { + body: '', + expectBodyValue: false, + serializedBody: '', + }, + { + body: 0, + expectBodyValue: true, + serializedBody: 0, + }, + { + body: false, + expectBodyValue: true, + serializedBody: false, + }, + { + body: {}, + expectBodyValue: true, + serializedBody: '{"key":"value"}', + }, + ]; + + it.each(scenarios)( + 'handles $serializedBody serializedBody value', + async ({ body, expectBodyValue, serializedBody }) => { + const mockAxios = vi.fn(); + + await client.post({ + axios: mockAxios as Partial as AxiosInstance, + body, + bodySerializer: () => serializedBody, + headers: { + 'Content-Type': 'application/json', + }, + url: '/test', + }); + + expect(mockAxios).toHaveBeenCalledWith( + expect.objectContaining({ + data: expectBodyValue ? serializedBody : null, + }), + ); + }, + ); +}); diff --git a/packages/openapi-ts/src/plugins/@hey-api/client-axios/bundle/client.ts b/packages/openapi-ts/src/plugins/@hey-api/client-axios/bundle/client.ts index 4d7b12159..f5ccdc200 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/client-axios/bundle/client.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/client-axios/bundle/client.ts @@ -57,7 +57,7 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.body = opts.bodySerializer(opts.body); } @@ -78,7 +78,7 @@ export const createClient = (config: Config = {}): Client => { const response = await _axios({ ...optsWithoutAuth, baseURL: opts.baseURL as string, - data: opts.body, + data: getValidRequestBody(opts), headers: opts.headers as RawAxiosRequestHeaders, // let `paramsSerializer()` handle query params if it exists params: opts.paramsSerializer ? opts.query : undefined, @@ -112,6 +112,23 @@ export const createClient = (config: Config = {}): Client => { } }; + function getValidRequestBody(options: RequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); -- 2.51.2 From 7048a91479dcf2242a41dd156057da6df0a985e9 Mon Sep 17 00:00:00 2001 From: Fransis Young Date: Fri, 5 Sep 2025 00:11:22 -0400 Subject: [PATCH 35/46] chore(client): updates snapshots refs: #2599 --- .../axios/client/client.gen.ts | 21 +++++++++++++++++-- .../react-query/axios/client/client.gen.ts | 21 +++++++++++++++++-- .../solid-query/axios/client/client.gen.ts | 21 +++++++++++++++++-- .../svelte-query/axios/client/client.gen.ts | 21 +++++++++++++++++-- .../vue-query/axios/client/client.gen.ts | 21 +++++++++++++++++-- .../3.0.x/content-types/client/client.gen.ts | 21 +++++++++++++++++-- .../client/client.gen.ts | 21 +++++++++++++++++-- .../axios/client/client.gen.ts | 21 +++++++++++++++++-- .../react-query/axios/client/client.gen.ts | 21 +++++++++++++++++-- .../solid-query/axios/client/client.gen.ts | 21 +++++++++++++++++-- .../svelte-query/axios/client/client.gen.ts | 21 +++++++++++++++++-- .../vue-query/axios/client/client.gen.ts | 21 +++++++++++++++++-- .../base-url-false/client/client.gen.ts | 21 +++++++++++++++++-- .../base-url-number/client/client.gen.ts | 21 +++++++++++++++++-- .../base-url-strict/client/client.gen.ts | 21 +++++++++++++++++-- .../base-url-string/client/client.gen.ts | 21 +++++++++++++++++-- .../clean-false/client/client.gen.ts | 21 +++++++++++++++++-- .../client-axios/default/client/client.gen.ts | 21 +++++++++++++++++-- .../sdk-client-optional/client/client.gen.ts | 21 +++++++++++++++++-- .../sdk-client-required/client/client.gen.ts | 21 +++++++++++++++++-- .../client/client.gen.ts | 21 +++++++++++++++++-- .../3.1.x/content-types/client/client.gen.ts | 21 +++++++++++++++++-- .../client/client.gen.ts | 21 +++++++++++++++++-- .../axios/client/client.gen.ts | 21 +++++++++++++++++-- .../react-query/axios/client/client.gen.ts | 21 +++++++++++++++++-- .../solid-query/axios/client/client.gen.ts | 21 +++++++++++++++++-- .../svelte-query/axios/client/client.gen.ts | 21 +++++++++++++++++-- .../vue-query/axios/client/client.gen.ts | 21 +++++++++++++++++-- .../3.1.x/sse-axios/client/client.gen.ts | 21 +++++++++++++++++-- 29 files changed, 551 insertions(+), 58 deletions(-) diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/axios/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/axios/client/client.gen.ts index 06ff1ec77..a08594b65 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/axios/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/axios/client/client.gen.ts @@ -59,7 +59,7 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.body = opts.bodySerializer(opts.body); } @@ -80,7 +80,7 @@ export const createClient = (config: Config = {}): Client => { const response = await _axios({ ...optsWithoutAuth, baseURL: opts.baseURL as string, - data: opts.body, + data: getValidRequestBody(opts), headers: opts.headers as RawAxiosRequestHeaders, // let `paramsSerializer()` handle query params if it exists params: opts.paramsSerializer ? opts.query : undefined, @@ -114,6 +114,23 @@ export const createClient = (config: Config = {}): Client => { } }; + function getValidRequestBody(options: RequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/react-query/axios/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/react-query/axios/client/client.gen.ts index 06ff1ec77..a08594b65 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/react-query/axios/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/react-query/axios/client/client.gen.ts @@ -59,7 +59,7 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.body = opts.bodySerializer(opts.body); } @@ -80,7 +80,7 @@ export const createClient = (config: Config = {}): Client => { const response = await _axios({ ...optsWithoutAuth, baseURL: opts.baseURL as string, - data: opts.body, + data: getValidRequestBody(opts), headers: opts.headers as RawAxiosRequestHeaders, // let `paramsSerializer()` handle query params if it exists params: opts.paramsSerializer ? opts.query : undefined, @@ -114,6 +114,23 @@ export const createClient = (config: Config = {}): Client => { } }; + function getValidRequestBody(options: RequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/solid-query/axios/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/solid-query/axios/client/client.gen.ts index 06ff1ec77..a08594b65 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/solid-query/axios/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/solid-query/axios/client/client.gen.ts @@ -59,7 +59,7 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.body = opts.bodySerializer(opts.body); } @@ -80,7 +80,7 @@ export const createClient = (config: Config = {}): Client => { const response = await _axios({ ...optsWithoutAuth, baseURL: opts.baseURL as string, - data: opts.body, + data: getValidRequestBody(opts), headers: opts.headers as RawAxiosRequestHeaders, // let `paramsSerializer()` handle query params if it exists params: opts.paramsSerializer ? opts.query : undefined, @@ -114,6 +114,23 @@ export const createClient = (config: Config = {}): Client => { } }; + function getValidRequestBody(options: RequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/svelte-query/axios/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/svelte-query/axios/client/client.gen.ts index 06ff1ec77..a08594b65 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/svelte-query/axios/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/svelte-query/axios/client/client.gen.ts @@ -59,7 +59,7 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.body = opts.bodySerializer(opts.body); } @@ -80,7 +80,7 @@ export const createClient = (config: Config = {}): Client => { const response = await _axios({ ...optsWithoutAuth, baseURL: opts.baseURL as string, - data: opts.body, + data: getValidRequestBody(opts), headers: opts.headers as RawAxiosRequestHeaders, // let `paramsSerializer()` handle query params if it exists params: opts.paramsSerializer ? opts.query : undefined, @@ -114,6 +114,23 @@ export const createClient = (config: Config = {}): Client => { } }; + function getValidRequestBody(options: RequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/vue-query/axios/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/vue-query/axios/client/client.gen.ts index 06ff1ec77..a08594b65 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/vue-query/axios/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/vue-query/axios/client/client.gen.ts @@ -59,7 +59,7 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.body = opts.bodySerializer(opts.body); } @@ -80,7 +80,7 @@ export const createClient = (config: Config = {}): Client => { const response = await _axios({ ...optsWithoutAuth, baseURL: opts.baseURL as string, - data: opts.body, + data: getValidRequestBody(opts), headers: opts.headers as RawAxiosRequestHeaders, // let `paramsSerializer()` handle query params if it exists params: opts.paramsSerializer ? opts.query : undefined, @@ -114,6 +114,23 @@ export const createClient = (config: Config = {}): Client => { } }; + function getValidRequestBody(options: RequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/content-types/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/content-types/client/client.gen.ts index 06ff1ec77..a08594b65 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/content-types/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/content-types/client/client.gen.ts @@ -59,7 +59,7 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.body = opts.bodySerializer(opts.body); } @@ -80,7 +80,7 @@ export const createClient = (config: Config = {}): Client => { const response = await _axios({ ...optsWithoutAuth, baseURL: opts.baseURL as string, - data: opts.body, + data: getValidRequestBody(opts), headers: opts.headers as RawAxiosRequestHeaders, // let `paramsSerializer()` handle query params if it exists params: opts.paramsSerializer ? opts.query : undefined, @@ -114,6 +114,23 @@ export const createClient = (config: Config = {}): Client => { } }; + function getValidRequestBody(options: RequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/parameter-explode-false-axios/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/parameter-explode-false-axios/client/client.gen.ts index 06ff1ec77..a08594b65 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/parameter-explode-false-axios/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/parameter-explode-false-axios/client/client.gen.ts @@ -59,7 +59,7 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.body = opts.bodySerializer(opts.body); } @@ -80,7 +80,7 @@ export const createClient = (config: Config = {}): Client => { const response = await _axios({ ...optsWithoutAuth, baseURL: opts.baseURL as string, - data: opts.body, + data: getValidRequestBody(opts), headers: opts.headers as RawAxiosRequestHeaders, // let `paramsSerializer()` handle query params if it exists params: opts.paramsSerializer ? opts.query : undefined, @@ -114,6 +114,23 @@ export const createClient = (config: Config = {}): Client => { } }; + function getValidRequestBody(options: RequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/angular-query-experimental/axios/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/angular-query-experimental/axios/client/client.gen.ts index 06ff1ec77..a08594b65 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/angular-query-experimental/axios/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/angular-query-experimental/axios/client/client.gen.ts @@ -59,7 +59,7 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.body = opts.bodySerializer(opts.body); } @@ -80,7 +80,7 @@ export const createClient = (config: Config = {}): Client => { const response = await _axios({ ...optsWithoutAuth, baseURL: opts.baseURL as string, - data: opts.body, + data: getValidRequestBody(opts), headers: opts.headers as RawAxiosRequestHeaders, // let `paramsSerializer()` handle query params if it exists params: opts.paramsSerializer ? opts.query : undefined, @@ -114,6 +114,23 @@ export const createClient = (config: Config = {}): Client => { } }; + function getValidRequestBody(options: RequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/react-query/axios/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/react-query/axios/client/client.gen.ts index 06ff1ec77..a08594b65 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/react-query/axios/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/react-query/axios/client/client.gen.ts @@ -59,7 +59,7 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.body = opts.bodySerializer(opts.body); } @@ -80,7 +80,7 @@ export const createClient = (config: Config = {}): Client => { const response = await _axios({ ...optsWithoutAuth, baseURL: opts.baseURL as string, - data: opts.body, + data: getValidRequestBody(opts), headers: opts.headers as RawAxiosRequestHeaders, // let `paramsSerializer()` handle query params if it exists params: opts.paramsSerializer ? opts.query : undefined, @@ -114,6 +114,23 @@ export const createClient = (config: Config = {}): Client => { } }; + function getValidRequestBody(options: RequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/solid-query/axios/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/solid-query/axios/client/client.gen.ts index 06ff1ec77..a08594b65 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/solid-query/axios/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/solid-query/axios/client/client.gen.ts @@ -59,7 +59,7 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.body = opts.bodySerializer(opts.body); } @@ -80,7 +80,7 @@ export const createClient = (config: Config = {}): Client => { const response = await _axios({ ...optsWithoutAuth, baseURL: opts.baseURL as string, - data: opts.body, + data: getValidRequestBody(opts), headers: opts.headers as RawAxiosRequestHeaders, // let `paramsSerializer()` handle query params if it exists params: opts.paramsSerializer ? opts.query : undefined, @@ -114,6 +114,23 @@ export const createClient = (config: Config = {}): Client => { } }; + function getValidRequestBody(options: RequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/svelte-query/axios/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/svelte-query/axios/client/client.gen.ts index 06ff1ec77..a08594b65 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/svelte-query/axios/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/svelte-query/axios/client/client.gen.ts @@ -59,7 +59,7 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.body = opts.bodySerializer(opts.body); } @@ -80,7 +80,7 @@ export const createClient = (config: Config = {}): Client => { const response = await _axios({ ...optsWithoutAuth, baseURL: opts.baseURL as string, - data: opts.body, + data: getValidRequestBody(opts), headers: opts.headers as RawAxiosRequestHeaders, // let `paramsSerializer()` handle query params if it exists params: opts.paramsSerializer ? opts.query : undefined, @@ -114,6 +114,23 @@ export const createClient = (config: Config = {}): Client => { } }; + function getValidRequestBody(options: RequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/vue-query/axios/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/vue-query/axios/client/client.gen.ts index 06ff1ec77..a08594b65 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/vue-query/axios/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/vue-query/axios/client/client.gen.ts @@ -59,7 +59,7 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.body = opts.bodySerializer(opts.body); } @@ -80,7 +80,7 @@ export const createClient = (config: Config = {}): Client => { const response = await _axios({ ...optsWithoutAuth, baseURL: opts.baseURL as string, - data: opts.body, + data: getValidRequestBody(opts), headers: opts.headers as RawAxiosRequestHeaders, // let `paramsSerializer()` handle query params if it exists params: opts.paramsSerializer ? opts.query : undefined, @@ -114,6 +114,23 @@ export const createClient = (config: Config = {}): Client => { } }; + function getValidRequestBody(options: RequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/base-url-false/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/base-url-false/client/client.gen.ts index 06ff1ec77..a08594b65 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/base-url-false/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/base-url-false/client/client.gen.ts @@ -59,7 +59,7 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.body = opts.bodySerializer(opts.body); } @@ -80,7 +80,7 @@ export const createClient = (config: Config = {}): Client => { const response = await _axios({ ...optsWithoutAuth, baseURL: opts.baseURL as string, - data: opts.body, + data: getValidRequestBody(opts), headers: opts.headers as RawAxiosRequestHeaders, // let `paramsSerializer()` handle query params if it exists params: opts.paramsSerializer ? opts.query : undefined, @@ -114,6 +114,23 @@ export const createClient = (config: Config = {}): Client => { } }; + function getValidRequestBody(options: RequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/base-url-number/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/base-url-number/client/client.gen.ts index 06ff1ec77..a08594b65 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/base-url-number/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/base-url-number/client/client.gen.ts @@ -59,7 +59,7 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.body = opts.bodySerializer(opts.body); } @@ -80,7 +80,7 @@ export const createClient = (config: Config = {}): Client => { const response = await _axios({ ...optsWithoutAuth, baseURL: opts.baseURL as string, - data: opts.body, + data: getValidRequestBody(opts), headers: opts.headers as RawAxiosRequestHeaders, // let `paramsSerializer()` handle query params if it exists params: opts.paramsSerializer ? opts.query : undefined, @@ -114,6 +114,23 @@ export const createClient = (config: Config = {}): Client => { } }; + function getValidRequestBody(options: RequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/base-url-strict/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/base-url-strict/client/client.gen.ts index 06ff1ec77..a08594b65 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/base-url-strict/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/base-url-strict/client/client.gen.ts @@ -59,7 +59,7 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.body = opts.bodySerializer(opts.body); } @@ -80,7 +80,7 @@ export const createClient = (config: Config = {}): Client => { const response = await _axios({ ...optsWithoutAuth, baseURL: opts.baseURL as string, - data: opts.body, + data: getValidRequestBody(opts), headers: opts.headers as RawAxiosRequestHeaders, // let `paramsSerializer()` handle query params if it exists params: opts.paramsSerializer ? opts.query : undefined, @@ -114,6 +114,23 @@ export const createClient = (config: Config = {}): Client => { } }; + function getValidRequestBody(options: RequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/base-url-string/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/base-url-string/client/client.gen.ts index 06ff1ec77..a08594b65 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/base-url-string/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/base-url-string/client/client.gen.ts @@ -59,7 +59,7 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.body = opts.bodySerializer(opts.body); } @@ -80,7 +80,7 @@ export const createClient = (config: Config = {}): Client => { const response = await _axios({ ...optsWithoutAuth, baseURL: opts.baseURL as string, - data: opts.body, + data: getValidRequestBody(opts), headers: opts.headers as RawAxiosRequestHeaders, // let `paramsSerializer()` handle query params if it exists params: opts.paramsSerializer ? opts.query : undefined, @@ -114,6 +114,23 @@ export const createClient = (config: Config = {}): Client => { } }; + function getValidRequestBody(options: RequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/clean-false/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/clean-false/client/client.gen.ts index 06ff1ec77..a08594b65 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/clean-false/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/clean-false/client/client.gen.ts @@ -59,7 +59,7 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.body = opts.bodySerializer(opts.body); } @@ -80,7 +80,7 @@ export const createClient = (config: Config = {}): Client => { const response = await _axios({ ...optsWithoutAuth, baseURL: opts.baseURL as string, - data: opts.body, + data: getValidRequestBody(opts), headers: opts.headers as RawAxiosRequestHeaders, // let `paramsSerializer()` handle query params if it exists params: opts.paramsSerializer ? opts.query : undefined, @@ -114,6 +114,23 @@ export const createClient = (config: Config = {}): Client => { } }; + function getValidRequestBody(options: RequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/default/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/default/client/client.gen.ts index 06ff1ec77..a08594b65 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/default/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/default/client/client.gen.ts @@ -59,7 +59,7 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.body = opts.bodySerializer(opts.body); } @@ -80,7 +80,7 @@ export const createClient = (config: Config = {}): Client => { const response = await _axios({ ...optsWithoutAuth, baseURL: opts.baseURL as string, - data: opts.body, + data: getValidRequestBody(opts), headers: opts.headers as RawAxiosRequestHeaders, // let `paramsSerializer()` handle query params if it exists params: opts.paramsSerializer ? opts.query : undefined, @@ -114,6 +114,23 @@ export const createClient = (config: Config = {}): Client => { } }; + function getValidRequestBody(options: RequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/sdk-client-optional/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/sdk-client-optional/client/client.gen.ts index 06ff1ec77..a08594b65 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/sdk-client-optional/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/sdk-client-optional/client/client.gen.ts @@ -59,7 +59,7 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.body = opts.bodySerializer(opts.body); } @@ -80,7 +80,7 @@ export const createClient = (config: Config = {}): Client => { const response = await _axios({ ...optsWithoutAuth, baseURL: opts.baseURL as string, - data: opts.body, + data: getValidRequestBody(opts), headers: opts.headers as RawAxiosRequestHeaders, // let `paramsSerializer()` handle query params if it exists params: opts.paramsSerializer ? opts.query : undefined, @@ -114,6 +114,23 @@ export const createClient = (config: Config = {}): Client => { } }; + function getValidRequestBody(options: RequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/sdk-client-required/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/sdk-client-required/client/client.gen.ts index 06ff1ec77..a08594b65 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/sdk-client-required/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/sdk-client-required/client/client.gen.ts @@ -59,7 +59,7 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.body = opts.bodySerializer(opts.body); } @@ -80,7 +80,7 @@ export const createClient = (config: Config = {}): Client => { const response = await _axios({ ...optsWithoutAuth, baseURL: opts.baseURL as string, - data: opts.body, + data: getValidRequestBody(opts), headers: opts.headers as RawAxiosRequestHeaders, // let `paramsSerializer()` handle query params if it exists params: opts.paramsSerializer ? opts.query : undefined, @@ -114,6 +114,23 @@ export const createClient = (config: Config = {}): Client => { } }; + function getValidRequestBody(options: RequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/tsconfig-nodenext-sdk/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/tsconfig-nodenext-sdk/client/client.gen.ts index 25d7be4f2..67f6a72f1 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/tsconfig-nodenext-sdk/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/tsconfig-nodenext-sdk/client/client.gen.ts @@ -59,7 +59,7 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.body = opts.bodySerializer(opts.body); } @@ -80,7 +80,7 @@ export const createClient = (config: Config = {}): Client => { const response = await _axios({ ...optsWithoutAuth, baseURL: opts.baseURL as string, - data: opts.body, + data: getValidRequestBody(opts), headers: opts.headers as RawAxiosRequestHeaders, // let `paramsSerializer()` handle query params if it exists params: opts.paramsSerializer ? opts.query : undefined, @@ -114,6 +114,23 @@ export const createClient = (config: Config = {}): Client => { } }; + function getValidRequestBody(options: RequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/content-types/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/content-types/client/client.gen.ts index 06ff1ec77..a08594b65 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/content-types/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/content-types/client/client.gen.ts @@ -59,7 +59,7 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.body = opts.bodySerializer(opts.body); } @@ -80,7 +80,7 @@ export const createClient = (config: Config = {}): Client => { const response = await _axios({ ...optsWithoutAuth, baseURL: opts.baseURL as string, - data: opts.body, + data: getValidRequestBody(opts), headers: opts.headers as RawAxiosRequestHeaders, // let `paramsSerializer()` handle query params if it exists params: opts.paramsSerializer ? opts.query : undefined, @@ -114,6 +114,23 @@ export const createClient = (config: Config = {}): Client => { } }; + function getValidRequestBody(options: RequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/parameter-explode-false-axios/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/parameter-explode-false-axios/client/client.gen.ts index 06ff1ec77..a08594b65 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/parameter-explode-false-axios/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/parameter-explode-false-axios/client/client.gen.ts @@ -59,7 +59,7 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.body = opts.bodySerializer(opts.body); } @@ -80,7 +80,7 @@ export const createClient = (config: Config = {}): Client => { const response = await _axios({ ...optsWithoutAuth, baseURL: opts.baseURL as string, - data: opts.body, + data: getValidRequestBody(opts), headers: opts.headers as RawAxiosRequestHeaders, // let `paramsSerializer()` handle query params if it exists params: opts.paramsSerializer ? opts.query : undefined, @@ -114,6 +114,23 @@ export const createClient = (config: Config = {}): Client => { } }; + function getValidRequestBody(options: RequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/angular-query-experimental/axios/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/angular-query-experimental/axios/client/client.gen.ts index 06ff1ec77..a08594b65 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/angular-query-experimental/axios/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/angular-query-experimental/axios/client/client.gen.ts @@ -59,7 +59,7 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.body = opts.bodySerializer(opts.body); } @@ -80,7 +80,7 @@ export const createClient = (config: Config = {}): Client => { const response = await _axios({ ...optsWithoutAuth, baseURL: opts.baseURL as string, - data: opts.body, + data: getValidRequestBody(opts), headers: opts.headers as RawAxiosRequestHeaders, // let `paramsSerializer()` handle query params if it exists params: opts.paramsSerializer ? opts.query : undefined, @@ -114,6 +114,23 @@ export const createClient = (config: Config = {}): Client => { } }; + function getValidRequestBody(options: RequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/react-query/axios/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/react-query/axios/client/client.gen.ts index 06ff1ec77..a08594b65 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/react-query/axios/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/react-query/axios/client/client.gen.ts @@ -59,7 +59,7 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.body = opts.bodySerializer(opts.body); } @@ -80,7 +80,7 @@ export const createClient = (config: Config = {}): Client => { const response = await _axios({ ...optsWithoutAuth, baseURL: opts.baseURL as string, - data: opts.body, + data: getValidRequestBody(opts), headers: opts.headers as RawAxiosRequestHeaders, // let `paramsSerializer()` handle query params if it exists params: opts.paramsSerializer ? opts.query : undefined, @@ -114,6 +114,23 @@ export const createClient = (config: Config = {}): Client => { } }; + function getValidRequestBody(options: RequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/solid-query/axios/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/solid-query/axios/client/client.gen.ts index 06ff1ec77..a08594b65 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/solid-query/axios/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/solid-query/axios/client/client.gen.ts @@ -59,7 +59,7 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.body = opts.bodySerializer(opts.body); } @@ -80,7 +80,7 @@ export const createClient = (config: Config = {}): Client => { const response = await _axios({ ...optsWithoutAuth, baseURL: opts.baseURL as string, - data: opts.body, + data: getValidRequestBody(opts), headers: opts.headers as RawAxiosRequestHeaders, // let `paramsSerializer()` handle query params if it exists params: opts.paramsSerializer ? opts.query : undefined, @@ -114,6 +114,23 @@ export const createClient = (config: Config = {}): Client => { } }; + function getValidRequestBody(options: RequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/svelte-query/axios/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/svelte-query/axios/client/client.gen.ts index 06ff1ec77..a08594b65 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/svelte-query/axios/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/svelte-query/axios/client/client.gen.ts @@ -59,7 +59,7 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.body = opts.bodySerializer(opts.body); } @@ -80,7 +80,7 @@ export const createClient = (config: Config = {}): Client => { const response = await _axios({ ...optsWithoutAuth, baseURL: opts.baseURL as string, - data: opts.body, + data: getValidRequestBody(opts), headers: opts.headers as RawAxiosRequestHeaders, // let `paramsSerializer()` handle query params if it exists params: opts.paramsSerializer ? opts.query : undefined, @@ -114,6 +114,23 @@ export const createClient = (config: Config = {}): Client => { } }; + function getValidRequestBody(options: RequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/vue-query/axios/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/vue-query/axios/client/client.gen.ts index 06ff1ec77..a08594b65 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/vue-query/axios/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/vue-query/axios/client/client.gen.ts @@ -59,7 +59,7 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.body = opts.bodySerializer(opts.body); } @@ -80,7 +80,7 @@ export const createClient = (config: Config = {}): Client => { const response = await _axios({ ...optsWithoutAuth, baseURL: opts.baseURL as string, - data: opts.body, + data: getValidRequestBody(opts), headers: opts.headers as RawAxiosRequestHeaders, // let `paramsSerializer()` handle query params if it exists params: opts.paramsSerializer ? opts.query : undefined, @@ -114,6 +114,23 @@ export const createClient = (config: Config = {}): Client => { } }; + function getValidRequestBody(options: RequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-axios/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-axios/client/client.gen.ts index 06ff1ec77..a08594b65 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-axios/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-axios/client/client.gen.ts @@ -59,7 +59,7 @@ export const createClient = (config: Config = {}): Client => { await opts.requestValidator(opts); } - if (opts.body && opts.bodySerializer) { + if (opts.body !== undefined && opts.bodySerializer) { opts.body = opts.bodySerializer(opts.body); } @@ -80,7 +80,7 @@ export const createClient = (config: Config = {}): Client => { const response = await _axios({ ...optsWithoutAuth, baseURL: opts.baseURL as string, - data: opts.body, + data: getValidRequestBody(opts), headers: opts.headers as RawAxiosRequestHeaders, // let `paramsSerializer()` handle query params if it exists params: opts.paramsSerializer ? opts.query : undefined, @@ -114,6 +114,23 @@ export const createClient = (config: Config = {}): Client => { } }; + function getValidRequestBody(options: RequestOptions) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; + } + const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); -- 2.51.2 From 771d244cc75f7efb8d40e407e2c8f583b9f731c9 Mon Sep 17 00:00:00 2001 From: Dmitriy Brolnickij Date: Fri, 5 Sep 2025 17:59:55 +0700 Subject: [PATCH 36/46] fix(pinia-colada): remove unnecessary `Partial` type for `query` --- packages/openapi-ts/src/plugins/@pinia/colada/queryOptions.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/openapi-ts/src/plugins/@pinia/colada/queryOptions.ts b/packages/openapi-ts/src/plugins/@pinia/colada/queryOptions.ts index ada1e5e5d..64dd6af39 100644 --- a/packages/openapi-ts/src/plugins/@pinia/colada/queryOptions.ts +++ b/packages/openapi-ts/src/plugins/@pinia/colada/queryOptions.ts @@ -164,7 +164,7 @@ export const createQueryOptions = ({ isNuxtClient ? { name: fnOptions, - type: `Partial<${strippedTypeData}>`, + type: strippedTypeData, } : { name: fnOptions }, ], -- 2.51.2 From 3afb31b92d20e5cd46cb4aa7db5719517292d02c Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 5 Sep 2025 11:18:18 +0000 Subject: [PATCH 37/46] ci: release --- .changeset/brave-seahorses-dream.md | 5 ----- .changeset/implicit-fetch.md | 5 ----- .changeset/optional-options-in-mutation-factory.md | 5 ----- .changeset/sharp-rules-eat.md | 5 ----- packages/openapi-ts/CHANGELOG.md | 12 ++++++++++++ packages/openapi-ts/package.json | 2 +- 6 files changed, 13 insertions(+), 21 deletions(-) delete mode 100644 .changeset/brave-seahorses-dream.md delete mode 100644 .changeset/implicit-fetch.md delete mode 100644 .changeset/optional-options-in-mutation-factory.md delete mode 100644 .changeset/sharp-rules-eat.md diff --git a/.changeset/brave-seahorses-dream.md b/.changeset/brave-seahorses-dream.md deleted file mode 100644 index aec726579..000000000 --- a/.changeset/brave-seahorses-dream.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@hey-api/openapi-ts": patch ---- - -fix(client): improve handling of plain text, falsy, and unserialized request bodies diff --git a/.changeset/implicit-fetch.md b/.changeset/implicit-fetch.md deleted file mode 100644 index 468fecb4d..000000000 --- a/.changeset/implicit-fetch.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@hey-api/openapi-ts": patch ---- - -feat(pinia-colada): implicit `$fetch` for `client-nuxt` (hide `composable`) diff --git a/.changeset/optional-options-in-mutation-factory.md b/.changeset/optional-options-in-mutation-factory.md deleted file mode 100644 index 573246732..000000000 --- a/.changeset/optional-options-in-mutation-factory.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@hey-api/openapi-ts": patch ---- - -fix(pinia-colada): optional `options` in mutation factory diff --git a/.changeset/sharp-rules-eat.md b/.changeset/sharp-rules-eat.md deleted file mode 100644 index 96806360d..000000000 --- a/.changeset/sharp-rules-eat.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@hey-api/openapi-ts": patch ---- - -fix(parser): improve $ref handling diff --git a/packages/openapi-ts/CHANGELOG.md b/packages/openapi-ts/CHANGELOG.md index 278c65ada..c33bc64b8 100644 --- a/packages/openapi-ts/CHANGELOG.md +++ b/packages/openapi-ts/CHANGELOG.md @@ -1,5 +1,17 @@ # @hey-api/openapi-ts +## 0.82.4 + +### Patch Changes + +- fix(client): improve handling of plain text, falsy, and unserialized request bodies ([#2564](https://github.com/hey-api/openapi-ts/pull/2564)) ([`074a459`](https://github.com/hey-api/openapi-ts/commit/074a4598c050036b161a9e04a4b5acae98d97b82)) by [@franworks](https://github.com/franworks) + +- feat(pinia-colada): implicit `$fetch` for `client-nuxt` (hide `composable`) ([#2598](https://github.com/hey-api/openapi-ts/pull/2598)) ([`7143078`](https://github.com/hey-api/openapi-ts/commit/7143078fde06b5b2fe00e7a7045317a2f5b40bb7)) by [@brolnickij](https://github.com/brolnickij) + +- fix(pinia-colada): optional `options` in mutation factory ([#2593](https://github.com/hey-api/openapi-ts/pull/2593)) ([`4137445`](https://github.com/hey-api/openapi-ts/commit/413744572f403f605c0ba6a69f3614da69fc6f15)) by [@brolnickij](https://github.com/brolnickij) + +- fix(parser): improve $ref handling ([#2588](https://github.com/hey-api/openapi-ts/pull/2588)) ([`c97e7a8`](https://github.com/hey-api/openapi-ts/commit/c97e7a8c8b1d24747356feb9a15840c296a9c1c8)) by [@carson2222](https://github.com/carson2222) + ## 0.82.3 ### Patch Changes diff --git a/packages/openapi-ts/package.json b/packages/openapi-ts/package.json index bd78319f3..663d6a47a 100644 --- a/packages/openapi-ts/package.json +++ b/packages/openapi-ts/package.json @@ -1,6 +1,6 @@ { "name": "@hey-api/openapi-ts", - "version": "0.82.3", + "version": "0.82.4", "description": "🚀 The OpenAPI to TypeScript codegen. Generate clients, SDKs, validators, and more.", "homepage": "https://heyapi.dev/", "repository": { -- 2.51.2 From aefc03d885c2dbdb197dfa136c1d3a0162123629 Mon Sep 17 00:00:00 2001 From: Fransis Young Date: Sat, 6 Sep 2025 14:59:56 -0400 Subject: [PATCH 38/46] refactor(client): moves getValidRequestBody to core-body utils updates angular, axios, fetch, and next clients resolves: #2604 --- .../@hey-api/client-angular/bundle/client.ts | 20 +----- .../@hey-api/client-axios/bundle/client.ts | 18 +---- .../client-core/__tests__/utils.test.ts | 66 +++++++++++++++++++ .../@hey-api/client-core/bundle/utils.ts | 30 ++++++++- .../@hey-api/client-fetch/bundle/client.ts | 21 +----- .../@hey-api/client-next/bundle/client.ts | 21 +----- 6 files changed, 99 insertions(+), 77 deletions(-) create mode 100644 packages/openapi-ts/src/plugins/@hey-api/client-core/__tests__/utils.test.ts diff --git a/packages/openapi-ts/src/plugins/@hey-api/client-angular/bundle/client.ts b/packages/openapi-ts/src/plugins/@hey-api/client-angular/bundle/client.ts index 6dd96d7ab..c7ba67191 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/client-angular/bundle/client.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/client-angular/bundle/client.ts @@ -16,6 +16,7 @@ import { filter } from 'rxjs/operators'; import { createSseClient } from '../../client-core/bundle/serverSentEvents'; import type { HttpMethod } from '../../client-core/bundle/types'; +import { getValidRequestBody } from '../../client-core/bundle/utils'; import type { Client, Config, @@ -199,25 +200,6 @@ export const createClient = (config: Config = {}): Client => { } }; - function getValidRequestBody(options: ResolvedRequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; - - return hasSerializedBody ? options.serializedBody : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts/src/plugins/@hey-api/client-axios/bundle/client.ts b/packages/openapi-ts/src/plugins/@hey-api/client-axios/bundle/client.ts index f5ccdc200..fb7e69a3a 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/client-axios/bundle/client.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/client-axios/bundle/client.ts @@ -3,6 +3,7 @@ import axios from 'axios'; import { createSseClient } from '../../client-core/bundle/serverSentEvents'; import type { HttpMethod } from '../../client-core/bundle/types'; +import { getValidRequestBody } from '../../client-core/bundle/utils'; import type { Client, Config, RequestOptions } from './types'; import { buildUrl, @@ -112,23 +113,6 @@ export const createClient = (config: Config = {}): Client => { } }; - function getValidRequestBody(options: RequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - return options.body !== '' ? options.body : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts/src/plugins/@hey-api/client-core/__tests__/utils.test.ts b/packages/openapi-ts/src/plugins/@hey-api/client-core/__tests__/utils.test.ts new file mode 100644 index 000000000..54974a7cd --- /dev/null +++ b/packages/openapi-ts/src/plugins/@hey-api/client-core/__tests__/utils.test.ts @@ -0,0 +1,66 @@ +import { describe, expect, it } from 'vitest'; + +import { getValidRequestBody } from '../../client-core/bundle/utils'; + +describe('getValidRequestBody', () => { + const noBodySerializer = [ + { body: '' }, + { body: 0 }, + { body: false }, + { body: 'test string' }, + { body: null }, + { body: undefined }, + ].map(({ body }) => ({ + expectedBody: body, + options: { body, bodySerializer: null, serializedBody: 'ignore' }, + })); + + const hasBodySerializer = [ + { body: '', expectedBody: null }, + { body: 0, expectedBody: 0 }, + { body: false, expectedBody: false }, + { body: '{"key":"value"}', expectedBody: '{"key":"value"}' }, + { body: null, expectedBody: null }, + { body: undefined, expectedBody: undefined }, + ].map(({ body, expectedBody }) => ({ + expectedBody, + options: { body, bodySerializer: () => {} }, + })); + + const hasBodySerializerAndSerializedBodyProperty = [ + { body: '', expectedBody: null, serializedBody: '' }, + { body: 0, expectedBody: 0, serializedBody: 0 }, + { body: false, expectedBody: false, serializedBody: false }, + { + body: {}, + expectedBody: '{"key":"value"}', + serializedBody: '{"key":"value"}', + }, + { body: null, expectedBody: 'foo', serializedBody: 'foo' }, + { body: undefined, expectedBody: undefined, serializedBody: undefined }, + ].map(({ body, expectedBody, serializedBody }) => ({ + expectedBody, + options: { body, bodySerializer: () => {}, serializedBody }, + })); + + it.each(noBodySerializer)( + 'returns $expectedBody when unserialized body value is $options.body', + ({ expectedBody, options }) => { + expect(getValidRequestBody(options)).toBe(expectedBody); + }, + ); + + it.each(hasBodySerializer)( + 'evaluates body and returns $expectedBody when serialized value is $options.body', + ({ expectedBody, options }) => { + expect(getValidRequestBody(options)).toBe(expectedBody); + }, + ); + + it.each(hasBodySerializerAndSerializedBodyProperty)( + 'evaluates serializedBody and returns $expectedBody when value is $options.serializedBody', + ({ expectedBody, options }) => { + expect(getValidRequestBody(options)).toBe(expectedBody); + }, + ); +}); diff --git a/packages/openapi-ts/src/plugins/@hey-api/client-core/bundle/utils.ts b/packages/openapi-ts/src/plugins/@hey-api/client-core/bundle/utils.ts index 1c9da1fa3..01c88fcee 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/client-core/bundle/utils.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/client-core/bundle/utils.ts @@ -1,4 +1,4 @@ -import type { QuerySerializer } from './bodySerializer'; +import type { BodySerializer, QuerySerializer } from './bodySerializer'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -110,3 +110,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts/src/plugins/@hey-api/client-fetch/bundle/client.ts b/packages/openapi-ts/src/plugins/@hey-api/client-fetch/bundle/client.ts index e750a8314..7165a5f01 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/client-fetch/bundle/client.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/client-fetch/bundle/client.ts @@ -1,5 +1,6 @@ import { createSseClient } from '../../client-core/bundle/serverSentEvents'; import type { HttpMethod } from '../../client-core/bundle/types'; +import { getValidRequestBody } from '../../client-core/bundle/utils'; import type { Client, Config, @@ -210,26 +211,6 @@ export const createClient = (config: Config = {}): Client => { }; }; - function getValidRequestBody(options: ResolvedRequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; - - return hasSerializedBody ? options.serializedBody : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts/src/plugins/@hey-api/client-next/bundle/client.ts b/packages/openapi-ts/src/plugins/@hey-api/client-next/bundle/client.ts index 574ca0b57..ca1a8e320 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/client-next/bundle/client.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/client-next/bundle/client.ts @@ -1,5 +1,6 @@ import { createSseClient } from '../../client-core/bundle/serverSentEvents'; import type { HttpMethod } from '../../client-core/bundle/types'; +import { getValidRequestBody } from '../../client-core/bundle/utils'; import type { Client, Config, @@ -198,26 +199,6 @@ export const createClient = (config: Config = {}): Client => { }; }; - function getValidRequestBody(options: ResolvedRequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; - - return hasSerializedBody ? options.serializedBody : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); -- 2.51.2 From 2bd51022895f478668659eb28bd968ac264a474a Mon Sep 17 00:00:00 2001 From: Fransis Young Date: Sat, 6 Sep 2025 15:08:03 -0400 Subject: [PATCH 39/46] test(client): updates snapshots refs: #2604 --- .../client/client.gen.ts | 21 +------------ .../core/utils.gen.ts | 30 ++++++++++++++++++- .../2.0.x/form-data/client/client.gen.ts | 21 +------------ .../2.0.x/form-data/core/utils.gen.ts | 30 ++++++++++++++++++- .../client/client.gen.ts | 21 +------------ .../core/utils.gen.ts | 30 ++++++++++++++++++- .../sdk-nested-classes/client/client.gen.ts | 21 +------------ .../sdk-nested-classes/core/utils.gen.ts | 30 ++++++++++++++++++- .../@hey-api/sdk/default/client/client.gen.ts | 21 +------------ .../@hey-api/sdk/default/core/utils.gen.ts | 30 ++++++++++++++++++- .../sdk/instance/client/client.gen.ts | 21 +------------ .../@hey-api/sdk/instance/core/utils.gen.ts | 30 ++++++++++++++++++- .../sdk/throwOnError/client/client.gen.ts | 21 +------------ .../sdk/throwOnError/core/utils.gen.ts | 30 ++++++++++++++++++- .../type-format-valibot/client/client.gen.ts | 21 +------------ .../type-format-valibot/core/utils.gen.ts | 30 ++++++++++++++++++- .../type-format-zod/client/client.gen.ts | 21 +------------ .../type-format-zod/core/utils.gen.ts | 30 ++++++++++++++++++- .../client/client.gen.ts | 21 +------------ .../core/utils.gen.ts | 30 ++++++++++++++++++- .../client/client.gen.ts | 21 +------------ .../core/utils.gen.ts | 30 ++++++++++++++++++- .../@pinia/colada/fetch/client/client.gen.ts | 21 +------------ .../@pinia/colada/fetch/core/utils.gen.ts | 30 ++++++++++++++++++- .../colada/group-by-tag/client/client.gen.ts | 21 +------------ .../colada/group-by-tag/core/utils.gen.ts | 30 ++++++++++++++++++- .../asClass/client/client.gen.ts | 21 +------------ .../asClass/core/utils.gen.ts | 30 ++++++++++++++++++- .../axios/client/client.gen.ts | 18 +---------- .../axios/core/utils.gen.ts | 30 ++++++++++++++++++- .../fetch/client/client.gen.ts | 21 +------------ .../fetch/core/utils.gen.ts | 30 ++++++++++++++++++- .../name-builder/client/client.gen.ts | 21 +------------ .../name-builder/core/utils.gen.ts | 30 ++++++++++++++++++- .../react-query/asClass/client/client.gen.ts | 21 +------------ .../react-query/asClass/core/utils.gen.ts | 30 ++++++++++++++++++- .../react-query/axios/client/client.gen.ts | 18 +---------- .../react-query/axios/core/utils.gen.ts | 30 ++++++++++++++++++- .../react-query/fetch/client/client.gen.ts | 21 +------------ .../react-query/fetch/core/utils.gen.ts | 30 ++++++++++++++++++- .../name-builder/client/client.gen.ts | 21 +------------ .../name-builder/core/utils.gen.ts | 30 ++++++++++++++++++- .../solid-query/asClass/client/client.gen.ts | 21 +------------ .../solid-query/asClass/core/utils.gen.ts | 30 ++++++++++++++++++- .../solid-query/axios/client/client.gen.ts | 18 +---------- .../solid-query/axios/core/utils.gen.ts | 30 ++++++++++++++++++- .../solid-query/fetch/client/client.gen.ts | 21 +------------ .../solid-query/fetch/core/utils.gen.ts | 30 ++++++++++++++++++- .../name-builder/client/client.gen.ts | 21 +------------ .../name-builder/core/utils.gen.ts | 30 ++++++++++++++++++- .../svelte-query/asClass/client/client.gen.ts | 21 +------------ .../svelte-query/asClass/core/utils.gen.ts | 30 ++++++++++++++++++- .../svelte-query/axios/client/client.gen.ts | 18 +---------- .../svelte-query/axios/core/utils.gen.ts | 30 ++++++++++++++++++- .../svelte-query/fetch/client/client.gen.ts | 21 +------------ .../svelte-query/fetch/core/utils.gen.ts | 30 ++++++++++++++++++- .../name-builder/client/client.gen.ts | 21 +------------ .../name-builder/core/utils.gen.ts | 30 ++++++++++++++++++- .../vue-query/asClass/client/client.gen.ts | 21 +------------ .../vue-query/asClass/core/utils.gen.ts | 30 ++++++++++++++++++- .../vue-query/axios/client/client.gen.ts | 18 +---------- .../vue-query/axios/core/utils.gen.ts | 30 ++++++++++++++++++- .../vue-query/fetch/client/client.gen.ts | 21 +------------ .../vue-query/fetch/core/utils.gen.ts | 30 ++++++++++++++++++- .../name-builder/client/client.gen.ts | 21 +------------ .../vue-query/name-builder/core/utils.gen.ts | 30 ++++++++++++++++++- .../2.0.x/schema-unknown/client/client.gen.ts | 21 +------------ .../2.0.x/schema-unknown/core/utils.gen.ts | 30 ++++++++++++++++++- .../security-api-key/client/client.gen.ts | 21 +------------ .../2.0.x/security-api-key/core/utils.gen.ts | 30 ++++++++++++++++++- .../2.0.x/security-basic/client/client.gen.ts | 21 +------------ .../2.0.x/security-basic/core/utils.gen.ts | 30 ++++++++++++++++++- .../2.0.x/security-false/client/client.gen.ts | 21 +------------ .../2.0.x/security-false/core/utils.gen.ts | 30 ++++++++++++++++++- .../security-oauth2/client/client.gen.ts | 21 +------------ .../2.0.x/security-oauth2/core/utils.gen.ts | 30 ++++++++++++++++++- .../servers-base-path/client/client.gen.ts | 21 +------------ .../2.0.x/servers-base-path/core/utils.gen.ts | 30 ++++++++++++++++++- .../2.0.x/servers-host/client/client.gen.ts | 21 +------------ .../2.0.x/servers-host/core/utils.gen.ts | 30 ++++++++++++++++++- .../2.0.x/servers/client/client.gen.ts | 21 +------------ .../2.0.x/servers/core/utils.gen.ts | 30 ++++++++++++++++++- .../client/client.gen.ts | 21 +------------ .../transforms-read-write/core/utils.gen.ts | 30 ++++++++++++++++++- .../client/client.gen.ts | 21 +------------ .../core/utils.gen.ts | 30 ++++++++++++++++++- .../3.0.x/content-types/client/client.gen.ts | 18 +---------- .../3.0.x/content-types/core/utils.gen.ts | 30 ++++++++++++++++++- .../client/client.gen.ts | 21 +------------ .../internal-name-conflict/core/utils.gen.ts | 30 ++++++++++++++++++- .../client/client.gen.ts | 18 +---------- .../core/utils.gen.ts | 30 ++++++++++++++++++- .../client/client.gen.ts | 21 +------------ .../parameter-explode-false/core/utils.gen.ts | 30 ++++++++++++++++++- .../client/client.gen.ts | 21 +------------ .../core/utils.gen.ts | 30 ++++++++++++++++++- .../sdk-nested-classes/client/client.gen.ts | 21 +------------ .../sdk-nested-classes/core/utils.gen.ts | 30 ++++++++++++++++++- .../@hey-api/sdk/default/client/client.gen.ts | 21 +------------ .../@hey-api/sdk/default/core/utils.gen.ts | 30 ++++++++++++++++++- .../sdk/instance/client/client.gen.ts | 21 +------------ .../@hey-api/sdk/instance/core/utils.gen.ts | 30 ++++++++++++++++++- .../sdk/throwOnError/client/client.gen.ts | 21 +------------ .../sdk/throwOnError/core/utils.gen.ts | 30 ++++++++++++++++++- .../type-format-valibot/client/client.gen.ts | 21 +------------ .../type-format-valibot/core/utils.gen.ts | 30 ++++++++++++++++++- .../type-format-zod/client/client.gen.ts | 21 +------------ .../type-format-zod/core/utils.gen.ts | 30 ++++++++++++++++++- .../client/client.gen.ts | 21 +------------ .../core/utils.gen.ts | 30 ++++++++++++++++++- .../client/client.gen.ts | 21 +------------ .../core/utils.gen.ts | 30 ++++++++++++++++++- .../@pinia/colada/fetch/client/client.gen.ts | 21 +------------ .../@pinia/colada/fetch/core/utils.gen.ts | 30 ++++++++++++++++++- .../colada/group-by-tag/client/client.gen.ts | 21 +------------ .../colada/group-by-tag/core/utils.gen.ts | 30 ++++++++++++++++++- .../asClass/client/client.gen.ts | 21 +------------ .../asClass/core/utils.gen.ts | 30 ++++++++++++++++++- .../axios/client/client.gen.ts | 18 +---------- .../axios/core/utils.gen.ts | 30 ++++++++++++++++++- .../fetch/client/client.gen.ts | 21 +------------ .../fetch/core/utils.gen.ts | 30 ++++++++++++++++++- .../name-builder/client/client.gen.ts | 21 +------------ .../name-builder/core/utils.gen.ts | 30 ++++++++++++++++++- .../react-query/asClass/client/client.gen.ts | 21 +------------ .../react-query/asClass/core/utils.gen.ts | 30 ++++++++++++++++++- .../react-query/axios/client/client.gen.ts | 18 +---------- .../react-query/axios/core/utils.gen.ts | 30 ++++++++++++++++++- .../react-query/fetch/client/client.gen.ts | 21 +------------ .../react-query/fetch/core/utils.gen.ts | 30 ++++++++++++++++++- .../name-builder/client/client.gen.ts | 21 +------------ .../name-builder/core/utils.gen.ts | 30 ++++++++++++++++++- .../solid-query/asClass/client/client.gen.ts | 21 +------------ .../solid-query/asClass/core/utils.gen.ts | 30 ++++++++++++++++++- .../solid-query/axios/client/client.gen.ts | 18 +---------- .../solid-query/axios/core/utils.gen.ts | 30 ++++++++++++++++++- .../solid-query/fetch/client/client.gen.ts | 21 +------------ .../solid-query/fetch/core/utils.gen.ts | 30 ++++++++++++++++++- .../name-builder/client/client.gen.ts | 21 +------------ .../name-builder/core/utils.gen.ts | 30 ++++++++++++++++++- .../svelte-query/asClass/client/client.gen.ts | 21 +------------ .../svelte-query/asClass/core/utils.gen.ts | 30 ++++++++++++++++++- .../svelte-query/axios/client/client.gen.ts | 18 +---------- .../svelte-query/axios/core/utils.gen.ts | 30 ++++++++++++++++++- .../svelte-query/fetch/client/client.gen.ts | 21 +------------ .../svelte-query/fetch/core/utils.gen.ts | 30 ++++++++++++++++++- .../name-builder/client/client.gen.ts | 21 +------------ .../name-builder/core/utils.gen.ts | 30 ++++++++++++++++++- .../vue-query/asClass/client/client.gen.ts | 21 +------------ .../vue-query/asClass/core/utils.gen.ts | 30 ++++++++++++++++++- .../vue-query/axios/client/client.gen.ts | 18 +---------- .../vue-query/axios/core/utils.gen.ts | 30 ++++++++++++++++++- .../vue-query/fetch/client/client.gen.ts | 21 +------------ .../vue-query/fetch/core/utils.gen.ts | 30 ++++++++++++++++++- .../name-builder/client/client.gen.ts | 21 +------------ .../vue-query/name-builder/core/utils.gen.ts | 30 ++++++++++++++++++- .../security-api-key/client/client.gen.ts | 21 +------------ .../3.0.x/security-api-key/core/utils.gen.ts | 30 ++++++++++++++++++- .../3.0.x/security-false/client/client.gen.ts | 21 +------------ .../3.0.x/security-false/core/utils.gen.ts | 30 ++++++++++++++++++- .../security-http-bearer/client/client.gen.ts | 21 +------------ .../security-http-bearer/core/utils.gen.ts | 30 ++++++++++++++++++- .../security-oauth2/client/client.gen.ts | 21 +------------ .../3.0.x/security-oauth2/core/utils.gen.ts | 30 ++++++++++++++++++- .../client/client.gen.ts | 21 +------------ .../core/utils.gen.ts | 30 ++++++++++++++++++- .../3.0.x/servers/client/client.gen.ts | 21 +------------ .../3.0.x/servers/core/utils.gen.ts | 30 ++++++++++++++++++- .../transformers-all-of/client/client.gen.ts | 21 +------------ .../transformers-all-of/core/utils.gen.ts | 30 ++++++++++++++++++- .../client/client.gen.ts | 21 +------------ .../core/utils.gen.ts | 30 ++++++++++++++++++- .../transformers-array/client/client.gen.ts | 21 +------------ .../transformers-array/core/utils.gen.ts | 30 ++++++++++++++++++- .../client/client.gen.ts | 21 +------------ .../transforms-read-write/core/utils.gen.ts | 30 ++++++++++++++++++- .../client/client.gen.ts | 21 +------------ .../core/utils.gen.ts | 30 ++++++++++++++++++- .../base-url-false/client/client.gen.ts | 18 +---------- .../base-url-false/core/utils.gen.ts | 30 ++++++++++++++++++- .../base-url-number/client/client.gen.ts | 18 +---------- .../base-url-number/core/utils.gen.ts | 30 ++++++++++++++++++- .../base-url-strict/client/client.gen.ts | 18 +---------- .../base-url-strict/core/utils.gen.ts | 30 ++++++++++++++++++- .../base-url-string/client/client.gen.ts | 18 +---------- .../base-url-string/core/utils.gen.ts | 30 ++++++++++++++++++- .../clean-false/client/client.gen.ts | 18 +---------- .../clean-false/core/utils.gen.ts | 30 ++++++++++++++++++- .../client-axios/default/client/client.gen.ts | 18 +---------- .../client-axios/default/core/utils.gen.ts | 30 ++++++++++++++++++- .../sdk-client-optional/client/client.gen.ts | 18 +---------- .../sdk-client-optional/core/utils.gen.ts | 30 ++++++++++++++++++- .../sdk-client-required/client/client.gen.ts | 18 +---------- .../sdk-client-required/core/utils.gen.ts | 30 ++++++++++++++++++- .../client/client.gen.ts | 18 +---------- .../tsconfig-nodenext-sdk/core/utils.gen.ts | 30 ++++++++++++++++++- .../base-url-false/client/client.gen.ts | 21 +------------ .../base-url-false/core/utils.gen.ts | 30 ++++++++++++++++++- .../base-url-number/client/client.gen.ts | 21 +------------ .../base-url-number/core/utils.gen.ts | 30 ++++++++++++++++++- .../base-url-strict/client/client.gen.ts | 21 +------------ .../base-url-strict/core/utils.gen.ts | 30 ++++++++++++++++++- .../base-url-string/client/client.gen.ts | 21 +------------ .../base-url-string/core/utils.gen.ts | 30 ++++++++++++++++++- .../clean-false/client/client.gen.ts | 21 +------------ .../clean-false/core/utils.gen.ts | 30 ++++++++++++++++++- .../client-fetch/default/client/client.gen.ts | 21 +------------ .../client-fetch/default/core/utils.gen.ts | 30 ++++++++++++++++++- .../sdk-client-optional/client/client.gen.ts | 21 +------------ .../sdk-client-optional/core/utils.gen.ts | 30 ++++++++++++++++++- .../sdk-client-required/client/client.gen.ts | 21 +------------ .../sdk-client-required/core/utils.gen.ts | 30 ++++++++++++++++++- .../client/client.gen.ts | 21 +------------ .../tsconfig-nodenext-sdk/core/utils.gen.ts | 30 ++++++++++++++++++- .../base-url-false/client/client.gen.ts | 21 +------------ .../base-url-false/core/utils.gen.ts | 30 ++++++++++++++++++- .../base-url-number/client/client.gen.ts | 21 +------------ .../base-url-number/core/utils.gen.ts | 30 ++++++++++++++++++- .../base-url-strict/client/client.gen.ts | 21 +------------ .../base-url-strict/core/utils.gen.ts | 30 ++++++++++++++++++- .../base-url-string/client/client.gen.ts | 21 +------------ .../base-url-string/core/utils.gen.ts | 30 ++++++++++++++++++- .../clean-false/client/client.gen.ts | 21 +------------ .../client-next/clean-false/core/utils.gen.ts | 30 ++++++++++++++++++- .../client-next/default/client/client.gen.ts | 21 +------------ .../client-next/default/core/utils.gen.ts | 30 ++++++++++++++++++- .../sdk-client-optional/client/client.gen.ts | 21 +------------ .../sdk-client-optional/core/utils.gen.ts | 30 ++++++++++++++++++- .../sdk-client-required/client/client.gen.ts | 21 +------------ .../sdk-client-required/core/utils.gen.ts | 30 ++++++++++++++++++- .../client/client.gen.ts | 21 +------------ .../tsconfig-nodenext-sdk/core/utils.gen.ts | 30 ++++++++++++++++++- .../base-url-false/core/utils.gen.ts | 30 ++++++++++++++++++- .../base-url-number/core/utils.gen.ts | 30 ++++++++++++++++++- .../base-url-strict/core/utils.gen.ts | 30 ++++++++++++++++++- .../base-url-string/core/utils.gen.ts | 30 ++++++++++++++++++- .../client-nuxt/clean-false/core/utils.gen.ts | 30 ++++++++++++++++++- .../client-nuxt/default/core/utils.gen.ts | 30 ++++++++++++++++++- .../sdk-client-optional/core/utils.gen.ts | 30 ++++++++++++++++++- .../sdk-client-required/core/utils.gen.ts | 30 ++++++++++++++++++- .../tsconfig-nodenext-sdk/core/utils.gen.ts | 30 ++++++++++++++++++- .../3.1.x/content-types/client/client.gen.ts | 18 +---------- .../3.1.x/content-types/core/utils.gen.ts | 30 ++++++++++++++++++- .../3.1.x/headers/client/client.gen.ts | 21 +------------ .../3.1.x/headers/core/utils.gen.ts | 30 ++++++++++++++++++- .../client/client.gen.ts | 21 +------------ .../internal-name-conflict/core/utils.gen.ts | 30 ++++++++++++++++++- .../3.1.x/pagination-ref/client/client.gen.ts | 21 +------------ .../3.1.x/pagination-ref/core/utils.gen.ts | 30 ++++++++++++++++++- .../client/client.gen.ts | 18 +---------- .../core/utils.gen.ts | 30 ++++++++++++++++++- .../client/client.gen.ts | 21 +------------ .../parameter-explode-false/core/utils.gen.ts | 30 ++++++++++++++++++- .../client/client.gen.ts | 21 +------------ .../core/utils.gen.ts | 30 ++++++++++++++++++- .../sdk-nested-classes/client/client.gen.ts | 21 +------------ .../sdk-nested-classes/core/utils.gen.ts | 30 ++++++++++++++++++- .../@hey-api/sdk/default/client/client.gen.ts | 21 +------------ .../@hey-api/sdk/default/core/utils.gen.ts | 30 ++++++++++++++++++- .../sdk/instance/client/client.gen.ts | 21 +------------ .../@hey-api/sdk/instance/core/utils.gen.ts | 30 ++++++++++++++++++- .../sdk/throwOnError/client/client.gen.ts | 21 +------------ .../sdk/throwOnError/core/utils.gen.ts | 30 ++++++++++++++++++- .../type-format-valibot/client/client.gen.ts | 21 +------------ .../type-format-valibot/core/utils.gen.ts | 30 ++++++++++++++++++- .../type-format-zod/client/client.gen.ts | 21 +------------ .../type-format-zod/core/utils.gen.ts | 30 ++++++++++++++++++- .../client/client.gen.ts | 21 +------------ .../core/utils.gen.ts | 30 ++++++++++++++++++- .../client/client.gen.ts | 21 +------------ .../core/utils.gen.ts | 30 ++++++++++++++++++- .../@pinia/colada/fetch/client/client.gen.ts | 21 +------------ .../@pinia/colada/fetch/core/utils.gen.ts | 30 ++++++++++++++++++- .../colada/group-by-tag/client/client.gen.ts | 21 +------------ .../colada/group-by-tag/core/utils.gen.ts | 30 ++++++++++++++++++- .../asClass/client/client.gen.ts | 21 +------------ .../asClass/core/utils.gen.ts | 30 ++++++++++++++++++- .../axios/client/client.gen.ts | 18 +---------- .../axios/core/utils.gen.ts | 30 ++++++++++++++++++- .../fetch/client/client.gen.ts | 21 +------------ .../fetch/core/utils.gen.ts | 30 ++++++++++++++++++- .../name-builder/client/client.gen.ts | 21 +------------ .../name-builder/core/utils.gen.ts | 30 ++++++++++++++++++- .../react-query/asClass/client/client.gen.ts | 21 +------------ .../react-query/asClass/core/utils.gen.ts | 30 ++++++++++++++++++- .../react-query/axios/client/client.gen.ts | 18 +---------- .../react-query/axios/core/utils.gen.ts | 30 ++++++++++++++++++- .../react-query/fetch/client/client.gen.ts | 21 +------------ .../react-query/fetch/core/utils.gen.ts | 30 ++++++++++++++++++- .../name-builder/client/client.gen.ts | 21 +------------ .../name-builder/core/utils.gen.ts | 30 ++++++++++++++++++- .../solid-query/asClass/client/client.gen.ts | 21 +------------ .../solid-query/asClass/core/utils.gen.ts | 30 ++++++++++++++++++- .../solid-query/axios/client/client.gen.ts | 18 +---------- .../solid-query/axios/core/utils.gen.ts | 30 ++++++++++++++++++- .../solid-query/fetch/client/client.gen.ts | 21 +------------ .../solid-query/fetch/core/utils.gen.ts | 30 ++++++++++++++++++- .../name-builder/client/client.gen.ts | 21 +------------ .../name-builder/core/utils.gen.ts | 30 ++++++++++++++++++- .../svelte-query/asClass/client/client.gen.ts | 21 +------------ .../svelte-query/asClass/core/utils.gen.ts | 30 ++++++++++++++++++- .../svelte-query/axios/client/client.gen.ts | 18 +---------- .../svelte-query/axios/core/utils.gen.ts | 30 ++++++++++++++++++- .../svelte-query/fetch/client/client.gen.ts | 21 +------------ .../svelte-query/fetch/core/utils.gen.ts | 30 ++++++++++++++++++- .../name-builder/client/client.gen.ts | 21 +------------ .../name-builder/core/utils.gen.ts | 30 ++++++++++++++++++- .../vue-query/asClass/client/client.gen.ts | 21 +------------ .../vue-query/asClass/core/utils.gen.ts | 30 ++++++++++++++++++- .../vue-query/axios/client/client.gen.ts | 18 +---------- .../vue-query/axios/core/utils.gen.ts | 30 ++++++++++++++++++- .../vue-query/fetch/client/client.gen.ts | 21 +------------ .../vue-query/fetch/core/utils.gen.ts | 30 ++++++++++++++++++- .../name-builder/client/client.gen.ts | 21 +------------ .../vue-query/name-builder/core/utils.gen.ts | 30 ++++++++++++++++++- .../security-api-key/client/client.gen.ts | 21 +------------ .../3.1.x/security-api-key/core/utils.gen.ts | 30 ++++++++++++++++++- .../3.1.x/security-false/client/client.gen.ts | 21 +------------ .../3.1.x/security-false/core/utils.gen.ts | 30 ++++++++++++++++++- .../security-http-bearer/client/client.gen.ts | 21 +------------ .../security-http-bearer/core/utils.gen.ts | 30 ++++++++++++++++++- .../security-oauth2/client/client.gen.ts | 21 +------------ .../3.1.x/security-oauth2/core/utils.gen.ts | 30 ++++++++++++++++++- .../client/client.gen.ts | 21 +------------ .../core/utils.gen.ts | 30 ++++++++++++++++++- .../3.1.x/servers/client/client.gen.ts | 21 +------------ .../3.1.x/servers/core/utils.gen.ts | 30 ++++++++++++++++++- .../3.1.x/sse-angular/client/client.gen.ts | 20 +------------ .../3.1.x/sse-angular/core/utils.gen.ts | 30 ++++++++++++++++++- .../3.1.x/sse-axios/client/client.gen.ts | 18 +---------- .../3.1.x/sse-axios/core/utils.gen.ts | 30 ++++++++++++++++++- .../3.1.x/sse-fetch/client/client.gen.ts | 21 +------------ .../3.1.x/sse-fetch/core/utils.gen.ts | 30 ++++++++++++++++++- .../3.1.x/sse-next/client/client.gen.ts | 21 +------------ .../3.1.x/sse-next/core/utils.gen.ts | 30 ++++++++++++++++++- .../3.1.x/sse-nuxt/core/utils.gen.ts | 30 ++++++++++++++++++- .../transformers-all-of/client/client.gen.ts | 21 +------------ .../transformers-all-of/core/utils.gen.ts | 30 ++++++++++++++++++- .../client/client.gen.ts | 21 +------------ .../core/utils.gen.ts | 30 ++++++++++++++++++- .../transformers-array/client/client.gen.ts | 21 +------------ .../transformers-array/core/utils.gen.ts | 30 ++++++++++++++++++- .../client/client.gen.ts | 21 +------------ .../transforms-read-write/core/utils.gen.ts | 30 ++++++++++++++++++- .../@tanstack/meta/client/client.gen.ts | 21 +------------ .../plugins/@tanstack/meta/core/utils.gen.ts | 30 ++++++++++++++++++- .../v3_no_index/client/client.gen.ts.snap | 21 +------------ .../v3_no_index/core/utils.gen.ts.snap | 30 ++++++++++++++++++- 348 files changed, 5360 insertions(+), 3471 deletions(-) diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/body-response-text-plain/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/body-response-text-plain/client/client.gen.ts index 329968d82..6ed36fb89 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/body-response-text-plain/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/body-response-text-plain/client/client.gen.ts @@ -2,6 +2,7 @@ import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, @@ -212,26 +213,6 @@ export const createClient = (config: Config = {}): Client => { }; }; - function getValidRequestBody(options: ResolvedRequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; - - return hasSerializedBody ? options.serializedBody : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/body-response-text-plain/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/body-response-text-plain/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/body-response-text-plain/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/body-response-text-plain/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/form-data/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/form-data/client/client.gen.ts index 329968d82..6ed36fb89 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/form-data/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/form-data/client/client.gen.ts @@ -2,6 +2,7 @@ import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, @@ -212,26 +213,6 @@ export const createClient = (config: Config = {}): Client => { }; }; - function getValidRequestBody(options: ResolvedRequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; - - return hasSerializedBody ? options.serializedBody : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/form-data/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/form-data/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/form-data/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/form-data/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/client-fetch/sdk-nested-classes-instance/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/client-fetch/sdk-nested-classes-instance/client/client.gen.ts index 329968d82..6ed36fb89 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/client-fetch/sdk-nested-classes-instance/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/client-fetch/sdk-nested-classes-instance/client/client.gen.ts @@ -2,6 +2,7 @@ import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, @@ -212,26 +213,6 @@ export const createClient = (config: Config = {}): Client => { }; }; - function getValidRequestBody(options: ResolvedRequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; - - return hasSerializedBody ? options.serializedBody : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/client-fetch/sdk-nested-classes-instance/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/client-fetch/sdk-nested-classes-instance/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/client-fetch/sdk-nested-classes-instance/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/client-fetch/sdk-nested-classes-instance/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/client-fetch/sdk-nested-classes/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/client-fetch/sdk-nested-classes/client/client.gen.ts index 329968d82..6ed36fb89 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/client-fetch/sdk-nested-classes/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/client-fetch/sdk-nested-classes/client/client.gen.ts @@ -2,6 +2,7 @@ import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, @@ -212,26 +213,6 @@ export const createClient = (config: Config = {}): Client => { }; }; - function getValidRequestBody(options: ResolvedRequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; - - return hasSerializedBody ? options.serializedBody : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/client-fetch/sdk-nested-classes/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/client-fetch/sdk-nested-classes/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/client-fetch/sdk-nested-classes/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/client-fetch/sdk-nested-classes/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/sdk/default/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/sdk/default/client/client.gen.ts index 329968d82..6ed36fb89 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/sdk/default/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/sdk/default/client/client.gen.ts @@ -2,6 +2,7 @@ import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, @@ -212,26 +213,6 @@ export const createClient = (config: Config = {}): Client => { }; }; - function getValidRequestBody(options: ResolvedRequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; - - return hasSerializedBody ? options.serializedBody : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/sdk/default/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/sdk/default/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/sdk/default/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/sdk/default/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/sdk/instance/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/sdk/instance/client/client.gen.ts index 329968d82..6ed36fb89 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/sdk/instance/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/sdk/instance/client/client.gen.ts @@ -2,6 +2,7 @@ import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, @@ -212,26 +213,6 @@ export const createClient = (config: Config = {}): Client => { }; }; - function getValidRequestBody(options: ResolvedRequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; - - return hasSerializedBody ? options.serializedBody : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/sdk/instance/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/sdk/instance/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/sdk/instance/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/sdk/instance/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/sdk/throwOnError/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/sdk/throwOnError/client/client.gen.ts index 329968d82..6ed36fb89 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/sdk/throwOnError/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/sdk/throwOnError/client/client.gen.ts @@ -2,6 +2,7 @@ import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, @@ -212,26 +213,6 @@ export const createClient = (config: Config = {}): Client => { }; }; - function getValidRequestBody(options: ResolvedRequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; - - return hasSerializedBody ? options.serializedBody : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/sdk/throwOnError/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/sdk/throwOnError/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/sdk/throwOnError/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/sdk/throwOnError/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/transformers/type-format-valibot/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/transformers/type-format-valibot/client/client.gen.ts index 329968d82..6ed36fb89 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/transformers/type-format-valibot/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/transformers/type-format-valibot/client/client.gen.ts @@ -2,6 +2,7 @@ import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, @@ -212,26 +213,6 @@ export const createClient = (config: Config = {}): Client => { }; }; - function getValidRequestBody(options: ResolvedRequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; - - return hasSerializedBody ? options.serializedBody : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/transformers/type-format-valibot/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/transformers/type-format-valibot/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/transformers/type-format-valibot/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/transformers/type-format-valibot/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/transformers/type-format-zod/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/transformers/type-format-zod/client/client.gen.ts index 329968d82..6ed36fb89 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/transformers/type-format-zod/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/transformers/type-format-zod/client/client.gen.ts @@ -2,6 +2,7 @@ import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, @@ -212,26 +213,6 @@ export const createClient = (config: Config = {}): Client => { }; }; - function getValidRequestBody(options: ResolvedRequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; - - return hasSerializedBody ? options.serializedBody : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/transformers/type-format-zod/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/transformers/type-format-zod/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/transformers/type-format-zod/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/transformers/type-format-zod/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/typescript/transforms-read-write-custom-name/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/typescript/transforms-read-write-custom-name/client/client.gen.ts index 329968d82..6ed36fb89 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/typescript/transforms-read-write-custom-name/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/typescript/transforms-read-write-custom-name/client/client.gen.ts @@ -2,6 +2,7 @@ import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, @@ -212,26 +213,6 @@ export const createClient = (config: Config = {}): Client => { }; }; - function getValidRequestBody(options: ResolvedRequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; - - return hasSerializedBody ? options.serializedBody : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/typescript/transforms-read-write-custom-name/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/typescript/transforms-read-write-custom-name/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/typescript/transforms-read-write-custom-name/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/typescript/transforms-read-write-custom-name/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/typescript/transforms-read-write-ignore/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/typescript/transforms-read-write-ignore/client/client.gen.ts index 329968d82..6ed36fb89 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/typescript/transforms-read-write-ignore/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/typescript/transforms-read-write-ignore/client/client.gen.ts @@ -2,6 +2,7 @@ import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, @@ -212,26 +213,6 @@ export const createClient = (config: Config = {}): Client => { }; }; - function getValidRequestBody(options: ResolvedRequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; - - return hasSerializedBody ? options.serializedBody : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/typescript/transforms-read-write-ignore/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/typescript/transforms-read-write-ignore/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/typescript/transforms-read-write-ignore/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/typescript/transforms-read-write-ignore/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@pinia/colada/fetch/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@pinia/colada/fetch/client/client.gen.ts index 329968d82..6ed36fb89 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@pinia/colada/fetch/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@pinia/colada/fetch/client/client.gen.ts @@ -2,6 +2,7 @@ import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, @@ -212,26 +213,6 @@ export const createClient = (config: Config = {}): Client => { }; }; - function getValidRequestBody(options: ResolvedRequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; - - return hasSerializedBody ? options.serializedBody : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@pinia/colada/fetch/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@pinia/colada/fetch/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@pinia/colada/fetch/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@pinia/colada/fetch/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@pinia/colada/group-by-tag/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@pinia/colada/group-by-tag/client/client.gen.ts index 329968d82..6ed36fb89 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@pinia/colada/group-by-tag/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@pinia/colada/group-by-tag/client/client.gen.ts @@ -2,6 +2,7 @@ import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, @@ -212,26 +213,6 @@ export const createClient = (config: Config = {}): Client => { }; }; - function getValidRequestBody(options: ResolvedRequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; - - return hasSerializedBody ? options.serializedBody : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@pinia/colada/group-by-tag/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@pinia/colada/group-by-tag/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@pinia/colada/group-by-tag/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@pinia/colada/group-by-tag/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/asClass/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/asClass/client/client.gen.ts index 329968d82..6ed36fb89 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/asClass/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/asClass/client/client.gen.ts @@ -2,6 +2,7 @@ import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, @@ -212,26 +213,6 @@ export const createClient = (config: Config = {}): Client => { }; }; - function getValidRequestBody(options: ResolvedRequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; - - return hasSerializedBody ? options.serializedBody : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/asClass/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/asClass/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/asClass/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/asClass/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/axios/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/axios/client/client.gen.ts index a08594b65..c8a60c6fa 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/axios/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/axios/client/client.gen.ts @@ -5,6 +5,7 @@ import axios from 'axios'; import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, RequestOptions } from './types.gen'; import { buildUrl, @@ -114,23 +115,6 @@ export const createClient = (config: Config = {}): Client => { } }; - function getValidRequestBody(options: RequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - return options.body !== '' ? options.body : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/axios/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/axios/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/axios/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/axios/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/fetch/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/fetch/client/client.gen.ts index 329968d82..6ed36fb89 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/fetch/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/fetch/client/client.gen.ts @@ -2,6 +2,7 @@ import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, @@ -212,26 +213,6 @@ export const createClient = (config: Config = {}): Client => { }; }; - function getValidRequestBody(options: ResolvedRequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; - - return hasSerializedBody ? options.serializedBody : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/fetch/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/fetch/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/fetch/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/fetch/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/name-builder/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/name-builder/client/client.gen.ts index 329968d82..6ed36fb89 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/name-builder/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/name-builder/client/client.gen.ts @@ -2,6 +2,7 @@ import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, @@ -212,26 +213,6 @@ export const createClient = (config: Config = {}): Client => { }; }; - function getValidRequestBody(options: ResolvedRequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; - - return hasSerializedBody ? options.serializedBody : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/name-builder/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/name-builder/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/name-builder/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/name-builder/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/react-query/asClass/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/react-query/asClass/client/client.gen.ts index 329968d82..6ed36fb89 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/react-query/asClass/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/react-query/asClass/client/client.gen.ts @@ -2,6 +2,7 @@ import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, @@ -212,26 +213,6 @@ export const createClient = (config: Config = {}): Client => { }; }; - function getValidRequestBody(options: ResolvedRequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; - - return hasSerializedBody ? options.serializedBody : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/react-query/asClass/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/react-query/asClass/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/react-query/asClass/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/react-query/asClass/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/react-query/axios/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/react-query/axios/client/client.gen.ts index a08594b65..c8a60c6fa 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/react-query/axios/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/react-query/axios/client/client.gen.ts @@ -5,6 +5,7 @@ import axios from 'axios'; import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, RequestOptions } from './types.gen'; import { buildUrl, @@ -114,23 +115,6 @@ export const createClient = (config: Config = {}): Client => { } }; - function getValidRequestBody(options: RequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - return options.body !== '' ? options.body : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/react-query/axios/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/react-query/axios/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/react-query/axios/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/react-query/axios/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/react-query/fetch/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/react-query/fetch/client/client.gen.ts index 329968d82..6ed36fb89 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/react-query/fetch/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/react-query/fetch/client/client.gen.ts @@ -2,6 +2,7 @@ import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, @@ -212,26 +213,6 @@ export const createClient = (config: Config = {}): Client => { }; }; - function getValidRequestBody(options: ResolvedRequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; - - return hasSerializedBody ? options.serializedBody : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/react-query/fetch/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/react-query/fetch/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/react-query/fetch/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/react-query/fetch/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/react-query/name-builder/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/react-query/name-builder/client/client.gen.ts index 329968d82..6ed36fb89 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/react-query/name-builder/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/react-query/name-builder/client/client.gen.ts @@ -2,6 +2,7 @@ import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, @@ -212,26 +213,6 @@ export const createClient = (config: Config = {}): Client => { }; }; - function getValidRequestBody(options: ResolvedRequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; - - return hasSerializedBody ? options.serializedBody : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/react-query/name-builder/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/react-query/name-builder/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/react-query/name-builder/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/react-query/name-builder/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/solid-query/asClass/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/solid-query/asClass/client/client.gen.ts index 329968d82..6ed36fb89 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/solid-query/asClass/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/solid-query/asClass/client/client.gen.ts @@ -2,6 +2,7 @@ import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, @@ -212,26 +213,6 @@ export const createClient = (config: Config = {}): Client => { }; }; - function getValidRequestBody(options: ResolvedRequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; - - return hasSerializedBody ? options.serializedBody : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/solid-query/asClass/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/solid-query/asClass/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/solid-query/asClass/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/solid-query/asClass/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/solid-query/axios/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/solid-query/axios/client/client.gen.ts index a08594b65..c8a60c6fa 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/solid-query/axios/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/solid-query/axios/client/client.gen.ts @@ -5,6 +5,7 @@ import axios from 'axios'; import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, RequestOptions } from './types.gen'; import { buildUrl, @@ -114,23 +115,6 @@ export const createClient = (config: Config = {}): Client => { } }; - function getValidRequestBody(options: RequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - return options.body !== '' ? options.body : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/solid-query/axios/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/solid-query/axios/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/solid-query/axios/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/solid-query/axios/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/solid-query/fetch/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/solid-query/fetch/client/client.gen.ts index 329968d82..6ed36fb89 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/solid-query/fetch/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/solid-query/fetch/client/client.gen.ts @@ -2,6 +2,7 @@ import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, @@ -212,26 +213,6 @@ export const createClient = (config: Config = {}): Client => { }; }; - function getValidRequestBody(options: ResolvedRequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; - - return hasSerializedBody ? options.serializedBody : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/solid-query/fetch/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/solid-query/fetch/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/solid-query/fetch/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/solid-query/fetch/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/solid-query/name-builder/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/solid-query/name-builder/client/client.gen.ts index 329968d82..6ed36fb89 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/solid-query/name-builder/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/solid-query/name-builder/client/client.gen.ts @@ -2,6 +2,7 @@ import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, @@ -212,26 +213,6 @@ export const createClient = (config: Config = {}): Client => { }; }; - function getValidRequestBody(options: ResolvedRequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; - - return hasSerializedBody ? options.serializedBody : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/solid-query/name-builder/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/solid-query/name-builder/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/solid-query/name-builder/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/solid-query/name-builder/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/svelte-query/asClass/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/svelte-query/asClass/client/client.gen.ts index 329968d82..6ed36fb89 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/svelte-query/asClass/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/svelte-query/asClass/client/client.gen.ts @@ -2,6 +2,7 @@ import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, @@ -212,26 +213,6 @@ export const createClient = (config: Config = {}): Client => { }; }; - function getValidRequestBody(options: ResolvedRequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; - - return hasSerializedBody ? options.serializedBody : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/svelte-query/asClass/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/svelte-query/asClass/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/svelte-query/asClass/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/svelte-query/asClass/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/svelte-query/axios/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/svelte-query/axios/client/client.gen.ts index a08594b65..c8a60c6fa 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/svelte-query/axios/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/svelte-query/axios/client/client.gen.ts @@ -5,6 +5,7 @@ import axios from 'axios'; import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, RequestOptions } from './types.gen'; import { buildUrl, @@ -114,23 +115,6 @@ export const createClient = (config: Config = {}): Client => { } }; - function getValidRequestBody(options: RequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - return options.body !== '' ? options.body : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/svelte-query/axios/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/svelte-query/axios/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/svelte-query/axios/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/svelte-query/axios/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/svelte-query/fetch/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/svelte-query/fetch/client/client.gen.ts index 329968d82..6ed36fb89 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/svelte-query/fetch/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/svelte-query/fetch/client/client.gen.ts @@ -2,6 +2,7 @@ import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, @@ -212,26 +213,6 @@ export const createClient = (config: Config = {}): Client => { }; }; - function getValidRequestBody(options: ResolvedRequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; - - return hasSerializedBody ? options.serializedBody : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/svelte-query/fetch/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/svelte-query/fetch/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/svelte-query/fetch/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/svelte-query/fetch/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/svelte-query/name-builder/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/svelte-query/name-builder/client/client.gen.ts index 329968d82..6ed36fb89 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/svelte-query/name-builder/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/svelte-query/name-builder/client/client.gen.ts @@ -2,6 +2,7 @@ import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, @@ -212,26 +213,6 @@ export const createClient = (config: Config = {}): Client => { }; }; - function getValidRequestBody(options: ResolvedRequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; - - return hasSerializedBody ? options.serializedBody : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/svelte-query/name-builder/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/svelte-query/name-builder/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/svelte-query/name-builder/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/svelte-query/name-builder/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/vue-query/asClass/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/vue-query/asClass/client/client.gen.ts index 329968d82..6ed36fb89 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/vue-query/asClass/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/vue-query/asClass/client/client.gen.ts @@ -2,6 +2,7 @@ import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, @@ -212,26 +213,6 @@ export const createClient = (config: Config = {}): Client => { }; }; - function getValidRequestBody(options: ResolvedRequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; - - return hasSerializedBody ? options.serializedBody : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/vue-query/asClass/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/vue-query/asClass/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/vue-query/asClass/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/vue-query/asClass/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/vue-query/axios/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/vue-query/axios/client/client.gen.ts index a08594b65..c8a60c6fa 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/vue-query/axios/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/vue-query/axios/client/client.gen.ts @@ -5,6 +5,7 @@ import axios from 'axios'; import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, RequestOptions } from './types.gen'; import { buildUrl, @@ -114,23 +115,6 @@ export const createClient = (config: Config = {}): Client => { } }; - function getValidRequestBody(options: RequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - return options.body !== '' ? options.body : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/vue-query/axios/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/vue-query/axios/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/vue-query/axios/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/vue-query/axios/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/vue-query/fetch/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/vue-query/fetch/client/client.gen.ts index 329968d82..6ed36fb89 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/vue-query/fetch/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/vue-query/fetch/client/client.gen.ts @@ -2,6 +2,7 @@ import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, @@ -212,26 +213,6 @@ export const createClient = (config: Config = {}): Client => { }; }; - function getValidRequestBody(options: ResolvedRequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; - - return hasSerializedBody ? options.serializedBody : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/vue-query/fetch/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/vue-query/fetch/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/vue-query/fetch/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/vue-query/fetch/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/vue-query/name-builder/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/vue-query/name-builder/client/client.gen.ts index 329968d82..6ed36fb89 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/vue-query/name-builder/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/vue-query/name-builder/client/client.gen.ts @@ -2,6 +2,7 @@ import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, @@ -212,26 +213,6 @@ export const createClient = (config: Config = {}): Client => { }; }; - function getValidRequestBody(options: ResolvedRequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; - - return hasSerializedBody ? options.serializedBody : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/vue-query/name-builder/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/vue-query/name-builder/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/vue-query/name-builder/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/vue-query/name-builder/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/schema-unknown/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/schema-unknown/client/client.gen.ts index 329968d82..6ed36fb89 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/schema-unknown/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/schema-unknown/client/client.gen.ts @@ -2,6 +2,7 @@ import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, @@ -212,26 +213,6 @@ export const createClient = (config: Config = {}): Client => { }; }; - function getValidRequestBody(options: ResolvedRequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; - - return hasSerializedBody ? options.serializedBody : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/schema-unknown/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/schema-unknown/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/schema-unknown/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/schema-unknown/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-api-key/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-api-key/client/client.gen.ts index 329968d82..6ed36fb89 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-api-key/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-api-key/client/client.gen.ts @@ -2,6 +2,7 @@ import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, @@ -212,26 +213,6 @@ export const createClient = (config: Config = {}): Client => { }; }; - function getValidRequestBody(options: ResolvedRequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; - - return hasSerializedBody ? options.serializedBody : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-api-key/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-api-key/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-api-key/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-api-key/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-basic/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-basic/client/client.gen.ts index 329968d82..6ed36fb89 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-basic/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-basic/client/client.gen.ts @@ -2,6 +2,7 @@ import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, @@ -212,26 +213,6 @@ export const createClient = (config: Config = {}): Client => { }; }; - function getValidRequestBody(options: ResolvedRequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; - - return hasSerializedBody ? options.serializedBody : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-basic/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-basic/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-basic/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-basic/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-false/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-false/client/client.gen.ts index 329968d82..6ed36fb89 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-false/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-false/client/client.gen.ts @@ -2,6 +2,7 @@ import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, @@ -212,26 +213,6 @@ export const createClient = (config: Config = {}): Client => { }; }; - function getValidRequestBody(options: ResolvedRequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; - - return hasSerializedBody ? options.serializedBody : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-false/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-false/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-false/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-false/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-oauth2/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-oauth2/client/client.gen.ts index 329968d82..6ed36fb89 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-oauth2/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-oauth2/client/client.gen.ts @@ -2,6 +2,7 @@ import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, @@ -212,26 +213,6 @@ export const createClient = (config: Config = {}): Client => { }; }; - function getValidRequestBody(options: ResolvedRequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; - - return hasSerializedBody ? options.serializedBody : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-oauth2/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-oauth2/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-oauth2/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-oauth2/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/servers-base-path/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/servers-base-path/client/client.gen.ts index 329968d82..6ed36fb89 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/servers-base-path/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/servers-base-path/client/client.gen.ts @@ -2,6 +2,7 @@ import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, @@ -212,26 +213,6 @@ export const createClient = (config: Config = {}): Client => { }; }; - function getValidRequestBody(options: ResolvedRequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; - - return hasSerializedBody ? options.serializedBody : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/servers-base-path/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/servers-base-path/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/servers-base-path/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/servers-base-path/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/servers-host/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/servers-host/client/client.gen.ts index 329968d82..6ed36fb89 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/servers-host/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/servers-host/client/client.gen.ts @@ -2,6 +2,7 @@ import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, @@ -212,26 +213,6 @@ export const createClient = (config: Config = {}): Client => { }; }; - function getValidRequestBody(options: ResolvedRequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; - - return hasSerializedBody ? options.serializedBody : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/servers-host/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/servers-host/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/servers-host/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/servers-host/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/servers/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/servers/client/client.gen.ts index 329968d82..6ed36fb89 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/servers/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/servers/client/client.gen.ts @@ -2,6 +2,7 @@ import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, @@ -212,26 +213,6 @@ export const createClient = (config: Config = {}): Client => { }; }; - function getValidRequestBody(options: ResolvedRequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; - - return hasSerializedBody ? options.serializedBody : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/servers/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/servers/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/servers/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/servers/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/transforms-read-write/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/transforms-read-write/client/client.gen.ts index 329968d82..6ed36fb89 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/transforms-read-write/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/transforms-read-write/client/client.gen.ts @@ -2,6 +2,7 @@ import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, @@ -212,26 +213,6 @@ export const createClient = (config: Config = {}): Client => { }; }; - function getValidRequestBody(options: ResolvedRequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; - - return hasSerializedBody ? options.serializedBody : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/transforms-read-write/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/transforms-read-write/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/transforms-read-write/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/transforms-read-write/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/body-response-text-plain/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/body-response-text-plain/client/client.gen.ts index 329968d82..6ed36fb89 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/body-response-text-plain/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/body-response-text-plain/client/client.gen.ts @@ -2,6 +2,7 @@ import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, @@ -212,26 +213,6 @@ export const createClient = (config: Config = {}): Client => { }; }; - function getValidRequestBody(options: ResolvedRequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; - - return hasSerializedBody ? options.serializedBody : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/body-response-text-plain/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/body-response-text-plain/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/body-response-text-plain/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/body-response-text-plain/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/content-types/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/content-types/client/client.gen.ts index a08594b65..c8a60c6fa 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/content-types/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/content-types/client/client.gen.ts @@ -5,6 +5,7 @@ import axios from 'axios'; import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, RequestOptions } from './types.gen'; import { buildUrl, @@ -114,23 +115,6 @@ export const createClient = (config: Config = {}): Client => { } }; - function getValidRequestBody(options: RequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - return options.body !== '' ? options.body : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/content-types/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/content-types/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/content-types/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/content-types/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/internal-name-conflict/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/internal-name-conflict/client/client.gen.ts index 329968d82..6ed36fb89 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/internal-name-conflict/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/internal-name-conflict/client/client.gen.ts @@ -2,6 +2,7 @@ import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, @@ -212,26 +213,6 @@ export const createClient = (config: Config = {}): Client => { }; }; - function getValidRequestBody(options: ResolvedRequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; - - return hasSerializedBody ? options.serializedBody : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/internal-name-conflict/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/internal-name-conflict/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/internal-name-conflict/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/internal-name-conflict/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/parameter-explode-false-axios/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/parameter-explode-false-axios/client/client.gen.ts index a08594b65..c8a60c6fa 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/parameter-explode-false-axios/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/parameter-explode-false-axios/client/client.gen.ts @@ -5,6 +5,7 @@ import axios from 'axios'; import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, RequestOptions } from './types.gen'; import { buildUrl, @@ -114,23 +115,6 @@ export const createClient = (config: Config = {}): Client => { } }; - function getValidRequestBody(options: RequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - return options.body !== '' ? options.body : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/parameter-explode-false-axios/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/parameter-explode-false-axios/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/parameter-explode-false-axios/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/parameter-explode-false-axios/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/parameter-explode-false/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/parameter-explode-false/client/client.gen.ts index 329968d82..6ed36fb89 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/parameter-explode-false/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/parameter-explode-false/client/client.gen.ts @@ -2,6 +2,7 @@ import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, @@ -212,26 +213,6 @@ export const createClient = (config: Config = {}): Client => { }; }; - function getValidRequestBody(options: ResolvedRequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; - - return hasSerializedBody ? options.serializedBody : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/parameter-explode-false/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/parameter-explode-false/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/parameter-explode-false/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/parameter-explode-false/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/client-fetch/sdk-nested-classes-instance/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/client-fetch/sdk-nested-classes-instance/client/client.gen.ts index 329968d82..6ed36fb89 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/client-fetch/sdk-nested-classes-instance/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/client-fetch/sdk-nested-classes-instance/client/client.gen.ts @@ -2,6 +2,7 @@ import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, @@ -212,26 +213,6 @@ export const createClient = (config: Config = {}): Client => { }; }; - function getValidRequestBody(options: ResolvedRequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; - - return hasSerializedBody ? options.serializedBody : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/client-fetch/sdk-nested-classes-instance/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/client-fetch/sdk-nested-classes-instance/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/client-fetch/sdk-nested-classes-instance/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/client-fetch/sdk-nested-classes-instance/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/client-fetch/sdk-nested-classes/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/client-fetch/sdk-nested-classes/client/client.gen.ts index 329968d82..6ed36fb89 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/client-fetch/sdk-nested-classes/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/client-fetch/sdk-nested-classes/client/client.gen.ts @@ -2,6 +2,7 @@ import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, @@ -212,26 +213,6 @@ export const createClient = (config: Config = {}): Client => { }; }; - function getValidRequestBody(options: ResolvedRequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; - - return hasSerializedBody ? options.serializedBody : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/client-fetch/sdk-nested-classes/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/client-fetch/sdk-nested-classes/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/client-fetch/sdk-nested-classes/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/client-fetch/sdk-nested-classes/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/sdk/default/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/sdk/default/client/client.gen.ts index 329968d82..6ed36fb89 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/sdk/default/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/sdk/default/client/client.gen.ts @@ -2,6 +2,7 @@ import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, @@ -212,26 +213,6 @@ export const createClient = (config: Config = {}): Client => { }; }; - function getValidRequestBody(options: ResolvedRequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; - - return hasSerializedBody ? options.serializedBody : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/sdk/default/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/sdk/default/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/sdk/default/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/sdk/default/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/sdk/instance/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/sdk/instance/client/client.gen.ts index 329968d82..6ed36fb89 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/sdk/instance/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/sdk/instance/client/client.gen.ts @@ -2,6 +2,7 @@ import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, @@ -212,26 +213,6 @@ export const createClient = (config: Config = {}): Client => { }; }; - function getValidRequestBody(options: ResolvedRequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; - - return hasSerializedBody ? options.serializedBody : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/sdk/instance/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/sdk/instance/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/sdk/instance/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/sdk/instance/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/sdk/throwOnError/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/sdk/throwOnError/client/client.gen.ts index 329968d82..6ed36fb89 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/sdk/throwOnError/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/sdk/throwOnError/client/client.gen.ts @@ -2,6 +2,7 @@ import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, @@ -212,26 +213,6 @@ export const createClient = (config: Config = {}): Client => { }; }; - function getValidRequestBody(options: ResolvedRequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; - - return hasSerializedBody ? options.serializedBody : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/sdk/throwOnError/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/sdk/throwOnError/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/sdk/throwOnError/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/sdk/throwOnError/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/transformers/type-format-valibot/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/transformers/type-format-valibot/client/client.gen.ts index 329968d82..6ed36fb89 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/transformers/type-format-valibot/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/transformers/type-format-valibot/client/client.gen.ts @@ -2,6 +2,7 @@ import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, @@ -212,26 +213,6 @@ export const createClient = (config: Config = {}): Client => { }; }; - function getValidRequestBody(options: ResolvedRequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; - - return hasSerializedBody ? options.serializedBody : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/transformers/type-format-valibot/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/transformers/type-format-valibot/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/transformers/type-format-valibot/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/transformers/type-format-valibot/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/transformers/type-format-zod/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/transformers/type-format-zod/client/client.gen.ts index 329968d82..6ed36fb89 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/transformers/type-format-zod/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/transformers/type-format-zod/client/client.gen.ts @@ -2,6 +2,7 @@ import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, @@ -212,26 +213,6 @@ export const createClient = (config: Config = {}): Client => { }; }; - function getValidRequestBody(options: ResolvedRequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; - - return hasSerializedBody ? options.serializedBody : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/transformers/type-format-zod/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/transformers/type-format-zod/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/transformers/type-format-zod/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/transformers/type-format-zod/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/typescript/transforms-read-write-custom-name/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/typescript/transforms-read-write-custom-name/client/client.gen.ts index 329968d82..6ed36fb89 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/typescript/transforms-read-write-custom-name/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/typescript/transforms-read-write-custom-name/client/client.gen.ts @@ -2,6 +2,7 @@ import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, @@ -212,26 +213,6 @@ export const createClient = (config: Config = {}): Client => { }; }; - function getValidRequestBody(options: ResolvedRequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; - - return hasSerializedBody ? options.serializedBody : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/typescript/transforms-read-write-custom-name/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/typescript/transforms-read-write-custom-name/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/typescript/transforms-read-write-custom-name/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/typescript/transforms-read-write-custom-name/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/typescript/transforms-read-write-ignore/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/typescript/transforms-read-write-ignore/client/client.gen.ts index 329968d82..6ed36fb89 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/typescript/transforms-read-write-ignore/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/typescript/transforms-read-write-ignore/client/client.gen.ts @@ -2,6 +2,7 @@ import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, @@ -212,26 +213,6 @@ export const createClient = (config: Config = {}): Client => { }; }; - function getValidRequestBody(options: ResolvedRequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; - - return hasSerializedBody ? options.serializedBody : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/typescript/transforms-read-write-ignore/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/typescript/transforms-read-write-ignore/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/typescript/transforms-read-write-ignore/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/typescript/transforms-read-write-ignore/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@pinia/colada/fetch/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@pinia/colada/fetch/client/client.gen.ts index 329968d82..6ed36fb89 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@pinia/colada/fetch/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@pinia/colada/fetch/client/client.gen.ts @@ -2,6 +2,7 @@ import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, @@ -212,26 +213,6 @@ export const createClient = (config: Config = {}): Client => { }; }; - function getValidRequestBody(options: ResolvedRequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; - - return hasSerializedBody ? options.serializedBody : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@pinia/colada/fetch/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@pinia/colada/fetch/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@pinia/colada/fetch/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@pinia/colada/fetch/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@pinia/colada/group-by-tag/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@pinia/colada/group-by-tag/client/client.gen.ts index 329968d82..6ed36fb89 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@pinia/colada/group-by-tag/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@pinia/colada/group-by-tag/client/client.gen.ts @@ -2,6 +2,7 @@ import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, @@ -212,26 +213,6 @@ export const createClient = (config: Config = {}): Client => { }; }; - function getValidRequestBody(options: ResolvedRequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; - - return hasSerializedBody ? options.serializedBody : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@pinia/colada/group-by-tag/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@pinia/colada/group-by-tag/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@pinia/colada/group-by-tag/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@pinia/colada/group-by-tag/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/angular-query-experimental/asClass/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/angular-query-experimental/asClass/client/client.gen.ts index 329968d82..6ed36fb89 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/angular-query-experimental/asClass/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/angular-query-experimental/asClass/client/client.gen.ts @@ -2,6 +2,7 @@ import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, @@ -212,26 +213,6 @@ export const createClient = (config: Config = {}): Client => { }; }; - function getValidRequestBody(options: ResolvedRequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; - - return hasSerializedBody ? options.serializedBody : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/angular-query-experimental/asClass/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/angular-query-experimental/asClass/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/angular-query-experimental/asClass/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/angular-query-experimental/asClass/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/angular-query-experimental/axios/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/angular-query-experimental/axios/client/client.gen.ts index a08594b65..c8a60c6fa 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/angular-query-experimental/axios/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/angular-query-experimental/axios/client/client.gen.ts @@ -5,6 +5,7 @@ import axios from 'axios'; import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, RequestOptions } from './types.gen'; import { buildUrl, @@ -114,23 +115,6 @@ export const createClient = (config: Config = {}): Client => { } }; - function getValidRequestBody(options: RequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - return options.body !== '' ? options.body : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/angular-query-experimental/axios/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/angular-query-experimental/axios/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/angular-query-experimental/axios/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/angular-query-experimental/axios/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/angular-query-experimental/fetch/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/angular-query-experimental/fetch/client/client.gen.ts index 329968d82..6ed36fb89 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/angular-query-experimental/fetch/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/angular-query-experimental/fetch/client/client.gen.ts @@ -2,6 +2,7 @@ import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, @@ -212,26 +213,6 @@ export const createClient = (config: Config = {}): Client => { }; }; - function getValidRequestBody(options: ResolvedRequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; - - return hasSerializedBody ? options.serializedBody : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/angular-query-experimental/fetch/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/angular-query-experimental/fetch/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/angular-query-experimental/fetch/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/angular-query-experimental/fetch/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/angular-query-experimental/name-builder/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/angular-query-experimental/name-builder/client/client.gen.ts index 329968d82..6ed36fb89 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/angular-query-experimental/name-builder/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/angular-query-experimental/name-builder/client/client.gen.ts @@ -2,6 +2,7 @@ import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, @@ -212,26 +213,6 @@ export const createClient = (config: Config = {}): Client => { }; }; - function getValidRequestBody(options: ResolvedRequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; - - return hasSerializedBody ? options.serializedBody : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/angular-query-experimental/name-builder/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/angular-query-experimental/name-builder/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/angular-query-experimental/name-builder/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/angular-query-experimental/name-builder/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/react-query/asClass/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/react-query/asClass/client/client.gen.ts index 329968d82..6ed36fb89 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/react-query/asClass/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/react-query/asClass/client/client.gen.ts @@ -2,6 +2,7 @@ import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, @@ -212,26 +213,6 @@ export const createClient = (config: Config = {}): Client => { }; }; - function getValidRequestBody(options: ResolvedRequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; - - return hasSerializedBody ? options.serializedBody : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/react-query/asClass/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/react-query/asClass/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/react-query/asClass/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/react-query/asClass/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/react-query/axios/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/react-query/axios/client/client.gen.ts index a08594b65..c8a60c6fa 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/react-query/axios/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/react-query/axios/client/client.gen.ts @@ -5,6 +5,7 @@ import axios from 'axios'; import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, RequestOptions } from './types.gen'; import { buildUrl, @@ -114,23 +115,6 @@ export const createClient = (config: Config = {}): Client => { } }; - function getValidRequestBody(options: RequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - return options.body !== '' ? options.body : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/react-query/axios/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/react-query/axios/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/react-query/axios/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/react-query/axios/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/react-query/fetch/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/react-query/fetch/client/client.gen.ts index 329968d82..6ed36fb89 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/react-query/fetch/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/react-query/fetch/client/client.gen.ts @@ -2,6 +2,7 @@ import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, @@ -212,26 +213,6 @@ export const createClient = (config: Config = {}): Client => { }; }; - function getValidRequestBody(options: ResolvedRequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; - - return hasSerializedBody ? options.serializedBody : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/react-query/fetch/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/react-query/fetch/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/react-query/fetch/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/react-query/fetch/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/react-query/name-builder/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/react-query/name-builder/client/client.gen.ts index 329968d82..6ed36fb89 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/react-query/name-builder/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/react-query/name-builder/client/client.gen.ts @@ -2,6 +2,7 @@ import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, @@ -212,26 +213,6 @@ export const createClient = (config: Config = {}): Client => { }; }; - function getValidRequestBody(options: ResolvedRequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; - - return hasSerializedBody ? options.serializedBody : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/react-query/name-builder/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/react-query/name-builder/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/react-query/name-builder/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/react-query/name-builder/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/solid-query/asClass/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/solid-query/asClass/client/client.gen.ts index 329968d82..6ed36fb89 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/solid-query/asClass/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/solid-query/asClass/client/client.gen.ts @@ -2,6 +2,7 @@ import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, @@ -212,26 +213,6 @@ export const createClient = (config: Config = {}): Client => { }; }; - function getValidRequestBody(options: ResolvedRequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; - - return hasSerializedBody ? options.serializedBody : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/solid-query/asClass/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/solid-query/asClass/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/solid-query/asClass/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/solid-query/asClass/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/solid-query/axios/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/solid-query/axios/client/client.gen.ts index a08594b65..c8a60c6fa 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/solid-query/axios/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/solid-query/axios/client/client.gen.ts @@ -5,6 +5,7 @@ import axios from 'axios'; import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, RequestOptions } from './types.gen'; import { buildUrl, @@ -114,23 +115,6 @@ export const createClient = (config: Config = {}): Client => { } }; - function getValidRequestBody(options: RequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - return options.body !== '' ? options.body : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/solid-query/axios/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/solid-query/axios/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/solid-query/axios/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/solid-query/axios/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/solid-query/fetch/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/solid-query/fetch/client/client.gen.ts index 329968d82..6ed36fb89 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/solid-query/fetch/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/solid-query/fetch/client/client.gen.ts @@ -2,6 +2,7 @@ import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, @@ -212,26 +213,6 @@ export const createClient = (config: Config = {}): Client => { }; }; - function getValidRequestBody(options: ResolvedRequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; - - return hasSerializedBody ? options.serializedBody : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/solid-query/fetch/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/solid-query/fetch/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/solid-query/fetch/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/solid-query/fetch/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/solid-query/name-builder/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/solid-query/name-builder/client/client.gen.ts index 329968d82..6ed36fb89 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/solid-query/name-builder/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/solid-query/name-builder/client/client.gen.ts @@ -2,6 +2,7 @@ import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, @@ -212,26 +213,6 @@ export const createClient = (config: Config = {}): Client => { }; }; - function getValidRequestBody(options: ResolvedRequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; - - return hasSerializedBody ? options.serializedBody : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/solid-query/name-builder/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/solid-query/name-builder/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/solid-query/name-builder/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/solid-query/name-builder/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/svelte-query/asClass/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/svelte-query/asClass/client/client.gen.ts index 329968d82..6ed36fb89 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/svelte-query/asClass/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/svelte-query/asClass/client/client.gen.ts @@ -2,6 +2,7 @@ import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, @@ -212,26 +213,6 @@ export const createClient = (config: Config = {}): Client => { }; }; - function getValidRequestBody(options: ResolvedRequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; - - return hasSerializedBody ? options.serializedBody : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/svelte-query/asClass/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/svelte-query/asClass/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/svelte-query/asClass/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/svelte-query/asClass/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/svelte-query/axios/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/svelte-query/axios/client/client.gen.ts index a08594b65..c8a60c6fa 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/svelte-query/axios/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/svelte-query/axios/client/client.gen.ts @@ -5,6 +5,7 @@ import axios from 'axios'; import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, RequestOptions } from './types.gen'; import { buildUrl, @@ -114,23 +115,6 @@ export const createClient = (config: Config = {}): Client => { } }; - function getValidRequestBody(options: RequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - return options.body !== '' ? options.body : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/svelte-query/axios/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/svelte-query/axios/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/svelte-query/axios/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/svelte-query/axios/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/svelte-query/fetch/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/svelte-query/fetch/client/client.gen.ts index 329968d82..6ed36fb89 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/svelte-query/fetch/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/svelte-query/fetch/client/client.gen.ts @@ -2,6 +2,7 @@ import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, @@ -212,26 +213,6 @@ export const createClient = (config: Config = {}): Client => { }; }; - function getValidRequestBody(options: ResolvedRequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; - - return hasSerializedBody ? options.serializedBody : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/svelte-query/fetch/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/svelte-query/fetch/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/svelte-query/fetch/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/svelte-query/fetch/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/svelte-query/name-builder/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/svelte-query/name-builder/client/client.gen.ts index 329968d82..6ed36fb89 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/svelte-query/name-builder/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/svelte-query/name-builder/client/client.gen.ts @@ -2,6 +2,7 @@ import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, @@ -212,26 +213,6 @@ export const createClient = (config: Config = {}): Client => { }; }; - function getValidRequestBody(options: ResolvedRequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; - - return hasSerializedBody ? options.serializedBody : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/svelte-query/name-builder/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/svelte-query/name-builder/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/svelte-query/name-builder/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/svelte-query/name-builder/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/vue-query/asClass/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/vue-query/asClass/client/client.gen.ts index 329968d82..6ed36fb89 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/vue-query/asClass/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/vue-query/asClass/client/client.gen.ts @@ -2,6 +2,7 @@ import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, @@ -212,26 +213,6 @@ export const createClient = (config: Config = {}): Client => { }; }; - function getValidRequestBody(options: ResolvedRequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; - - return hasSerializedBody ? options.serializedBody : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/vue-query/asClass/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/vue-query/asClass/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/vue-query/asClass/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/vue-query/asClass/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/vue-query/axios/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/vue-query/axios/client/client.gen.ts index a08594b65..c8a60c6fa 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/vue-query/axios/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/vue-query/axios/client/client.gen.ts @@ -5,6 +5,7 @@ import axios from 'axios'; import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, RequestOptions } from './types.gen'; import { buildUrl, @@ -114,23 +115,6 @@ export const createClient = (config: Config = {}): Client => { } }; - function getValidRequestBody(options: RequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - return options.body !== '' ? options.body : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/vue-query/axios/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/vue-query/axios/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/vue-query/axios/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/vue-query/axios/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/vue-query/fetch/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/vue-query/fetch/client/client.gen.ts index 329968d82..6ed36fb89 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/vue-query/fetch/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/vue-query/fetch/client/client.gen.ts @@ -2,6 +2,7 @@ import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, @@ -212,26 +213,6 @@ export const createClient = (config: Config = {}): Client => { }; }; - function getValidRequestBody(options: ResolvedRequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; - - return hasSerializedBody ? options.serializedBody : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/vue-query/fetch/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/vue-query/fetch/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/vue-query/fetch/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/vue-query/fetch/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/vue-query/name-builder/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/vue-query/name-builder/client/client.gen.ts index 329968d82..6ed36fb89 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/vue-query/name-builder/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/vue-query/name-builder/client/client.gen.ts @@ -2,6 +2,7 @@ import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, @@ -212,26 +213,6 @@ export const createClient = (config: Config = {}): Client => { }; }; - function getValidRequestBody(options: ResolvedRequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; - - return hasSerializedBody ? options.serializedBody : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/vue-query/name-builder/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/vue-query/name-builder/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/vue-query/name-builder/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/vue-query/name-builder/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-api-key/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-api-key/client/client.gen.ts index 329968d82..6ed36fb89 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-api-key/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-api-key/client/client.gen.ts @@ -2,6 +2,7 @@ import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, @@ -212,26 +213,6 @@ export const createClient = (config: Config = {}): Client => { }; }; - function getValidRequestBody(options: ResolvedRequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; - - return hasSerializedBody ? options.serializedBody : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-api-key/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-api-key/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-api-key/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-api-key/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-false/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-false/client/client.gen.ts index 329968d82..6ed36fb89 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-false/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-false/client/client.gen.ts @@ -2,6 +2,7 @@ import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, @@ -212,26 +213,6 @@ export const createClient = (config: Config = {}): Client => { }; }; - function getValidRequestBody(options: ResolvedRequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; - - return hasSerializedBody ? options.serializedBody : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-false/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-false/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-false/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-false/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-http-bearer/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-http-bearer/client/client.gen.ts index 329968d82..6ed36fb89 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-http-bearer/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-http-bearer/client/client.gen.ts @@ -2,6 +2,7 @@ import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, @@ -212,26 +213,6 @@ export const createClient = (config: Config = {}): Client => { }; }; - function getValidRequestBody(options: ResolvedRequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; - - return hasSerializedBody ? options.serializedBody : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-http-bearer/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-http-bearer/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-http-bearer/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-http-bearer/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-oauth2/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-oauth2/client/client.gen.ts index 329968d82..6ed36fb89 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-oauth2/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-oauth2/client/client.gen.ts @@ -2,6 +2,7 @@ import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, @@ -212,26 +213,6 @@ export const createClient = (config: Config = {}): Client => { }; }; - function getValidRequestBody(options: ResolvedRequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; - - return hasSerializedBody ? options.serializedBody : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-oauth2/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-oauth2/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-oauth2/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-oauth2/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-open-id-connect/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-open-id-connect/client/client.gen.ts index 329968d82..6ed36fb89 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-open-id-connect/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-open-id-connect/client/client.gen.ts @@ -2,6 +2,7 @@ import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, @@ -212,26 +213,6 @@ export const createClient = (config: Config = {}): Client => { }; }; - function getValidRequestBody(options: ResolvedRequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; - - return hasSerializedBody ? options.serializedBody : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-open-id-connect/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-open-id-connect/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-open-id-connect/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-open-id-connect/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/servers/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/servers/client/client.gen.ts index 329968d82..6ed36fb89 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/servers/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/servers/client/client.gen.ts @@ -2,6 +2,7 @@ import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, @@ -212,26 +213,6 @@ export const createClient = (config: Config = {}): Client => { }; }; - function getValidRequestBody(options: ResolvedRequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; - - return hasSerializedBody ? options.serializedBody : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/servers/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/servers/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/servers/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/servers/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transformers-all-of/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transformers-all-of/client/client.gen.ts index 329968d82..6ed36fb89 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transformers-all-of/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transformers-all-of/client/client.gen.ts @@ -2,6 +2,7 @@ import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, @@ -212,26 +213,6 @@ export const createClient = (config: Config = {}): Client => { }; }; - function getValidRequestBody(options: ResolvedRequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; - - return hasSerializedBody ? options.serializedBody : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transformers-all-of/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transformers-all-of/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transformers-all-of/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transformers-all-of/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transformers-any-of-null/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transformers-any-of-null/client/client.gen.ts index 329968d82..6ed36fb89 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transformers-any-of-null/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transformers-any-of-null/client/client.gen.ts @@ -2,6 +2,7 @@ import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, @@ -212,26 +213,6 @@ export const createClient = (config: Config = {}): Client => { }; }; - function getValidRequestBody(options: ResolvedRequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; - - return hasSerializedBody ? options.serializedBody : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transformers-any-of-null/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transformers-any-of-null/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transformers-any-of-null/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transformers-any-of-null/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transformers-array/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transformers-array/client/client.gen.ts index 329968d82..6ed36fb89 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transformers-array/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transformers-array/client/client.gen.ts @@ -2,6 +2,7 @@ import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, @@ -212,26 +213,6 @@ export const createClient = (config: Config = {}): Client => { }; }; - function getValidRequestBody(options: ResolvedRequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; - - return hasSerializedBody ? options.serializedBody : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transformers-array/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transformers-array/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transformers-array/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transformers-array/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transforms-read-write/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transforms-read-write/client/client.gen.ts index 329968d82..6ed36fb89 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transforms-read-write/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transforms-read-write/client/client.gen.ts @@ -2,6 +2,7 @@ import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, @@ -212,26 +213,6 @@ export const createClient = (config: Config = {}): Client => { }; }; - function getValidRequestBody(options: ResolvedRequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; - - return hasSerializedBody ? options.serializedBody : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transforms-read-write/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transforms-read-write/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transforms-read-write/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transforms-read-write/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/body-response-text-plain/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/body-response-text-plain/client/client.gen.ts index 329968d82..6ed36fb89 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/body-response-text-plain/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/body-response-text-plain/client/client.gen.ts @@ -2,6 +2,7 @@ import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, @@ -212,26 +213,6 @@ export const createClient = (config: Config = {}): Client => { }; }; - function getValidRequestBody(options: ResolvedRequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; - - return hasSerializedBody ? options.serializedBody : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/body-response-text-plain/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/body-response-text-plain/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/body-response-text-plain/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/body-response-text-plain/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/base-url-false/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/base-url-false/client/client.gen.ts index a08594b65..c8a60c6fa 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/base-url-false/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/base-url-false/client/client.gen.ts @@ -5,6 +5,7 @@ import axios from 'axios'; import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, RequestOptions } from './types.gen'; import { buildUrl, @@ -114,23 +115,6 @@ export const createClient = (config: Config = {}): Client => { } }; - function getValidRequestBody(options: RequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - return options.body !== '' ? options.body : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/base-url-false/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/base-url-false/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/base-url-false/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/base-url-false/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/base-url-number/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/base-url-number/client/client.gen.ts index a08594b65..c8a60c6fa 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/base-url-number/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/base-url-number/client/client.gen.ts @@ -5,6 +5,7 @@ import axios from 'axios'; import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, RequestOptions } from './types.gen'; import { buildUrl, @@ -114,23 +115,6 @@ export const createClient = (config: Config = {}): Client => { } }; - function getValidRequestBody(options: RequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - return options.body !== '' ? options.body : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/base-url-number/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/base-url-number/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/base-url-number/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/base-url-number/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/base-url-strict/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/base-url-strict/client/client.gen.ts index a08594b65..c8a60c6fa 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/base-url-strict/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/base-url-strict/client/client.gen.ts @@ -5,6 +5,7 @@ import axios from 'axios'; import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, RequestOptions } from './types.gen'; import { buildUrl, @@ -114,23 +115,6 @@ export const createClient = (config: Config = {}): Client => { } }; - function getValidRequestBody(options: RequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - return options.body !== '' ? options.body : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/base-url-strict/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/base-url-strict/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/base-url-strict/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/base-url-strict/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/base-url-string/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/base-url-string/client/client.gen.ts index a08594b65..c8a60c6fa 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/base-url-string/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/base-url-string/client/client.gen.ts @@ -5,6 +5,7 @@ import axios from 'axios'; import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, RequestOptions } from './types.gen'; import { buildUrl, @@ -114,23 +115,6 @@ export const createClient = (config: Config = {}): Client => { } }; - function getValidRequestBody(options: RequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - return options.body !== '' ? options.body : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/base-url-string/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/base-url-string/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/base-url-string/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/base-url-string/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/clean-false/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/clean-false/client/client.gen.ts index a08594b65..c8a60c6fa 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/clean-false/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/clean-false/client/client.gen.ts @@ -5,6 +5,7 @@ import axios from 'axios'; import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, RequestOptions } from './types.gen'; import { buildUrl, @@ -114,23 +115,6 @@ export const createClient = (config: Config = {}): Client => { } }; - function getValidRequestBody(options: RequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - return options.body !== '' ? options.body : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/clean-false/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/clean-false/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/clean-false/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/clean-false/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/default/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/default/client/client.gen.ts index a08594b65..c8a60c6fa 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/default/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/default/client/client.gen.ts @@ -5,6 +5,7 @@ import axios from 'axios'; import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, RequestOptions } from './types.gen'; import { buildUrl, @@ -114,23 +115,6 @@ export const createClient = (config: Config = {}): Client => { } }; - function getValidRequestBody(options: RequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - return options.body !== '' ? options.body : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/default/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/default/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/default/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/default/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/sdk-client-optional/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/sdk-client-optional/client/client.gen.ts index a08594b65..c8a60c6fa 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/sdk-client-optional/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/sdk-client-optional/client/client.gen.ts @@ -5,6 +5,7 @@ import axios from 'axios'; import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, RequestOptions } from './types.gen'; import { buildUrl, @@ -114,23 +115,6 @@ export const createClient = (config: Config = {}): Client => { } }; - function getValidRequestBody(options: RequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - return options.body !== '' ? options.body : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/sdk-client-optional/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/sdk-client-optional/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/sdk-client-optional/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/sdk-client-optional/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/sdk-client-required/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/sdk-client-required/client/client.gen.ts index a08594b65..c8a60c6fa 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/sdk-client-required/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/sdk-client-required/client/client.gen.ts @@ -5,6 +5,7 @@ import axios from 'axios'; import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, RequestOptions } from './types.gen'; import { buildUrl, @@ -114,23 +115,6 @@ export const createClient = (config: Config = {}): Client => { } }; - function getValidRequestBody(options: RequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - return options.body !== '' ? options.body : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/sdk-client-required/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/sdk-client-required/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/sdk-client-required/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/sdk-client-required/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/tsconfig-nodenext-sdk/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/tsconfig-nodenext-sdk/client/client.gen.ts index 67f6a72f1..17fc6d73c 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/tsconfig-nodenext-sdk/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/tsconfig-nodenext-sdk/client/client.gen.ts @@ -5,6 +5,7 @@ import axios from 'axios'; import { createSseClient } from '../core/serverSentEvents.gen.js'; import type { HttpMethod } from '../core/types.gen.js'; +import { getValidRequestBody } from '../core/utils.gen.js'; import type { Client, Config, RequestOptions } from './types.gen.js'; import { buildUrl, @@ -114,23 +115,6 @@ export const createClient = (config: Config = {}): Client => { } }; - function getValidRequestBody(options: RequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - return options.body !== '' ? options.body : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/tsconfig-nodenext-sdk/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/tsconfig-nodenext-sdk/core/utils.gen.ts index 551c1177b..7aed565b1 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/tsconfig-nodenext-sdk/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/tsconfig-nodenext-sdk/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen.js'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen.js'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-false/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-false/client/client.gen.ts index 329968d82..6ed36fb89 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-false/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-false/client/client.gen.ts @@ -2,6 +2,7 @@ import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, @@ -212,26 +213,6 @@ export const createClient = (config: Config = {}): Client => { }; }; - function getValidRequestBody(options: ResolvedRequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; - - return hasSerializedBody ? options.serializedBody : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-false/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-false/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-false/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-false/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-number/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-number/client/client.gen.ts index 329968d82..6ed36fb89 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-number/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-number/client/client.gen.ts @@ -2,6 +2,7 @@ import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, @@ -212,26 +213,6 @@ export const createClient = (config: Config = {}): Client => { }; }; - function getValidRequestBody(options: ResolvedRequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; - - return hasSerializedBody ? options.serializedBody : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-number/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-number/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-number/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-number/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-strict/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-strict/client/client.gen.ts index 329968d82..6ed36fb89 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-strict/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-strict/client/client.gen.ts @@ -2,6 +2,7 @@ import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, @@ -212,26 +213,6 @@ export const createClient = (config: Config = {}): Client => { }; }; - function getValidRequestBody(options: ResolvedRequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; - - return hasSerializedBody ? options.serializedBody : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-strict/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-strict/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-strict/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-strict/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-string/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-string/client/client.gen.ts index 329968d82..6ed36fb89 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-string/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-string/client/client.gen.ts @@ -2,6 +2,7 @@ import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, @@ -212,26 +213,6 @@ export const createClient = (config: Config = {}): Client => { }; }; - function getValidRequestBody(options: ResolvedRequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; - - return hasSerializedBody ? options.serializedBody : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-string/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-string/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-string/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-string/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/clean-false/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/clean-false/client/client.gen.ts index 329968d82..6ed36fb89 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/clean-false/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/clean-false/client/client.gen.ts @@ -2,6 +2,7 @@ import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, @@ -212,26 +213,6 @@ export const createClient = (config: Config = {}): Client => { }; }; - function getValidRequestBody(options: ResolvedRequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; - - return hasSerializedBody ? options.serializedBody : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/clean-false/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/clean-false/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/clean-false/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/clean-false/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/default/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/default/client/client.gen.ts index 329968d82..6ed36fb89 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/default/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/default/client/client.gen.ts @@ -2,6 +2,7 @@ import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, @@ -212,26 +213,6 @@ export const createClient = (config: Config = {}): Client => { }; }; - function getValidRequestBody(options: ResolvedRequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; - - return hasSerializedBody ? options.serializedBody : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/default/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/default/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/default/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/default/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/sdk-client-optional/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/sdk-client-optional/client/client.gen.ts index 329968d82..6ed36fb89 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/sdk-client-optional/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/sdk-client-optional/client/client.gen.ts @@ -2,6 +2,7 @@ import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, @@ -212,26 +213,6 @@ export const createClient = (config: Config = {}): Client => { }; }; - function getValidRequestBody(options: ResolvedRequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; - - return hasSerializedBody ? options.serializedBody : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/sdk-client-optional/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/sdk-client-optional/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/sdk-client-optional/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/sdk-client-optional/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/sdk-client-required/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/sdk-client-required/client/client.gen.ts index 329968d82..6ed36fb89 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/sdk-client-required/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/sdk-client-required/client/client.gen.ts @@ -2,6 +2,7 @@ import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, @@ -212,26 +213,6 @@ export const createClient = (config: Config = {}): Client => { }; }; - function getValidRequestBody(options: ResolvedRequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; - - return hasSerializedBody ? options.serializedBody : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/sdk-client-required/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/sdk-client-required/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/sdk-client-required/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/sdk-client-required/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/tsconfig-nodenext-sdk/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/tsconfig-nodenext-sdk/client/client.gen.ts index 6b56f4523..abde5f47a 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/tsconfig-nodenext-sdk/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/tsconfig-nodenext-sdk/client/client.gen.ts @@ -2,6 +2,7 @@ import { createSseClient } from '../core/serverSentEvents.gen.js'; import type { HttpMethod } from '../core/types.gen.js'; +import { getValidRequestBody } from '../core/utils.gen.js'; import type { Client, Config, @@ -212,26 +213,6 @@ export const createClient = (config: Config = {}): Client => { }; }; - function getValidRequestBody(options: ResolvedRequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; - - return hasSerializedBody ? options.serializedBody : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/tsconfig-nodenext-sdk/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/tsconfig-nodenext-sdk/core/utils.gen.ts index 551c1177b..7aed565b1 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/tsconfig-nodenext-sdk/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/tsconfig-nodenext-sdk/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen.js'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen.js'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-false/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-false/client/client.gen.ts index ad44b7fba..275d3501c 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-false/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-false/client/client.gen.ts @@ -2,6 +2,7 @@ import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, @@ -200,26 +201,6 @@ export const createClient = (config: Config = {}): Client => { }; }; - function getValidRequestBody(options: ResolvedRequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; - - return hasSerializedBody ? options.serializedBody : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-false/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-false/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-false/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-false/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-number/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-number/client/client.gen.ts index ad44b7fba..275d3501c 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-number/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-number/client/client.gen.ts @@ -2,6 +2,7 @@ import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, @@ -200,26 +201,6 @@ export const createClient = (config: Config = {}): Client => { }; }; - function getValidRequestBody(options: ResolvedRequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; - - return hasSerializedBody ? options.serializedBody : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-number/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-number/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-number/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-number/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-strict/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-strict/client/client.gen.ts index ad44b7fba..275d3501c 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-strict/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-strict/client/client.gen.ts @@ -2,6 +2,7 @@ import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, @@ -200,26 +201,6 @@ export const createClient = (config: Config = {}): Client => { }; }; - function getValidRequestBody(options: ResolvedRequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; - - return hasSerializedBody ? options.serializedBody : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-strict/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-strict/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-strict/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-strict/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-string/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-string/client/client.gen.ts index ad44b7fba..275d3501c 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-string/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-string/client/client.gen.ts @@ -2,6 +2,7 @@ import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, @@ -200,26 +201,6 @@ export const createClient = (config: Config = {}): Client => { }; }; - function getValidRequestBody(options: ResolvedRequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; - - return hasSerializedBody ? options.serializedBody : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-string/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-string/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-string/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-string/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/clean-false/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/clean-false/client/client.gen.ts index ad44b7fba..275d3501c 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/clean-false/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/clean-false/client/client.gen.ts @@ -2,6 +2,7 @@ import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, @@ -200,26 +201,6 @@ export const createClient = (config: Config = {}): Client => { }; }; - function getValidRequestBody(options: ResolvedRequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; - - return hasSerializedBody ? options.serializedBody : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/clean-false/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/clean-false/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/clean-false/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/clean-false/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/default/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/default/client/client.gen.ts index ad44b7fba..275d3501c 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/default/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/default/client/client.gen.ts @@ -2,6 +2,7 @@ import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, @@ -200,26 +201,6 @@ export const createClient = (config: Config = {}): Client => { }; }; - function getValidRequestBody(options: ResolvedRequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; - - return hasSerializedBody ? options.serializedBody : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/default/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/default/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/default/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/default/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/sdk-client-optional/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/sdk-client-optional/client/client.gen.ts index ad44b7fba..275d3501c 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/sdk-client-optional/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/sdk-client-optional/client/client.gen.ts @@ -2,6 +2,7 @@ import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, @@ -200,26 +201,6 @@ export const createClient = (config: Config = {}): Client => { }; }; - function getValidRequestBody(options: ResolvedRequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; - - return hasSerializedBody ? options.serializedBody : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/sdk-client-optional/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/sdk-client-optional/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/sdk-client-optional/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/sdk-client-optional/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/sdk-client-required/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/sdk-client-required/client/client.gen.ts index ad44b7fba..275d3501c 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/sdk-client-required/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/sdk-client-required/client/client.gen.ts @@ -2,6 +2,7 @@ import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, @@ -200,26 +201,6 @@ export const createClient = (config: Config = {}): Client => { }; }; - function getValidRequestBody(options: ResolvedRequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; - - return hasSerializedBody ? options.serializedBody : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/sdk-client-required/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/sdk-client-required/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/sdk-client-required/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/sdk-client-required/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/tsconfig-nodenext-sdk/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/tsconfig-nodenext-sdk/client/client.gen.ts index f1bc43c02..9b64299f0 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/tsconfig-nodenext-sdk/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/tsconfig-nodenext-sdk/client/client.gen.ts @@ -2,6 +2,7 @@ import { createSseClient } from '../core/serverSentEvents.gen.js'; import type { HttpMethod } from '../core/types.gen.js'; +import { getValidRequestBody } from '../core/utils.gen.js'; import type { Client, Config, @@ -200,26 +201,6 @@ export const createClient = (config: Config = {}): Client => { }; }; - function getValidRequestBody(options: ResolvedRequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; - - return hasSerializedBody ? options.serializedBody : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/tsconfig-nodenext-sdk/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/tsconfig-nodenext-sdk/core/utils.gen.ts index 551c1177b..7aed565b1 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/tsconfig-nodenext-sdk/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/tsconfig-nodenext-sdk/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen.js'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen.js'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/base-url-false/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/base-url-false/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/base-url-false/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/base-url-false/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/base-url-number/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/base-url-number/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/base-url-number/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/base-url-number/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/base-url-strict/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/base-url-strict/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/base-url-strict/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/base-url-strict/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/base-url-string/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/base-url-string/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/base-url-string/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/base-url-string/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/clean-false/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/clean-false/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/clean-false/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/clean-false/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/default/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/default/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/default/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/default/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/sdk-client-optional/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/sdk-client-optional/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/sdk-client-optional/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/sdk-client-optional/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/sdk-client-required/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/sdk-client-required/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/sdk-client-required/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/sdk-client-required/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/tsconfig-nodenext-sdk/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/tsconfig-nodenext-sdk/core/utils.gen.ts index 551c1177b..7aed565b1 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/tsconfig-nodenext-sdk/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/tsconfig-nodenext-sdk/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen.js'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen.js'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/content-types/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/content-types/client/client.gen.ts index a08594b65..c8a60c6fa 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/content-types/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/content-types/client/client.gen.ts @@ -5,6 +5,7 @@ import axios from 'axios'; import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, RequestOptions } from './types.gen'; import { buildUrl, @@ -114,23 +115,6 @@ export const createClient = (config: Config = {}): Client => { } }; - function getValidRequestBody(options: RequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - return options.body !== '' ? options.body : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/content-types/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/content-types/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/content-types/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/content-types/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/headers/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/headers/client/client.gen.ts index 329968d82..6ed36fb89 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/headers/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/headers/client/client.gen.ts @@ -2,6 +2,7 @@ import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, @@ -212,26 +213,6 @@ export const createClient = (config: Config = {}): Client => { }; }; - function getValidRequestBody(options: ResolvedRequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; - - return hasSerializedBody ? options.serializedBody : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/headers/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/headers/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/headers/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/headers/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/internal-name-conflict/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/internal-name-conflict/client/client.gen.ts index 329968d82..6ed36fb89 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/internal-name-conflict/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/internal-name-conflict/client/client.gen.ts @@ -2,6 +2,7 @@ import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, @@ -212,26 +213,6 @@ export const createClient = (config: Config = {}): Client => { }; }; - function getValidRequestBody(options: ResolvedRequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; - - return hasSerializedBody ? options.serializedBody : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/internal-name-conflict/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/internal-name-conflict/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/internal-name-conflict/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/internal-name-conflict/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/pagination-ref/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/pagination-ref/client/client.gen.ts index 329968d82..6ed36fb89 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/pagination-ref/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/pagination-ref/client/client.gen.ts @@ -2,6 +2,7 @@ import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, @@ -212,26 +213,6 @@ export const createClient = (config: Config = {}): Client => { }; }; - function getValidRequestBody(options: ResolvedRequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; - - return hasSerializedBody ? options.serializedBody : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/pagination-ref/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/pagination-ref/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/pagination-ref/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/pagination-ref/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/parameter-explode-false-axios/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/parameter-explode-false-axios/client/client.gen.ts index a08594b65..c8a60c6fa 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/parameter-explode-false-axios/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/parameter-explode-false-axios/client/client.gen.ts @@ -5,6 +5,7 @@ import axios from 'axios'; import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, RequestOptions } from './types.gen'; import { buildUrl, @@ -114,23 +115,6 @@ export const createClient = (config: Config = {}): Client => { } }; - function getValidRequestBody(options: RequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - return options.body !== '' ? options.body : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/parameter-explode-false-axios/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/parameter-explode-false-axios/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/parameter-explode-false-axios/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/parameter-explode-false-axios/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/parameter-explode-false/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/parameter-explode-false/client/client.gen.ts index 329968d82..6ed36fb89 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/parameter-explode-false/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/parameter-explode-false/client/client.gen.ts @@ -2,6 +2,7 @@ import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, @@ -212,26 +213,6 @@ export const createClient = (config: Config = {}): Client => { }; }; - function getValidRequestBody(options: ResolvedRequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; - - return hasSerializedBody ? options.serializedBody : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/parameter-explode-false/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/parameter-explode-false/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/parameter-explode-false/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/parameter-explode-false/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/client-fetch/sdk-nested-classes-instance/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/client-fetch/sdk-nested-classes-instance/client/client.gen.ts index 329968d82..6ed36fb89 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/client-fetch/sdk-nested-classes-instance/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/client-fetch/sdk-nested-classes-instance/client/client.gen.ts @@ -2,6 +2,7 @@ import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, @@ -212,26 +213,6 @@ export const createClient = (config: Config = {}): Client => { }; }; - function getValidRequestBody(options: ResolvedRequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; - - return hasSerializedBody ? options.serializedBody : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/client-fetch/sdk-nested-classes-instance/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/client-fetch/sdk-nested-classes-instance/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/client-fetch/sdk-nested-classes-instance/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/client-fetch/sdk-nested-classes-instance/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/client-fetch/sdk-nested-classes/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/client-fetch/sdk-nested-classes/client/client.gen.ts index 329968d82..6ed36fb89 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/client-fetch/sdk-nested-classes/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/client-fetch/sdk-nested-classes/client/client.gen.ts @@ -2,6 +2,7 @@ import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, @@ -212,26 +213,6 @@ export const createClient = (config: Config = {}): Client => { }; }; - function getValidRequestBody(options: ResolvedRequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; - - return hasSerializedBody ? options.serializedBody : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/client-fetch/sdk-nested-classes/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/client-fetch/sdk-nested-classes/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/client-fetch/sdk-nested-classes/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/client-fetch/sdk-nested-classes/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/sdk/default/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/sdk/default/client/client.gen.ts index 329968d82..6ed36fb89 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/sdk/default/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/sdk/default/client/client.gen.ts @@ -2,6 +2,7 @@ import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, @@ -212,26 +213,6 @@ export const createClient = (config: Config = {}): Client => { }; }; - function getValidRequestBody(options: ResolvedRequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; - - return hasSerializedBody ? options.serializedBody : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/sdk/default/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/sdk/default/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/sdk/default/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/sdk/default/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/sdk/instance/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/sdk/instance/client/client.gen.ts index 329968d82..6ed36fb89 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/sdk/instance/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/sdk/instance/client/client.gen.ts @@ -2,6 +2,7 @@ import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, @@ -212,26 +213,6 @@ export const createClient = (config: Config = {}): Client => { }; }; - function getValidRequestBody(options: ResolvedRequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; - - return hasSerializedBody ? options.serializedBody : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/sdk/instance/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/sdk/instance/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/sdk/instance/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/sdk/instance/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/sdk/throwOnError/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/sdk/throwOnError/client/client.gen.ts index 329968d82..6ed36fb89 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/sdk/throwOnError/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/sdk/throwOnError/client/client.gen.ts @@ -2,6 +2,7 @@ import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, @@ -212,26 +213,6 @@ export const createClient = (config: Config = {}): Client => { }; }; - function getValidRequestBody(options: ResolvedRequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; - - return hasSerializedBody ? options.serializedBody : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/sdk/throwOnError/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/sdk/throwOnError/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/sdk/throwOnError/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/sdk/throwOnError/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/transformers/type-format-valibot/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/transformers/type-format-valibot/client/client.gen.ts index 329968d82..6ed36fb89 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/transformers/type-format-valibot/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/transformers/type-format-valibot/client/client.gen.ts @@ -2,6 +2,7 @@ import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, @@ -212,26 +213,6 @@ export const createClient = (config: Config = {}): Client => { }; }; - function getValidRequestBody(options: ResolvedRequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; - - return hasSerializedBody ? options.serializedBody : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/transformers/type-format-valibot/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/transformers/type-format-valibot/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/transformers/type-format-valibot/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/transformers/type-format-valibot/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/transformers/type-format-zod/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/transformers/type-format-zod/client/client.gen.ts index 329968d82..6ed36fb89 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/transformers/type-format-zod/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/transformers/type-format-zod/client/client.gen.ts @@ -2,6 +2,7 @@ import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, @@ -212,26 +213,6 @@ export const createClient = (config: Config = {}): Client => { }; }; - function getValidRequestBody(options: ResolvedRequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; - - return hasSerializedBody ? options.serializedBody : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/transformers/type-format-zod/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/transformers/type-format-zod/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/transformers/type-format-zod/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/transformers/type-format-zod/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/typescript/transforms-read-write-custom-name/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/typescript/transforms-read-write-custom-name/client/client.gen.ts index 329968d82..6ed36fb89 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/typescript/transforms-read-write-custom-name/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/typescript/transforms-read-write-custom-name/client/client.gen.ts @@ -2,6 +2,7 @@ import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, @@ -212,26 +213,6 @@ export const createClient = (config: Config = {}): Client => { }; }; - function getValidRequestBody(options: ResolvedRequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; - - return hasSerializedBody ? options.serializedBody : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/typescript/transforms-read-write-custom-name/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/typescript/transforms-read-write-custom-name/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/typescript/transforms-read-write-custom-name/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/typescript/transforms-read-write-custom-name/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/typescript/transforms-read-write-ignore/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/typescript/transforms-read-write-ignore/client/client.gen.ts index 329968d82..6ed36fb89 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/typescript/transforms-read-write-ignore/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/typescript/transforms-read-write-ignore/client/client.gen.ts @@ -2,6 +2,7 @@ import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, @@ -212,26 +213,6 @@ export const createClient = (config: Config = {}): Client => { }; }; - function getValidRequestBody(options: ResolvedRequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; - - return hasSerializedBody ? options.serializedBody : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/typescript/transforms-read-write-ignore/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/typescript/transforms-read-write-ignore/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/typescript/transforms-read-write-ignore/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/typescript/transforms-read-write-ignore/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@pinia/colada/fetch/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@pinia/colada/fetch/client/client.gen.ts index 329968d82..6ed36fb89 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@pinia/colada/fetch/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@pinia/colada/fetch/client/client.gen.ts @@ -2,6 +2,7 @@ import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, @@ -212,26 +213,6 @@ export const createClient = (config: Config = {}): Client => { }; }; - function getValidRequestBody(options: ResolvedRequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; - - return hasSerializedBody ? options.serializedBody : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@pinia/colada/fetch/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@pinia/colada/fetch/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@pinia/colada/fetch/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@pinia/colada/fetch/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@pinia/colada/group-by-tag/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@pinia/colada/group-by-tag/client/client.gen.ts index 329968d82..6ed36fb89 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@pinia/colada/group-by-tag/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@pinia/colada/group-by-tag/client/client.gen.ts @@ -2,6 +2,7 @@ import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, @@ -212,26 +213,6 @@ export const createClient = (config: Config = {}): Client => { }; }; - function getValidRequestBody(options: ResolvedRequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; - - return hasSerializedBody ? options.serializedBody : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@pinia/colada/group-by-tag/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@pinia/colada/group-by-tag/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@pinia/colada/group-by-tag/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@pinia/colada/group-by-tag/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/angular-query-experimental/asClass/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/angular-query-experimental/asClass/client/client.gen.ts index 329968d82..6ed36fb89 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/angular-query-experimental/asClass/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/angular-query-experimental/asClass/client/client.gen.ts @@ -2,6 +2,7 @@ import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, @@ -212,26 +213,6 @@ export const createClient = (config: Config = {}): Client => { }; }; - function getValidRequestBody(options: ResolvedRequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; - - return hasSerializedBody ? options.serializedBody : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/angular-query-experimental/asClass/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/angular-query-experimental/asClass/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/angular-query-experimental/asClass/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/angular-query-experimental/asClass/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/angular-query-experimental/axios/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/angular-query-experimental/axios/client/client.gen.ts index a08594b65..c8a60c6fa 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/angular-query-experimental/axios/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/angular-query-experimental/axios/client/client.gen.ts @@ -5,6 +5,7 @@ import axios from 'axios'; import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, RequestOptions } from './types.gen'; import { buildUrl, @@ -114,23 +115,6 @@ export const createClient = (config: Config = {}): Client => { } }; - function getValidRequestBody(options: RequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - return options.body !== '' ? options.body : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/angular-query-experimental/axios/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/angular-query-experimental/axios/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/angular-query-experimental/axios/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/angular-query-experimental/axios/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/angular-query-experimental/fetch/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/angular-query-experimental/fetch/client/client.gen.ts index 329968d82..6ed36fb89 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/angular-query-experimental/fetch/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/angular-query-experimental/fetch/client/client.gen.ts @@ -2,6 +2,7 @@ import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, @@ -212,26 +213,6 @@ export const createClient = (config: Config = {}): Client => { }; }; - function getValidRequestBody(options: ResolvedRequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; - - return hasSerializedBody ? options.serializedBody : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/angular-query-experimental/fetch/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/angular-query-experimental/fetch/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/angular-query-experimental/fetch/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/angular-query-experimental/fetch/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/angular-query-experimental/name-builder/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/angular-query-experimental/name-builder/client/client.gen.ts index 329968d82..6ed36fb89 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/angular-query-experimental/name-builder/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/angular-query-experimental/name-builder/client/client.gen.ts @@ -2,6 +2,7 @@ import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, @@ -212,26 +213,6 @@ export const createClient = (config: Config = {}): Client => { }; }; - function getValidRequestBody(options: ResolvedRequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; - - return hasSerializedBody ? options.serializedBody : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/angular-query-experimental/name-builder/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/angular-query-experimental/name-builder/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/angular-query-experimental/name-builder/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/angular-query-experimental/name-builder/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/react-query/asClass/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/react-query/asClass/client/client.gen.ts index 329968d82..6ed36fb89 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/react-query/asClass/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/react-query/asClass/client/client.gen.ts @@ -2,6 +2,7 @@ import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, @@ -212,26 +213,6 @@ export const createClient = (config: Config = {}): Client => { }; }; - function getValidRequestBody(options: ResolvedRequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; - - return hasSerializedBody ? options.serializedBody : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/react-query/asClass/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/react-query/asClass/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/react-query/asClass/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/react-query/asClass/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/react-query/axios/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/react-query/axios/client/client.gen.ts index a08594b65..c8a60c6fa 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/react-query/axios/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/react-query/axios/client/client.gen.ts @@ -5,6 +5,7 @@ import axios from 'axios'; import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, RequestOptions } from './types.gen'; import { buildUrl, @@ -114,23 +115,6 @@ export const createClient = (config: Config = {}): Client => { } }; - function getValidRequestBody(options: RequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - return options.body !== '' ? options.body : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/react-query/axios/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/react-query/axios/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/react-query/axios/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/react-query/axios/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/react-query/fetch/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/react-query/fetch/client/client.gen.ts index 329968d82..6ed36fb89 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/react-query/fetch/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/react-query/fetch/client/client.gen.ts @@ -2,6 +2,7 @@ import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, @@ -212,26 +213,6 @@ export const createClient = (config: Config = {}): Client => { }; }; - function getValidRequestBody(options: ResolvedRequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; - - return hasSerializedBody ? options.serializedBody : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/react-query/fetch/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/react-query/fetch/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/react-query/fetch/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/react-query/fetch/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/react-query/name-builder/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/react-query/name-builder/client/client.gen.ts index 329968d82..6ed36fb89 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/react-query/name-builder/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/react-query/name-builder/client/client.gen.ts @@ -2,6 +2,7 @@ import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, @@ -212,26 +213,6 @@ export const createClient = (config: Config = {}): Client => { }; }; - function getValidRequestBody(options: ResolvedRequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; - - return hasSerializedBody ? options.serializedBody : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/react-query/name-builder/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/react-query/name-builder/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/react-query/name-builder/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/react-query/name-builder/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/solid-query/asClass/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/solid-query/asClass/client/client.gen.ts index 329968d82..6ed36fb89 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/solid-query/asClass/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/solid-query/asClass/client/client.gen.ts @@ -2,6 +2,7 @@ import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, @@ -212,26 +213,6 @@ export const createClient = (config: Config = {}): Client => { }; }; - function getValidRequestBody(options: ResolvedRequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; - - return hasSerializedBody ? options.serializedBody : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/solid-query/asClass/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/solid-query/asClass/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/solid-query/asClass/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/solid-query/asClass/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/solid-query/axios/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/solid-query/axios/client/client.gen.ts index a08594b65..c8a60c6fa 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/solid-query/axios/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/solid-query/axios/client/client.gen.ts @@ -5,6 +5,7 @@ import axios from 'axios'; import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, RequestOptions } from './types.gen'; import { buildUrl, @@ -114,23 +115,6 @@ export const createClient = (config: Config = {}): Client => { } }; - function getValidRequestBody(options: RequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - return options.body !== '' ? options.body : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/solid-query/axios/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/solid-query/axios/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/solid-query/axios/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/solid-query/axios/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/solid-query/fetch/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/solid-query/fetch/client/client.gen.ts index 329968d82..6ed36fb89 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/solid-query/fetch/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/solid-query/fetch/client/client.gen.ts @@ -2,6 +2,7 @@ import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, @@ -212,26 +213,6 @@ export const createClient = (config: Config = {}): Client => { }; }; - function getValidRequestBody(options: ResolvedRequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; - - return hasSerializedBody ? options.serializedBody : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/solid-query/fetch/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/solid-query/fetch/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/solid-query/fetch/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/solid-query/fetch/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/solid-query/name-builder/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/solid-query/name-builder/client/client.gen.ts index 329968d82..6ed36fb89 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/solid-query/name-builder/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/solid-query/name-builder/client/client.gen.ts @@ -2,6 +2,7 @@ import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, @@ -212,26 +213,6 @@ export const createClient = (config: Config = {}): Client => { }; }; - function getValidRequestBody(options: ResolvedRequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; - - return hasSerializedBody ? options.serializedBody : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/solid-query/name-builder/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/solid-query/name-builder/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/solid-query/name-builder/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/solid-query/name-builder/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/svelte-query/asClass/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/svelte-query/asClass/client/client.gen.ts index 329968d82..6ed36fb89 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/svelte-query/asClass/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/svelte-query/asClass/client/client.gen.ts @@ -2,6 +2,7 @@ import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, @@ -212,26 +213,6 @@ export const createClient = (config: Config = {}): Client => { }; }; - function getValidRequestBody(options: ResolvedRequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; - - return hasSerializedBody ? options.serializedBody : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/svelte-query/asClass/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/svelte-query/asClass/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/svelte-query/asClass/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/svelte-query/asClass/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/svelte-query/axios/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/svelte-query/axios/client/client.gen.ts index a08594b65..c8a60c6fa 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/svelte-query/axios/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/svelte-query/axios/client/client.gen.ts @@ -5,6 +5,7 @@ import axios from 'axios'; import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, RequestOptions } from './types.gen'; import { buildUrl, @@ -114,23 +115,6 @@ export const createClient = (config: Config = {}): Client => { } }; - function getValidRequestBody(options: RequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - return options.body !== '' ? options.body : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/svelte-query/axios/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/svelte-query/axios/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/svelte-query/axios/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/svelte-query/axios/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/svelte-query/fetch/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/svelte-query/fetch/client/client.gen.ts index 329968d82..6ed36fb89 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/svelte-query/fetch/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/svelte-query/fetch/client/client.gen.ts @@ -2,6 +2,7 @@ import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, @@ -212,26 +213,6 @@ export const createClient = (config: Config = {}): Client => { }; }; - function getValidRequestBody(options: ResolvedRequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; - - return hasSerializedBody ? options.serializedBody : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/svelte-query/fetch/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/svelte-query/fetch/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/svelte-query/fetch/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/svelte-query/fetch/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/svelte-query/name-builder/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/svelte-query/name-builder/client/client.gen.ts index 329968d82..6ed36fb89 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/svelte-query/name-builder/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/svelte-query/name-builder/client/client.gen.ts @@ -2,6 +2,7 @@ import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, @@ -212,26 +213,6 @@ export const createClient = (config: Config = {}): Client => { }; }; - function getValidRequestBody(options: ResolvedRequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; - - return hasSerializedBody ? options.serializedBody : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/svelte-query/name-builder/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/svelte-query/name-builder/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/svelte-query/name-builder/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/svelte-query/name-builder/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/vue-query/asClass/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/vue-query/asClass/client/client.gen.ts index 329968d82..6ed36fb89 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/vue-query/asClass/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/vue-query/asClass/client/client.gen.ts @@ -2,6 +2,7 @@ import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, @@ -212,26 +213,6 @@ export const createClient = (config: Config = {}): Client => { }; }; - function getValidRequestBody(options: ResolvedRequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; - - return hasSerializedBody ? options.serializedBody : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/vue-query/asClass/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/vue-query/asClass/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/vue-query/asClass/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/vue-query/asClass/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/vue-query/axios/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/vue-query/axios/client/client.gen.ts index a08594b65..c8a60c6fa 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/vue-query/axios/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/vue-query/axios/client/client.gen.ts @@ -5,6 +5,7 @@ import axios from 'axios'; import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, RequestOptions } from './types.gen'; import { buildUrl, @@ -114,23 +115,6 @@ export const createClient = (config: Config = {}): Client => { } }; - function getValidRequestBody(options: RequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - return options.body !== '' ? options.body : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/vue-query/axios/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/vue-query/axios/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/vue-query/axios/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/vue-query/axios/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/vue-query/fetch/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/vue-query/fetch/client/client.gen.ts index 329968d82..6ed36fb89 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/vue-query/fetch/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/vue-query/fetch/client/client.gen.ts @@ -2,6 +2,7 @@ import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, @@ -212,26 +213,6 @@ export const createClient = (config: Config = {}): Client => { }; }; - function getValidRequestBody(options: ResolvedRequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; - - return hasSerializedBody ? options.serializedBody : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/vue-query/fetch/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/vue-query/fetch/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/vue-query/fetch/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/vue-query/fetch/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/vue-query/name-builder/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/vue-query/name-builder/client/client.gen.ts index 329968d82..6ed36fb89 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/vue-query/name-builder/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/vue-query/name-builder/client/client.gen.ts @@ -2,6 +2,7 @@ import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, @@ -212,26 +213,6 @@ export const createClient = (config: Config = {}): Client => { }; }; - function getValidRequestBody(options: ResolvedRequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; - - return hasSerializedBody ? options.serializedBody : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/vue-query/name-builder/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/vue-query/name-builder/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/vue-query/name-builder/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/vue-query/name-builder/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-api-key/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-api-key/client/client.gen.ts index 329968d82..6ed36fb89 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-api-key/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-api-key/client/client.gen.ts @@ -2,6 +2,7 @@ import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, @@ -212,26 +213,6 @@ export const createClient = (config: Config = {}): Client => { }; }; - function getValidRequestBody(options: ResolvedRequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; - - return hasSerializedBody ? options.serializedBody : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-api-key/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-api-key/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-api-key/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-api-key/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-false/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-false/client/client.gen.ts index 329968d82..6ed36fb89 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-false/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-false/client/client.gen.ts @@ -2,6 +2,7 @@ import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, @@ -212,26 +213,6 @@ export const createClient = (config: Config = {}): Client => { }; }; - function getValidRequestBody(options: ResolvedRequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; - - return hasSerializedBody ? options.serializedBody : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-false/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-false/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-false/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-false/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-http-bearer/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-http-bearer/client/client.gen.ts index 329968d82..6ed36fb89 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-http-bearer/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-http-bearer/client/client.gen.ts @@ -2,6 +2,7 @@ import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, @@ -212,26 +213,6 @@ export const createClient = (config: Config = {}): Client => { }; }; - function getValidRequestBody(options: ResolvedRequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; - - return hasSerializedBody ? options.serializedBody : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-http-bearer/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-http-bearer/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-http-bearer/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-http-bearer/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-oauth2/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-oauth2/client/client.gen.ts index 329968d82..6ed36fb89 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-oauth2/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-oauth2/client/client.gen.ts @@ -2,6 +2,7 @@ import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, @@ -212,26 +213,6 @@ export const createClient = (config: Config = {}): Client => { }; }; - function getValidRequestBody(options: ResolvedRequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; - - return hasSerializedBody ? options.serializedBody : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-oauth2/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-oauth2/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-oauth2/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-oauth2/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-open-id-connect/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-open-id-connect/client/client.gen.ts index 329968d82..6ed36fb89 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-open-id-connect/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-open-id-connect/client/client.gen.ts @@ -2,6 +2,7 @@ import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, @@ -212,26 +213,6 @@ export const createClient = (config: Config = {}): Client => { }; }; - function getValidRequestBody(options: ResolvedRequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; - - return hasSerializedBody ? options.serializedBody : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-open-id-connect/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-open-id-connect/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-open-id-connect/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-open-id-connect/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/servers/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/servers/client/client.gen.ts index 329968d82..6ed36fb89 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/servers/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/servers/client/client.gen.ts @@ -2,6 +2,7 @@ import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, @@ -212,26 +213,6 @@ export const createClient = (config: Config = {}): Client => { }; }; - function getValidRequestBody(options: ResolvedRequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; - - return hasSerializedBody ? options.serializedBody : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/servers/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/servers/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/servers/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/servers/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-angular/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-angular/client/client.gen.ts index 9c5e817f3..40c2b65df 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-angular/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-angular/client/client.gen.ts @@ -18,6 +18,7 @@ import { filter } from 'rxjs/operators'; import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, @@ -201,25 +202,6 @@ export const createClient = (config: Config = {}): Client => { } }; - function getValidRequestBody(options: ResolvedRequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; - - return hasSerializedBody ? options.serializedBody : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-angular/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-angular/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-angular/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-angular/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-axios/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-axios/client/client.gen.ts index a08594b65..c8a60c6fa 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-axios/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-axios/client/client.gen.ts @@ -5,6 +5,7 @@ import axios from 'axios'; import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, RequestOptions } from './types.gen'; import { buildUrl, @@ -114,23 +115,6 @@ export const createClient = (config: Config = {}): Client => { } }; - function getValidRequestBody(options: RequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - return options.body !== '' ? options.body : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-axios/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-axios/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-axios/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-axios/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-fetch/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-fetch/client/client.gen.ts index 329968d82..6ed36fb89 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-fetch/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-fetch/client/client.gen.ts @@ -2,6 +2,7 @@ import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, @@ -212,26 +213,6 @@ export const createClient = (config: Config = {}): Client => { }; }; - function getValidRequestBody(options: ResolvedRequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; - - return hasSerializedBody ? options.serializedBody : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-fetch/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-fetch/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-fetch/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-fetch/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-next/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-next/client/client.gen.ts index ad44b7fba..275d3501c 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-next/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-next/client/client.gen.ts @@ -2,6 +2,7 @@ import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, @@ -200,26 +201,6 @@ export const createClient = (config: Config = {}): Client => { }; }; - function getValidRequestBody(options: ResolvedRequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; - - return hasSerializedBody ? options.serializedBody : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-next/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-next/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-next/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-next/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-nuxt/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-nuxt/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-nuxt/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-nuxt/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-all-of/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-all-of/client/client.gen.ts index 329968d82..6ed36fb89 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-all-of/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-all-of/client/client.gen.ts @@ -2,6 +2,7 @@ import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, @@ -212,26 +213,6 @@ export const createClient = (config: Config = {}): Client => { }; }; - function getValidRequestBody(options: ResolvedRequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; - - return hasSerializedBody ? options.serializedBody : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-all-of/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-all-of/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-all-of/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-all-of/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-any-of-null/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-any-of-null/client/client.gen.ts index 329968d82..6ed36fb89 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-any-of-null/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-any-of-null/client/client.gen.ts @@ -2,6 +2,7 @@ import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, @@ -212,26 +213,6 @@ export const createClient = (config: Config = {}): Client => { }; }; - function getValidRequestBody(options: ResolvedRequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; - - return hasSerializedBody ? options.serializedBody : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-any-of-null/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-any-of-null/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-any-of-null/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-any-of-null/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-array/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-array/client/client.gen.ts index 329968d82..6ed36fb89 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-array/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-array/client/client.gen.ts @@ -2,6 +2,7 @@ import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, @@ -212,26 +213,6 @@ export const createClient = (config: Config = {}): Client => { }; }; - function getValidRequestBody(options: ResolvedRequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; - - return hasSerializedBody ? options.serializedBody : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-array/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-array/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-array/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-array/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transforms-read-write/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transforms-read-write/client/client.gen.ts index 329968d82..6ed36fb89 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transforms-read-write/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transforms-read-write/client/client.gen.ts @@ -2,6 +2,7 @@ import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, @@ -212,26 +213,6 @@ export const createClient = (config: Config = {}): Client => { }; }; - function getValidRequestBody(options: ResolvedRequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; - - return hasSerializedBody ? options.serializedBody : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transforms-read-write/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transforms-read-write/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transforms-read-write/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transforms-read-write/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/plugins/@tanstack/meta/client/client.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/plugins/@tanstack/meta/client/client.gen.ts index 329968d82..6ed36fb89 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/plugins/@tanstack/meta/client/client.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/plugins/@tanstack/meta/client/client.gen.ts @@ -2,6 +2,7 @@ import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, @@ -212,26 +213,6 @@ export const createClient = (config: Config = {}): Client => { }; }; - function getValidRequestBody(options: ResolvedRequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; - - return hasSerializedBody ? options.serializedBody : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/plugins/@tanstack/meta/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/plugins/@tanstack/meta/core/utils.gen.ts index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/plugins/@tanstack/meta/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/plugins/@tanstack/meta/core/utils.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/test/generated/v3_no_index/client/client.gen.ts.snap b/packages/openapi-ts-tests/main/test/__snapshots__/test/generated/v3_no_index/client/client.gen.ts.snap index 329968d82..6ed36fb89 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/test/generated/v3_no_index/client/client.gen.ts.snap +++ b/packages/openapi-ts-tests/main/test/__snapshots__/test/generated/v3_no_index/client/client.gen.ts.snap @@ -2,6 +2,7 @@ import { createSseClient } from '../core/serverSentEvents.gen'; import type { HttpMethod } from '../core/types.gen'; +import { getValidRequestBody } from '../core/utils.gen'; import type { Client, Config, @@ -212,26 +213,6 @@ export const createClient = (config: Config = {}): Client => { }; }; - function getValidRequestBody(options: ResolvedRequestOptions) { - const hasBody = options.body !== undefined; - const isSerializedBody = hasBody && options.bodySerializer; - - if (isSerializedBody) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; - - return hasSerializedBody ? options.serializedBody : null; - } - - // plain/text body - if (hasBody) { - return options.body; - } - - // no body was provided - return undefined; - } - const makeMethodFn = (method: Uppercase) => (options: RequestOptions) => request({ ...options, method }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/test/generated/v3_no_index/core/utils.gen.ts.snap b/packages/openapi-ts-tests/main/test/__snapshots__/test/generated/v3_no_index/core/utils.gen.ts.snap index ac31396fe..719b5f853 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/test/generated/v3_no_index/core/utils.gen.ts.snap +++ b/packages/openapi-ts-tests/main/test/__snapshots__/test/generated/v3_no_index/core/utils.gen.ts.snap @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import type { QuerySerializer } from './bodySerializer.gen'; +import type { BodySerializer, QuerySerializer } from './bodySerializer.gen'; import { type ArraySeparatorStyle, serializeArrayParam, @@ -112,3 +112,31 @@ export const getUrl = ({ } return url; }; + +export function getValidRequestBody(options: { + body?: unknown; + bodySerializer?: BodySerializer | null; + serializedBody?: unknown; +}) { + const hasBody = options.body !== undefined; + const isSerializedBody = hasBody && options.bodySerializer; + + if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; + + return hasSerializedBody ? options.serializedBody : null; + } + + if (isSerializedBody) { + return options.body !== '' ? options.body : null; + } + + // plain/text body + if (hasBody) { + return options.body; + } + + // no body was provided + return undefined; +} -- 2.51.2 From 3126e01083450039f695557c4d0380c8fa65328d Mon Sep 17 00:00:00 2001 From: volesen Date: Wed, 3 Sep 2025 19:45:10 +0200 Subject: [PATCH 40/46] fix(client): Make `mergeHeaders` nodejs runtime compatible --- .../plugins/@hey-api/client-fetch/bundle/utils.ts | 14 ++++++++++++-- .../plugins/@hey-api/client-next/bundle/utils.ts | 12 +++++++++++- .../plugins/@hey-api/client-nuxt/bundle/utils.ts | 10 +++++++++- 3 files changed, 32 insertions(+), 4 deletions(-) diff --git a/packages/openapi-ts/src/plugins/@hey-api/client-fetch/bundle/utils.ts b/packages/openapi-ts/src/plugins/@hey-api/client-fetch/bundle/utils.ts index e3958feb9..13173d97d 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/client-fetch/bundle/utils.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/client-fetch/bundle/utils.ts @@ -181,17 +181,27 @@ export const mergeConfigs = (a: Config, b: Config): Config => { return config; }; +const headersEntries = (headers: Headers): Array<[string, string]> => { + const entries: Array<[string, string]> = []; + headers.forEach((value, key) => { + entries.push([key, value]); + }); + return entries; +}; + export const mergeHeaders = ( ...headers: Array['headers'] | undefined> ): Headers => { const mergedHeaders = new Headers(); for (const header of headers) { - if (!header || typeof header !== 'object') { + if (!header) { continue; } const iterator = - header instanceof Headers ? header.entries() : Object.entries(header); + header instanceof Headers + ? headersEntries(header) + : Object.entries(header); for (const [key, value] of iterator) { if (value === null) { diff --git a/packages/openapi-ts/src/plugins/@hey-api/client-next/bundle/utils.ts b/packages/openapi-ts/src/plugins/@hey-api/client-next/bundle/utils.ts index 92b8a5f83..dfd3a19ab 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/client-next/bundle/utils.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/client-next/bundle/utils.ts @@ -293,6 +293,14 @@ export const mergeConfigs = (a: Config, b: Config): Config => { return config; }; +const headersEntries = (headers: Headers): Array<[string, string]> => { + const entries: Array<[string, string]> = []; + headers.forEach((value, key) => { + entries.push([key, value]); + }); + return entries; +}; + export const mergeHeaders = ( ...headers: Array['headers'] | undefined> ): Headers => { @@ -303,7 +311,9 @@ export const mergeHeaders = ( } const iterator = - header instanceof Headers ? header.entries() : Object.entries(header); + header instanceof Headers + ? headersEntries(header) + : Object.entries(header); for (const [key, value] of iterator) { if (value === null) { diff --git a/packages/openapi-ts/src/plugins/@hey-api/client-nuxt/bundle/utils.ts b/packages/openapi-ts/src/plugins/@hey-api/client-nuxt/bundle/utils.ts index 6436abebe..c186ddabf 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/client-nuxt/bundle/utils.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/client-nuxt/bundle/utils.ts @@ -250,6 +250,14 @@ export const mergeConfigs = (a: Config, b: Config): Config => { return config; }; +const headersEntries = (headers: Headers): Array<[string, string]> => { + const entries: Array<[string, string]> = []; + headers.forEach((value, key) => { + entries.push([key, value]); + }); + return entries; +}; + export const mergeHeaders = ( ...headers: Array['headers'] | undefined> ): Headers => { @@ -266,7 +274,7 @@ export const mergeHeaders = ( const iterator = h instanceof Headers - ? h.entries() + ? headersEntries(h) : Object.entries(h as Record); for (const [key, value] of iterator) { -- 2.51.2 From b27f069dcce9a756f2be97a3c40fcd8fa16b2012 Mon Sep 17 00:00:00 2001 From: volesen Date: Wed, 3 Sep 2025 19:54:56 +0200 Subject: [PATCH 41/46] Update snapshots --- .../body-response-text-plain/client/utils.gen.ts | 14 ++++++++++++-- .../2.0.x/form-data/client/utils.gen.ts | 14 ++++++++++++-- .../client/utils.gen.ts | 14 ++++++++++++-- .../sdk-nested-classes/client/utils.gen.ts | 14 ++++++++++++-- .../@hey-api/sdk/default/client/utils.gen.ts | 14 ++++++++++++-- .../@hey-api/sdk/instance/client/utils.gen.ts | 14 ++++++++++++-- .../@hey-api/sdk/throwOnError/client/utils.gen.ts | 14 ++++++++++++-- .../type-format-valibot/client/utils.gen.ts | 14 ++++++++++++-- .../type-format-zod/client/utils.gen.ts | 14 ++++++++++++-- .../client/utils.gen.ts | 14 ++++++++++++-- .../client/utils.gen.ts | 14 ++++++++++++-- .../@pinia/colada/fetch/client/utils.gen.ts | 14 ++++++++++++-- .../@pinia/colada/group-by-tag/client/utils.gen.ts | 14 ++++++++++++-- .../asClass/client/utils.gen.ts | 14 ++++++++++++-- .../fetch/client/utils.gen.ts | 14 ++++++++++++-- .../name-builder/client/utils.gen.ts | 14 ++++++++++++-- .../react-query/asClass/client/utils.gen.ts | 14 ++++++++++++-- .../react-query/fetch/client/utils.gen.ts | 14 ++++++++++++-- .../react-query/name-builder/client/utils.gen.ts | 14 ++++++++++++-- .../solid-query/asClass/client/utils.gen.ts | 14 ++++++++++++-- .../solid-query/fetch/client/utils.gen.ts | 14 ++++++++++++-- .../solid-query/name-builder/client/utils.gen.ts | 14 ++++++++++++-- .../svelte-query/asClass/client/utils.gen.ts | 14 ++++++++++++-- .../svelte-query/fetch/client/utils.gen.ts | 14 ++++++++++++-- .../svelte-query/name-builder/client/utils.gen.ts | 14 ++++++++++++-- .../vue-query/asClass/client/utils.gen.ts | 14 ++++++++++++-- .../@tanstack/vue-query/fetch/client/utils.gen.ts | 14 ++++++++++++-- .../vue-query/name-builder/client/utils.gen.ts | 14 ++++++++++++-- .../2.0.x/schema-unknown/client/utils.gen.ts | 14 ++++++++++++-- .../2.0.x/security-api-key/client/utils.gen.ts | 14 ++++++++++++-- .../2.0.x/security-basic/client/utils.gen.ts | 14 ++++++++++++-- .../2.0.x/security-false/client/utils.gen.ts | 14 ++++++++++++-- .../2.0.x/security-oauth2/client/utils.gen.ts | 14 ++++++++++++-- .../2.0.x/servers-base-path/client/utils.gen.ts | 14 ++++++++++++-- .../2.0.x/servers-host/client/utils.gen.ts | 14 ++++++++++++-- .../2.0.x/servers/client/utils.gen.ts | 14 ++++++++++++-- .../transforms-read-write/client/utils.gen.ts | 14 ++++++++++++-- .../body-response-text-plain/client/utils.gen.ts | 14 ++++++++++++-- .../internal-name-conflict/client/utils.gen.ts | 14 ++++++++++++-- .../parameter-explode-false/client/utils.gen.ts | 14 ++++++++++++-- .../client/utils.gen.ts | 14 ++++++++++++-- .../sdk-nested-classes/client/utils.gen.ts | 14 ++++++++++++-- .../@hey-api/sdk/default/client/utils.gen.ts | 14 ++++++++++++-- .../@hey-api/sdk/instance/client/utils.gen.ts | 14 ++++++++++++-- .../@hey-api/sdk/throwOnError/client/utils.gen.ts | 14 ++++++++++++-- .../type-format-valibot/client/utils.gen.ts | 14 ++++++++++++-- .../type-format-zod/client/utils.gen.ts | 14 ++++++++++++-- .../client/utils.gen.ts | 14 ++++++++++++-- .../client/utils.gen.ts | 14 ++++++++++++-- .../@pinia/colada/fetch/client/utils.gen.ts | 14 ++++++++++++-- .../@pinia/colada/group-by-tag/client/utils.gen.ts | 14 ++++++++++++-- .../asClass/client/utils.gen.ts | 14 ++++++++++++-- .../fetch/client/utils.gen.ts | 14 ++++++++++++-- .../name-builder/client/utils.gen.ts | 14 ++++++++++++-- .../react-query/asClass/client/utils.gen.ts | 14 ++++++++++++-- .../react-query/fetch/client/utils.gen.ts | 14 ++++++++++++-- .../react-query/name-builder/client/utils.gen.ts | 14 ++++++++++++-- .../solid-query/asClass/client/utils.gen.ts | 14 ++++++++++++-- .../solid-query/fetch/client/utils.gen.ts | 14 ++++++++++++-- .../solid-query/name-builder/client/utils.gen.ts | 14 ++++++++++++-- .../svelte-query/asClass/client/utils.gen.ts | 14 ++++++++++++-- .../svelte-query/fetch/client/utils.gen.ts | 14 ++++++++++++-- .../svelte-query/name-builder/client/utils.gen.ts | 14 ++++++++++++-- .../vue-query/asClass/client/utils.gen.ts | 14 ++++++++++++-- .../@tanstack/vue-query/fetch/client/utils.gen.ts | 14 ++++++++++++-- .../vue-query/name-builder/client/utils.gen.ts | 14 ++++++++++++-- .../3.0.x/security-api-key/client/utils.gen.ts | 14 ++++++++++++-- .../3.0.x/security-false/client/utils.gen.ts | 14 ++++++++++++-- .../3.0.x/security-http-bearer/client/utils.gen.ts | 14 ++++++++++++-- .../3.0.x/security-oauth2/client/utils.gen.ts | 14 ++++++++++++-- .../security-open-id-connect/client/utils.gen.ts | 14 ++++++++++++-- .../3.0.x/servers/client/utils.gen.ts | 14 ++++++++++++-- .../3.0.x/transformers-all-of/client/utils.gen.ts | 14 ++++++++++++-- .../transformers-any-of-null/client/utils.gen.ts | 14 ++++++++++++-- .../3.0.x/transformers-array/client/utils.gen.ts | 14 ++++++++++++-- .../transforms-read-write/client/utils.gen.ts | 14 ++++++++++++-- .../body-response-text-plain/client/utils.gen.ts | 14 ++++++++++++-- .../base-url-false/client/utils.gen.ts | 14 ++++++++++++-- .../base-url-number/client/utils.gen.ts | 14 ++++++++++++-- .../base-url-strict/client/utils.gen.ts | 14 ++++++++++++-- .../base-url-string/client/utils.gen.ts | 14 ++++++++++++-- .../client-fetch/clean-false/client/utils.gen.ts | 14 ++++++++++++-- .../client-fetch/default/client/utils.gen.ts | 14 ++++++++++++-- .../sdk-client-optional/client/utils.gen.ts | 14 ++++++++++++-- .../sdk-client-required/client/utils.gen.ts | 14 ++++++++++++-- .../tsconfig-nodenext-sdk/client/utils.gen.ts | 14 ++++++++++++-- .../client-next/base-url-false/client/utils.gen.ts | 12 +++++++++++- .../base-url-number/client/utils.gen.ts | 12 +++++++++++- .../base-url-strict/client/utils.gen.ts | 12 +++++++++++- .../base-url-string/client/utils.gen.ts | 12 +++++++++++- .../client-next/clean-false/client/utils.gen.ts | 12 +++++++++++- .../client-next/default/client/utils.gen.ts | 12 +++++++++++- .../sdk-client-optional/client/utils.gen.ts | 12 +++++++++++- .../sdk-client-required/client/utils.gen.ts | 12 +++++++++++- .../tsconfig-nodenext-sdk/client/utils.gen.ts | 12 +++++++++++- .../client-nuxt/base-url-false/client/utils.gen.ts | 10 +++++++++- .../base-url-number/client/utils.gen.ts | 10 +++++++++- .../base-url-strict/client/utils.gen.ts | 10 +++++++++- .../base-url-string/client/utils.gen.ts | 10 +++++++++- .../client-nuxt/clean-false/client/utils.gen.ts | 10 +++++++++- .../client-nuxt/default/client/utils.gen.ts | 10 +++++++++- .../sdk-client-optional/client/utils.gen.ts | 10 +++++++++- .../sdk-client-required/client/utils.gen.ts | 10 +++++++++- .../tsconfig-nodenext-sdk/client/utils.gen.ts | 10 +++++++++- .../3.1.x/headers/client/utils.gen.ts | 14 ++++++++++++-- .../internal-name-conflict/client/utils.gen.ts | 14 ++++++++++++-- .../3.1.x/pagination-ref/client/utils.gen.ts | 14 ++++++++++++-- .../parameter-explode-false/client/utils.gen.ts | 14 ++++++++++++-- .../client/utils.gen.ts | 14 ++++++++++++-- .../sdk-nested-classes/client/utils.gen.ts | 14 ++++++++++++-- .../@hey-api/sdk/default/client/utils.gen.ts | 14 ++++++++++++-- .../@hey-api/sdk/instance/client/utils.gen.ts | 14 ++++++++++++-- .../@hey-api/sdk/throwOnError/client/utils.gen.ts | 14 ++++++++++++-- .../type-format-valibot/client/utils.gen.ts | 14 ++++++++++++-- .../type-format-zod/client/utils.gen.ts | 14 ++++++++++++-- .../client/utils.gen.ts | 14 ++++++++++++-- .../client/utils.gen.ts | 14 ++++++++++++-- .../@pinia/colada/fetch/client/utils.gen.ts | 14 ++++++++++++-- .../@pinia/colada/group-by-tag/client/utils.gen.ts | 14 ++++++++++++-- .../asClass/client/utils.gen.ts | 14 ++++++++++++-- .../fetch/client/utils.gen.ts | 14 ++++++++++++-- .../name-builder/client/utils.gen.ts | 14 ++++++++++++-- .../react-query/asClass/client/utils.gen.ts | 14 ++++++++++++-- .../react-query/fetch/client/utils.gen.ts | 14 ++++++++++++-- .../react-query/name-builder/client/utils.gen.ts | 14 ++++++++++++-- .../solid-query/asClass/client/utils.gen.ts | 14 ++++++++++++-- .../solid-query/fetch/client/utils.gen.ts | 14 ++++++++++++-- .../solid-query/name-builder/client/utils.gen.ts | 14 ++++++++++++-- .../svelte-query/asClass/client/utils.gen.ts | 14 ++++++++++++-- .../svelte-query/fetch/client/utils.gen.ts | 14 ++++++++++++-- .../svelte-query/name-builder/client/utils.gen.ts | 14 ++++++++++++-- .../vue-query/asClass/client/utils.gen.ts | 14 ++++++++++++-- .../@tanstack/vue-query/fetch/client/utils.gen.ts | 14 ++++++++++++-- .../vue-query/name-builder/client/utils.gen.ts | 14 ++++++++++++-- .../3.1.x/security-api-key/client/utils.gen.ts | 14 ++++++++++++-- .../3.1.x/security-false/client/utils.gen.ts | 14 ++++++++++++-- .../3.1.x/security-http-bearer/client/utils.gen.ts | 14 ++++++++++++-- .../3.1.x/security-oauth2/client/utils.gen.ts | 14 ++++++++++++-- .../security-open-id-connect/client/utils.gen.ts | 14 ++++++++++++-- .../3.1.x/servers/client/utils.gen.ts | 14 ++++++++++++-- .../3.1.x/sse-fetch/client/utils.gen.ts | 14 ++++++++++++-- .../3.1.x/sse-next/client/utils.gen.ts | 12 +++++++++++- .../3.1.x/sse-nuxt/client/utils.gen.ts | 10 +++++++++- .../3.1.x/transformers-all-of/client/utils.gen.ts | 14 ++++++++++++-- .../transformers-any-of-null/client/utils.gen.ts | 14 ++++++++++++-- .../3.1.x/transformers-array/client/utils.gen.ts | 14 ++++++++++++-- .../transforms-read-write/client/utils.gen.ts | 14 ++++++++++++-- .../plugins/@tanstack/meta/client/utils.gen.ts | 14 ++++++++++++-- .../generated/v3_no_index/client/utils.gen.ts.snap | 14 ++++++++++++-- 149 files changed, 1748 insertions(+), 278 deletions(-) diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/body-response-text-plain/client/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/body-response-text-plain/client/utils.gen.ts index a47509522..b9ec3cdd6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/body-response-text-plain/client/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/body-response-text-plain/client/utils.gen.ts @@ -183,17 +183,27 @@ export const mergeConfigs = (a: Config, b: Config): Config => { return config; }; +const headersEntries = (headers: Headers): Array<[string, string]> => { + const entries: Array<[string, string]> = []; + headers.forEach((value, key) => { + entries.push([key, value]); + }); + return entries; +}; + export const mergeHeaders = ( ...headers: Array['headers'] | undefined> ): Headers => { const mergedHeaders = new Headers(); for (const header of headers) { - if (!header || typeof header !== 'object') { + if (!header) { continue; } const iterator = - header instanceof Headers ? header.entries() : Object.entries(header); + header instanceof Headers + ? headersEntries(header) + : Object.entries(header); for (const [key, value] of iterator) { if (value === null) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/form-data/client/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/form-data/client/utils.gen.ts index a47509522..b9ec3cdd6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/form-data/client/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/form-data/client/utils.gen.ts @@ -183,17 +183,27 @@ export const mergeConfigs = (a: Config, b: Config): Config => { return config; }; +const headersEntries = (headers: Headers): Array<[string, string]> => { + const entries: Array<[string, string]> = []; + headers.forEach((value, key) => { + entries.push([key, value]); + }); + return entries; +}; + export const mergeHeaders = ( ...headers: Array['headers'] | undefined> ): Headers => { const mergedHeaders = new Headers(); for (const header of headers) { - if (!header || typeof header !== 'object') { + if (!header) { continue; } const iterator = - header instanceof Headers ? header.entries() : Object.entries(header); + header instanceof Headers + ? headersEntries(header) + : Object.entries(header); for (const [key, value] of iterator) { if (value === null) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/client-fetch/sdk-nested-classes-instance/client/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/client-fetch/sdk-nested-classes-instance/client/utils.gen.ts index a47509522..b9ec3cdd6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/client-fetch/sdk-nested-classes-instance/client/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/client-fetch/sdk-nested-classes-instance/client/utils.gen.ts @@ -183,17 +183,27 @@ export const mergeConfigs = (a: Config, b: Config): Config => { return config; }; +const headersEntries = (headers: Headers): Array<[string, string]> => { + const entries: Array<[string, string]> = []; + headers.forEach((value, key) => { + entries.push([key, value]); + }); + return entries; +}; + export const mergeHeaders = ( ...headers: Array['headers'] | undefined> ): Headers => { const mergedHeaders = new Headers(); for (const header of headers) { - if (!header || typeof header !== 'object') { + if (!header) { continue; } const iterator = - header instanceof Headers ? header.entries() : Object.entries(header); + header instanceof Headers + ? headersEntries(header) + : Object.entries(header); for (const [key, value] of iterator) { if (value === null) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/client-fetch/sdk-nested-classes/client/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/client-fetch/sdk-nested-classes/client/utils.gen.ts index a47509522..b9ec3cdd6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/client-fetch/sdk-nested-classes/client/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/client-fetch/sdk-nested-classes/client/utils.gen.ts @@ -183,17 +183,27 @@ export const mergeConfigs = (a: Config, b: Config): Config => { return config; }; +const headersEntries = (headers: Headers): Array<[string, string]> => { + const entries: Array<[string, string]> = []; + headers.forEach((value, key) => { + entries.push([key, value]); + }); + return entries; +}; + export const mergeHeaders = ( ...headers: Array['headers'] | undefined> ): Headers => { const mergedHeaders = new Headers(); for (const header of headers) { - if (!header || typeof header !== 'object') { + if (!header) { continue; } const iterator = - header instanceof Headers ? header.entries() : Object.entries(header); + header instanceof Headers + ? headersEntries(header) + : Object.entries(header); for (const [key, value] of iterator) { if (value === null) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/sdk/default/client/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/sdk/default/client/utils.gen.ts index a47509522..b9ec3cdd6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/sdk/default/client/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/sdk/default/client/utils.gen.ts @@ -183,17 +183,27 @@ export const mergeConfigs = (a: Config, b: Config): Config => { return config; }; +const headersEntries = (headers: Headers): Array<[string, string]> => { + const entries: Array<[string, string]> = []; + headers.forEach((value, key) => { + entries.push([key, value]); + }); + return entries; +}; + export const mergeHeaders = ( ...headers: Array['headers'] | undefined> ): Headers => { const mergedHeaders = new Headers(); for (const header of headers) { - if (!header || typeof header !== 'object') { + if (!header) { continue; } const iterator = - header instanceof Headers ? header.entries() : Object.entries(header); + header instanceof Headers + ? headersEntries(header) + : Object.entries(header); for (const [key, value] of iterator) { if (value === null) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/sdk/instance/client/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/sdk/instance/client/utils.gen.ts index a47509522..b9ec3cdd6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/sdk/instance/client/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/sdk/instance/client/utils.gen.ts @@ -183,17 +183,27 @@ export const mergeConfigs = (a: Config, b: Config): Config => { return config; }; +const headersEntries = (headers: Headers): Array<[string, string]> => { + const entries: Array<[string, string]> = []; + headers.forEach((value, key) => { + entries.push([key, value]); + }); + return entries; +}; + export const mergeHeaders = ( ...headers: Array['headers'] | undefined> ): Headers => { const mergedHeaders = new Headers(); for (const header of headers) { - if (!header || typeof header !== 'object') { + if (!header) { continue; } const iterator = - header instanceof Headers ? header.entries() : Object.entries(header); + header instanceof Headers + ? headersEntries(header) + : Object.entries(header); for (const [key, value] of iterator) { if (value === null) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/sdk/throwOnError/client/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/sdk/throwOnError/client/utils.gen.ts index a47509522..b9ec3cdd6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/sdk/throwOnError/client/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/sdk/throwOnError/client/utils.gen.ts @@ -183,17 +183,27 @@ export const mergeConfigs = (a: Config, b: Config): Config => { return config; }; +const headersEntries = (headers: Headers): Array<[string, string]> => { + const entries: Array<[string, string]> = []; + headers.forEach((value, key) => { + entries.push([key, value]); + }); + return entries; +}; + export const mergeHeaders = ( ...headers: Array['headers'] | undefined> ): Headers => { const mergedHeaders = new Headers(); for (const header of headers) { - if (!header || typeof header !== 'object') { + if (!header) { continue; } const iterator = - header instanceof Headers ? header.entries() : Object.entries(header); + header instanceof Headers + ? headersEntries(header) + : Object.entries(header); for (const [key, value] of iterator) { if (value === null) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/transformers/type-format-valibot/client/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/transformers/type-format-valibot/client/utils.gen.ts index a47509522..b9ec3cdd6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/transformers/type-format-valibot/client/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/transformers/type-format-valibot/client/utils.gen.ts @@ -183,17 +183,27 @@ export const mergeConfigs = (a: Config, b: Config): Config => { return config; }; +const headersEntries = (headers: Headers): Array<[string, string]> => { + const entries: Array<[string, string]> = []; + headers.forEach((value, key) => { + entries.push([key, value]); + }); + return entries; +}; + export const mergeHeaders = ( ...headers: Array['headers'] | undefined> ): Headers => { const mergedHeaders = new Headers(); for (const header of headers) { - if (!header || typeof header !== 'object') { + if (!header) { continue; } const iterator = - header instanceof Headers ? header.entries() : Object.entries(header); + header instanceof Headers + ? headersEntries(header) + : Object.entries(header); for (const [key, value] of iterator) { if (value === null) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/transformers/type-format-zod/client/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/transformers/type-format-zod/client/utils.gen.ts index a47509522..b9ec3cdd6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/transformers/type-format-zod/client/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/transformers/type-format-zod/client/utils.gen.ts @@ -183,17 +183,27 @@ export const mergeConfigs = (a: Config, b: Config): Config => { return config; }; +const headersEntries = (headers: Headers): Array<[string, string]> => { + const entries: Array<[string, string]> = []; + headers.forEach((value, key) => { + entries.push([key, value]); + }); + return entries; +}; + export const mergeHeaders = ( ...headers: Array['headers'] | undefined> ): Headers => { const mergedHeaders = new Headers(); for (const header of headers) { - if (!header || typeof header !== 'object') { + if (!header) { continue; } const iterator = - header instanceof Headers ? header.entries() : Object.entries(header); + header instanceof Headers + ? headersEntries(header) + : Object.entries(header); for (const [key, value] of iterator) { if (value === null) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/typescript/transforms-read-write-custom-name/client/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/typescript/transforms-read-write-custom-name/client/utils.gen.ts index a47509522..b9ec3cdd6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/typescript/transforms-read-write-custom-name/client/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/typescript/transforms-read-write-custom-name/client/utils.gen.ts @@ -183,17 +183,27 @@ export const mergeConfigs = (a: Config, b: Config): Config => { return config; }; +const headersEntries = (headers: Headers): Array<[string, string]> => { + const entries: Array<[string, string]> = []; + headers.forEach((value, key) => { + entries.push([key, value]); + }); + return entries; +}; + export const mergeHeaders = ( ...headers: Array['headers'] | undefined> ): Headers => { const mergedHeaders = new Headers(); for (const header of headers) { - if (!header || typeof header !== 'object') { + if (!header) { continue; } const iterator = - header instanceof Headers ? header.entries() : Object.entries(header); + header instanceof Headers + ? headersEntries(header) + : Object.entries(header); for (const [key, value] of iterator) { if (value === null) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/typescript/transforms-read-write-ignore/client/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/typescript/transforms-read-write-ignore/client/utils.gen.ts index a47509522..b9ec3cdd6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/typescript/transforms-read-write-ignore/client/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/typescript/transforms-read-write-ignore/client/utils.gen.ts @@ -183,17 +183,27 @@ export const mergeConfigs = (a: Config, b: Config): Config => { return config; }; +const headersEntries = (headers: Headers): Array<[string, string]> => { + const entries: Array<[string, string]> = []; + headers.forEach((value, key) => { + entries.push([key, value]); + }); + return entries; +}; + export const mergeHeaders = ( ...headers: Array['headers'] | undefined> ): Headers => { const mergedHeaders = new Headers(); for (const header of headers) { - if (!header || typeof header !== 'object') { + if (!header) { continue; } const iterator = - header instanceof Headers ? header.entries() : Object.entries(header); + header instanceof Headers + ? headersEntries(header) + : Object.entries(header); for (const [key, value] of iterator) { if (value === null) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@pinia/colada/fetch/client/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@pinia/colada/fetch/client/utils.gen.ts index a47509522..b9ec3cdd6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@pinia/colada/fetch/client/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@pinia/colada/fetch/client/utils.gen.ts @@ -183,17 +183,27 @@ export const mergeConfigs = (a: Config, b: Config): Config => { return config; }; +const headersEntries = (headers: Headers): Array<[string, string]> => { + const entries: Array<[string, string]> = []; + headers.forEach((value, key) => { + entries.push([key, value]); + }); + return entries; +}; + export const mergeHeaders = ( ...headers: Array['headers'] | undefined> ): Headers => { const mergedHeaders = new Headers(); for (const header of headers) { - if (!header || typeof header !== 'object') { + if (!header) { continue; } const iterator = - header instanceof Headers ? header.entries() : Object.entries(header); + header instanceof Headers + ? headersEntries(header) + : Object.entries(header); for (const [key, value] of iterator) { if (value === null) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@pinia/colada/group-by-tag/client/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@pinia/colada/group-by-tag/client/utils.gen.ts index a47509522..b9ec3cdd6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@pinia/colada/group-by-tag/client/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@pinia/colada/group-by-tag/client/utils.gen.ts @@ -183,17 +183,27 @@ export const mergeConfigs = (a: Config, b: Config): Config => { return config; }; +const headersEntries = (headers: Headers): Array<[string, string]> => { + const entries: Array<[string, string]> = []; + headers.forEach((value, key) => { + entries.push([key, value]); + }); + return entries; +}; + export const mergeHeaders = ( ...headers: Array['headers'] | undefined> ): Headers => { const mergedHeaders = new Headers(); for (const header of headers) { - if (!header || typeof header !== 'object') { + if (!header) { continue; } const iterator = - header instanceof Headers ? header.entries() : Object.entries(header); + header instanceof Headers + ? headersEntries(header) + : Object.entries(header); for (const [key, value] of iterator) { if (value === null) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/asClass/client/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/asClass/client/utils.gen.ts index a47509522..b9ec3cdd6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/asClass/client/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/asClass/client/utils.gen.ts @@ -183,17 +183,27 @@ export const mergeConfigs = (a: Config, b: Config): Config => { return config; }; +const headersEntries = (headers: Headers): Array<[string, string]> => { + const entries: Array<[string, string]> = []; + headers.forEach((value, key) => { + entries.push([key, value]); + }); + return entries; +}; + export const mergeHeaders = ( ...headers: Array['headers'] | undefined> ): Headers => { const mergedHeaders = new Headers(); for (const header of headers) { - if (!header || typeof header !== 'object') { + if (!header) { continue; } const iterator = - header instanceof Headers ? header.entries() : Object.entries(header); + header instanceof Headers + ? headersEntries(header) + : Object.entries(header); for (const [key, value] of iterator) { if (value === null) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/fetch/client/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/fetch/client/utils.gen.ts index a47509522..b9ec3cdd6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/fetch/client/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/fetch/client/utils.gen.ts @@ -183,17 +183,27 @@ export const mergeConfigs = (a: Config, b: Config): Config => { return config; }; +const headersEntries = (headers: Headers): Array<[string, string]> => { + const entries: Array<[string, string]> = []; + headers.forEach((value, key) => { + entries.push([key, value]); + }); + return entries; +}; + export const mergeHeaders = ( ...headers: Array['headers'] | undefined> ): Headers => { const mergedHeaders = new Headers(); for (const header of headers) { - if (!header || typeof header !== 'object') { + if (!header) { continue; } const iterator = - header instanceof Headers ? header.entries() : Object.entries(header); + header instanceof Headers + ? headersEntries(header) + : Object.entries(header); for (const [key, value] of iterator) { if (value === null) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/name-builder/client/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/name-builder/client/utils.gen.ts index a47509522..b9ec3cdd6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/name-builder/client/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/name-builder/client/utils.gen.ts @@ -183,17 +183,27 @@ export const mergeConfigs = (a: Config, b: Config): Config => { return config; }; +const headersEntries = (headers: Headers): Array<[string, string]> => { + const entries: Array<[string, string]> = []; + headers.forEach((value, key) => { + entries.push([key, value]); + }); + return entries; +}; + export const mergeHeaders = ( ...headers: Array['headers'] | undefined> ): Headers => { const mergedHeaders = new Headers(); for (const header of headers) { - if (!header || typeof header !== 'object') { + if (!header) { continue; } const iterator = - header instanceof Headers ? header.entries() : Object.entries(header); + header instanceof Headers + ? headersEntries(header) + : Object.entries(header); for (const [key, value] of iterator) { if (value === null) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/react-query/asClass/client/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/react-query/asClass/client/utils.gen.ts index a47509522..b9ec3cdd6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/react-query/asClass/client/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/react-query/asClass/client/utils.gen.ts @@ -183,17 +183,27 @@ export const mergeConfigs = (a: Config, b: Config): Config => { return config; }; +const headersEntries = (headers: Headers): Array<[string, string]> => { + const entries: Array<[string, string]> = []; + headers.forEach((value, key) => { + entries.push([key, value]); + }); + return entries; +}; + export const mergeHeaders = ( ...headers: Array['headers'] | undefined> ): Headers => { const mergedHeaders = new Headers(); for (const header of headers) { - if (!header || typeof header !== 'object') { + if (!header) { continue; } const iterator = - header instanceof Headers ? header.entries() : Object.entries(header); + header instanceof Headers + ? headersEntries(header) + : Object.entries(header); for (const [key, value] of iterator) { if (value === null) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/react-query/fetch/client/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/react-query/fetch/client/utils.gen.ts index a47509522..b9ec3cdd6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/react-query/fetch/client/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/react-query/fetch/client/utils.gen.ts @@ -183,17 +183,27 @@ export const mergeConfigs = (a: Config, b: Config): Config => { return config; }; +const headersEntries = (headers: Headers): Array<[string, string]> => { + const entries: Array<[string, string]> = []; + headers.forEach((value, key) => { + entries.push([key, value]); + }); + return entries; +}; + export const mergeHeaders = ( ...headers: Array['headers'] | undefined> ): Headers => { const mergedHeaders = new Headers(); for (const header of headers) { - if (!header || typeof header !== 'object') { + if (!header) { continue; } const iterator = - header instanceof Headers ? header.entries() : Object.entries(header); + header instanceof Headers + ? headersEntries(header) + : Object.entries(header); for (const [key, value] of iterator) { if (value === null) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/react-query/name-builder/client/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/react-query/name-builder/client/utils.gen.ts index a47509522..b9ec3cdd6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/react-query/name-builder/client/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/react-query/name-builder/client/utils.gen.ts @@ -183,17 +183,27 @@ export const mergeConfigs = (a: Config, b: Config): Config => { return config; }; +const headersEntries = (headers: Headers): Array<[string, string]> => { + const entries: Array<[string, string]> = []; + headers.forEach((value, key) => { + entries.push([key, value]); + }); + return entries; +}; + export const mergeHeaders = ( ...headers: Array['headers'] | undefined> ): Headers => { const mergedHeaders = new Headers(); for (const header of headers) { - if (!header || typeof header !== 'object') { + if (!header) { continue; } const iterator = - header instanceof Headers ? header.entries() : Object.entries(header); + header instanceof Headers + ? headersEntries(header) + : Object.entries(header); for (const [key, value] of iterator) { if (value === null) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/solid-query/asClass/client/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/solid-query/asClass/client/utils.gen.ts index a47509522..b9ec3cdd6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/solid-query/asClass/client/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/solid-query/asClass/client/utils.gen.ts @@ -183,17 +183,27 @@ export const mergeConfigs = (a: Config, b: Config): Config => { return config; }; +const headersEntries = (headers: Headers): Array<[string, string]> => { + const entries: Array<[string, string]> = []; + headers.forEach((value, key) => { + entries.push([key, value]); + }); + return entries; +}; + export const mergeHeaders = ( ...headers: Array['headers'] | undefined> ): Headers => { const mergedHeaders = new Headers(); for (const header of headers) { - if (!header || typeof header !== 'object') { + if (!header) { continue; } const iterator = - header instanceof Headers ? header.entries() : Object.entries(header); + header instanceof Headers + ? headersEntries(header) + : Object.entries(header); for (const [key, value] of iterator) { if (value === null) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/solid-query/fetch/client/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/solid-query/fetch/client/utils.gen.ts index a47509522..b9ec3cdd6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/solid-query/fetch/client/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/solid-query/fetch/client/utils.gen.ts @@ -183,17 +183,27 @@ export const mergeConfigs = (a: Config, b: Config): Config => { return config; }; +const headersEntries = (headers: Headers): Array<[string, string]> => { + const entries: Array<[string, string]> = []; + headers.forEach((value, key) => { + entries.push([key, value]); + }); + return entries; +}; + export const mergeHeaders = ( ...headers: Array['headers'] | undefined> ): Headers => { const mergedHeaders = new Headers(); for (const header of headers) { - if (!header || typeof header !== 'object') { + if (!header) { continue; } const iterator = - header instanceof Headers ? header.entries() : Object.entries(header); + header instanceof Headers + ? headersEntries(header) + : Object.entries(header); for (const [key, value] of iterator) { if (value === null) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/solid-query/name-builder/client/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/solid-query/name-builder/client/utils.gen.ts index a47509522..b9ec3cdd6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/solid-query/name-builder/client/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/solid-query/name-builder/client/utils.gen.ts @@ -183,17 +183,27 @@ export const mergeConfigs = (a: Config, b: Config): Config => { return config; }; +const headersEntries = (headers: Headers): Array<[string, string]> => { + const entries: Array<[string, string]> = []; + headers.forEach((value, key) => { + entries.push([key, value]); + }); + return entries; +}; + export const mergeHeaders = ( ...headers: Array['headers'] | undefined> ): Headers => { const mergedHeaders = new Headers(); for (const header of headers) { - if (!header || typeof header !== 'object') { + if (!header) { continue; } const iterator = - header instanceof Headers ? header.entries() : Object.entries(header); + header instanceof Headers + ? headersEntries(header) + : Object.entries(header); for (const [key, value] of iterator) { if (value === null) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/svelte-query/asClass/client/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/svelte-query/asClass/client/utils.gen.ts index a47509522..b9ec3cdd6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/svelte-query/asClass/client/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/svelte-query/asClass/client/utils.gen.ts @@ -183,17 +183,27 @@ export const mergeConfigs = (a: Config, b: Config): Config => { return config; }; +const headersEntries = (headers: Headers): Array<[string, string]> => { + const entries: Array<[string, string]> = []; + headers.forEach((value, key) => { + entries.push([key, value]); + }); + return entries; +}; + export const mergeHeaders = ( ...headers: Array['headers'] | undefined> ): Headers => { const mergedHeaders = new Headers(); for (const header of headers) { - if (!header || typeof header !== 'object') { + if (!header) { continue; } const iterator = - header instanceof Headers ? header.entries() : Object.entries(header); + header instanceof Headers + ? headersEntries(header) + : Object.entries(header); for (const [key, value] of iterator) { if (value === null) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/svelte-query/fetch/client/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/svelte-query/fetch/client/utils.gen.ts index a47509522..b9ec3cdd6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/svelte-query/fetch/client/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/svelte-query/fetch/client/utils.gen.ts @@ -183,17 +183,27 @@ export const mergeConfigs = (a: Config, b: Config): Config => { return config; }; +const headersEntries = (headers: Headers): Array<[string, string]> => { + const entries: Array<[string, string]> = []; + headers.forEach((value, key) => { + entries.push([key, value]); + }); + return entries; +}; + export const mergeHeaders = ( ...headers: Array['headers'] | undefined> ): Headers => { const mergedHeaders = new Headers(); for (const header of headers) { - if (!header || typeof header !== 'object') { + if (!header) { continue; } const iterator = - header instanceof Headers ? header.entries() : Object.entries(header); + header instanceof Headers + ? headersEntries(header) + : Object.entries(header); for (const [key, value] of iterator) { if (value === null) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/svelte-query/name-builder/client/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/svelte-query/name-builder/client/utils.gen.ts index a47509522..b9ec3cdd6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/svelte-query/name-builder/client/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/svelte-query/name-builder/client/utils.gen.ts @@ -183,17 +183,27 @@ export const mergeConfigs = (a: Config, b: Config): Config => { return config; }; +const headersEntries = (headers: Headers): Array<[string, string]> => { + const entries: Array<[string, string]> = []; + headers.forEach((value, key) => { + entries.push([key, value]); + }); + return entries; +}; + export const mergeHeaders = ( ...headers: Array['headers'] | undefined> ): Headers => { const mergedHeaders = new Headers(); for (const header of headers) { - if (!header || typeof header !== 'object') { + if (!header) { continue; } const iterator = - header instanceof Headers ? header.entries() : Object.entries(header); + header instanceof Headers + ? headersEntries(header) + : Object.entries(header); for (const [key, value] of iterator) { if (value === null) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/vue-query/asClass/client/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/vue-query/asClass/client/utils.gen.ts index a47509522..b9ec3cdd6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/vue-query/asClass/client/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/vue-query/asClass/client/utils.gen.ts @@ -183,17 +183,27 @@ export const mergeConfigs = (a: Config, b: Config): Config => { return config; }; +const headersEntries = (headers: Headers): Array<[string, string]> => { + const entries: Array<[string, string]> = []; + headers.forEach((value, key) => { + entries.push([key, value]); + }); + return entries; +}; + export const mergeHeaders = ( ...headers: Array['headers'] | undefined> ): Headers => { const mergedHeaders = new Headers(); for (const header of headers) { - if (!header || typeof header !== 'object') { + if (!header) { continue; } const iterator = - header instanceof Headers ? header.entries() : Object.entries(header); + header instanceof Headers + ? headersEntries(header) + : Object.entries(header); for (const [key, value] of iterator) { if (value === null) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/vue-query/fetch/client/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/vue-query/fetch/client/utils.gen.ts index a47509522..b9ec3cdd6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/vue-query/fetch/client/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/vue-query/fetch/client/utils.gen.ts @@ -183,17 +183,27 @@ export const mergeConfigs = (a: Config, b: Config): Config => { return config; }; +const headersEntries = (headers: Headers): Array<[string, string]> => { + const entries: Array<[string, string]> = []; + headers.forEach((value, key) => { + entries.push([key, value]); + }); + return entries; +}; + export const mergeHeaders = ( ...headers: Array['headers'] | undefined> ): Headers => { const mergedHeaders = new Headers(); for (const header of headers) { - if (!header || typeof header !== 'object') { + if (!header) { continue; } const iterator = - header instanceof Headers ? header.entries() : Object.entries(header); + header instanceof Headers + ? headersEntries(header) + : Object.entries(header); for (const [key, value] of iterator) { if (value === null) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/vue-query/name-builder/client/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/vue-query/name-builder/client/utils.gen.ts index a47509522..b9ec3cdd6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/vue-query/name-builder/client/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/vue-query/name-builder/client/utils.gen.ts @@ -183,17 +183,27 @@ export const mergeConfigs = (a: Config, b: Config): Config => { return config; }; +const headersEntries = (headers: Headers): Array<[string, string]> => { + const entries: Array<[string, string]> = []; + headers.forEach((value, key) => { + entries.push([key, value]); + }); + return entries; +}; + export const mergeHeaders = ( ...headers: Array['headers'] | undefined> ): Headers => { const mergedHeaders = new Headers(); for (const header of headers) { - if (!header || typeof header !== 'object') { + if (!header) { continue; } const iterator = - header instanceof Headers ? header.entries() : Object.entries(header); + header instanceof Headers + ? headersEntries(header) + : Object.entries(header); for (const [key, value] of iterator) { if (value === null) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/schema-unknown/client/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/schema-unknown/client/utils.gen.ts index a47509522..b9ec3cdd6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/schema-unknown/client/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/schema-unknown/client/utils.gen.ts @@ -183,17 +183,27 @@ export const mergeConfigs = (a: Config, b: Config): Config => { return config; }; +const headersEntries = (headers: Headers): Array<[string, string]> => { + const entries: Array<[string, string]> = []; + headers.forEach((value, key) => { + entries.push([key, value]); + }); + return entries; +}; + export const mergeHeaders = ( ...headers: Array['headers'] | undefined> ): Headers => { const mergedHeaders = new Headers(); for (const header of headers) { - if (!header || typeof header !== 'object') { + if (!header) { continue; } const iterator = - header instanceof Headers ? header.entries() : Object.entries(header); + header instanceof Headers + ? headersEntries(header) + : Object.entries(header); for (const [key, value] of iterator) { if (value === null) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-api-key/client/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-api-key/client/utils.gen.ts index a47509522..b9ec3cdd6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-api-key/client/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-api-key/client/utils.gen.ts @@ -183,17 +183,27 @@ export const mergeConfigs = (a: Config, b: Config): Config => { return config; }; +const headersEntries = (headers: Headers): Array<[string, string]> => { + const entries: Array<[string, string]> = []; + headers.forEach((value, key) => { + entries.push([key, value]); + }); + return entries; +}; + export const mergeHeaders = ( ...headers: Array['headers'] | undefined> ): Headers => { const mergedHeaders = new Headers(); for (const header of headers) { - if (!header || typeof header !== 'object') { + if (!header) { continue; } const iterator = - header instanceof Headers ? header.entries() : Object.entries(header); + header instanceof Headers + ? headersEntries(header) + : Object.entries(header); for (const [key, value] of iterator) { if (value === null) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-basic/client/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-basic/client/utils.gen.ts index a47509522..b9ec3cdd6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-basic/client/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-basic/client/utils.gen.ts @@ -183,17 +183,27 @@ export const mergeConfigs = (a: Config, b: Config): Config => { return config; }; +const headersEntries = (headers: Headers): Array<[string, string]> => { + const entries: Array<[string, string]> = []; + headers.forEach((value, key) => { + entries.push([key, value]); + }); + return entries; +}; + export const mergeHeaders = ( ...headers: Array['headers'] | undefined> ): Headers => { const mergedHeaders = new Headers(); for (const header of headers) { - if (!header || typeof header !== 'object') { + if (!header) { continue; } const iterator = - header instanceof Headers ? header.entries() : Object.entries(header); + header instanceof Headers + ? headersEntries(header) + : Object.entries(header); for (const [key, value] of iterator) { if (value === null) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-false/client/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-false/client/utils.gen.ts index a47509522..b9ec3cdd6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-false/client/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-false/client/utils.gen.ts @@ -183,17 +183,27 @@ export const mergeConfigs = (a: Config, b: Config): Config => { return config; }; +const headersEntries = (headers: Headers): Array<[string, string]> => { + const entries: Array<[string, string]> = []; + headers.forEach((value, key) => { + entries.push([key, value]); + }); + return entries; +}; + export const mergeHeaders = ( ...headers: Array['headers'] | undefined> ): Headers => { const mergedHeaders = new Headers(); for (const header of headers) { - if (!header || typeof header !== 'object') { + if (!header) { continue; } const iterator = - header instanceof Headers ? header.entries() : Object.entries(header); + header instanceof Headers + ? headersEntries(header) + : Object.entries(header); for (const [key, value] of iterator) { if (value === null) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-oauth2/client/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-oauth2/client/utils.gen.ts index a47509522..b9ec3cdd6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-oauth2/client/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-oauth2/client/utils.gen.ts @@ -183,17 +183,27 @@ export const mergeConfigs = (a: Config, b: Config): Config => { return config; }; +const headersEntries = (headers: Headers): Array<[string, string]> => { + const entries: Array<[string, string]> = []; + headers.forEach((value, key) => { + entries.push([key, value]); + }); + return entries; +}; + export const mergeHeaders = ( ...headers: Array['headers'] | undefined> ): Headers => { const mergedHeaders = new Headers(); for (const header of headers) { - if (!header || typeof header !== 'object') { + if (!header) { continue; } const iterator = - header instanceof Headers ? header.entries() : Object.entries(header); + header instanceof Headers + ? headersEntries(header) + : Object.entries(header); for (const [key, value] of iterator) { if (value === null) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/servers-base-path/client/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/servers-base-path/client/utils.gen.ts index a47509522..b9ec3cdd6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/servers-base-path/client/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/servers-base-path/client/utils.gen.ts @@ -183,17 +183,27 @@ export const mergeConfigs = (a: Config, b: Config): Config => { return config; }; +const headersEntries = (headers: Headers): Array<[string, string]> => { + const entries: Array<[string, string]> = []; + headers.forEach((value, key) => { + entries.push([key, value]); + }); + return entries; +}; + export const mergeHeaders = ( ...headers: Array['headers'] | undefined> ): Headers => { const mergedHeaders = new Headers(); for (const header of headers) { - if (!header || typeof header !== 'object') { + if (!header) { continue; } const iterator = - header instanceof Headers ? header.entries() : Object.entries(header); + header instanceof Headers + ? headersEntries(header) + : Object.entries(header); for (const [key, value] of iterator) { if (value === null) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/servers-host/client/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/servers-host/client/utils.gen.ts index a47509522..b9ec3cdd6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/servers-host/client/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/servers-host/client/utils.gen.ts @@ -183,17 +183,27 @@ export const mergeConfigs = (a: Config, b: Config): Config => { return config; }; +const headersEntries = (headers: Headers): Array<[string, string]> => { + const entries: Array<[string, string]> = []; + headers.forEach((value, key) => { + entries.push([key, value]); + }); + return entries; +}; + export const mergeHeaders = ( ...headers: Array['headers'] | undefined> ): Headers => { const mergedHeaders = new Headers(); for (const header of headers) { - if (!header || typeof header !== 'object') { + if (!header) { continue; } const iterator = - header instanceof Headers ? header.entries() : Object.entries(header); + header instanceof Headers + ? headersEntries(header) + : Object.entries(header); for (const [key, value] of iterator) { if (value === null) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/servers/client/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/servers/client/utils.gen.ts index a47509522..b9ec3cdd6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/servers/client/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/servers/client/utils.gen.ts @@ -183,17 +183,27 @@ export const mergeConfigs = (a: Config, b: Config): Config => { return config; }; +const headersEntries = (headers: Headers): Array<[string, string]> => { + const entries: Array<[string, string]> = []; + headers.forEach((value, key) => { + entries.push([key, value]); + }); + return entries; +}; + export const mergeHeaders = ( ...headers: Array['headers'] | undefined> ): Headers => { const mergedHeaders = new Headers(); for (const header of headers) { - if (!header || typeof header !== 'object') { + if (!header) { continue; } const iterator = - header instanceof Headers ? header.entries() : Object.entries(header); + header instanceof Headers + ? headersEntries(header) + : Object.entries(header); for (const [key, value] of iterator) { if (value === null) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/transforms-read-write/client/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/transforms-read-write/client/utils.gen.ts index a47509522..b9ec3cdd6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/transforms-read-write/client/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/transforms-read-write/client/utils.gen.ts @@ -183,17 +183,27 @@ export const mergeConfigs = (a: Config, b: Config): Config => { return config; }; +const headersEntries = (headers: Headers): Array<[string, string]> => { + const entries: Array<[string, string]> = []; + headers.forEach((value, key) => { + entries.push([key, value]); + }); + return entries; +}; + export const mergeHeaders = ( ...headers: Array['headers'] | undefined> ): Headers => { const mergedHeaders = new Headers(); for (const header of headers) { - if (!header || typeof header !== 'object') { + if (!header) { continue; } const iterator = - header instanceof Headers ? header.entries() : Object.entries(header); + header instanceof Headers + ? headersEntries(header) + : Object.entries(header); for (const [key, value] of iterator) { if (value === null) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/body-response-text-plain/client/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/body-response-text-plain/client/utils.gen.ts index a47509522..b9ec3cdd6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/body-response-text-plain/client/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/body-response-text-plain/client/utils.gen.ts @@ -183,17 +183,27 @@ export const mergeConfigs = (a: Config, b: Config): Config => { return config; }; +const headersEntries = (headers: Headers): Array<[string, string]> => { + const entries: Array<[string, string]> = []; + headers.forEach((value, key) => { + entries.push([key, value]); + }); + return entries; +}; + export const mergeHeaders = ( ...headers: Array['headers'] | undefined> ): Headers => { const mergedHeaders = new Headers(); for (const header of headers) { - if (!header || typeof header !== 'object') { + if (!header) { continue; } const iterator = - header instanceof Headers ? header.entries() : Object.entries(header); + header instanceof Headers + ? headersEntries(header) + : Object.entries(header); for (const [key, value] of iterator) { if (value === null) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/internal-name-conflict/client/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/internal-name-conflict/client/utils.gen.ts index a47509522..b9ec3cdd6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/internal-name-conflict/client/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/internal-name-conflict/client/utils.gen.ts @@ -183,17 +183,27 @@ export const mergeConfigs = (a: Config, b: Config): Config => { return config; }; +const headersEntries = (headers: Headers): Array<[string, string]> => { + const entries: Array<[string, string]> = []; + headers.forEach((value, key) => { + entries.push([key, value]); + }); + return entries; +}; + export const mergeHeaders = ( ...headers: Array['headers'] | undefined> ): Headers => { const mergedHeaders = new Headers(); for (const header of headers) { - if (!header || typeof header !== 'object') { + if (!header) { continue; } const iterator = - header instanceof Headers ? header.entries() : Object.entries(header); + header instanceof Headers + ? headersEntries(header) + : Object.entries(header); for (const [key, value] of iterator) { if (value === null) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/parameter-explode-false/client/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/parameter-explode-false/client/utils.gen.ts index a47509522..b9ec3cdd6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/parameter-explode-false/client/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/parameter-explode-false/client/utils.gen.ts @@ -183,17 +183,27 @@ export const mergeConfigs = (a: Config, b: Config): Config => { return config; }; +const headersEntries = (headers: Headers): Array<[string, string]> => { + const entries: Array<[string, string]> = []; + headers.forEach((value, key) => { + entries.push([key, value]); + }); + return entries; +}; + export const mergeHeaders = ( ...headers: Array['headers'] | undefined> ): Headers => { const mergedHeaders = new Headers(); for (const header of headers) { - if (!header || typeof header !== 'object') { + if (!header) { continue; } const iterator = - header instanceof Headers ? header.entries() : Object.entries(header); + header instanceof Headers + ? headersEntries(header) + : Object.entries(header); for (const [key, value] of iterator) { if (value === null) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/client-fetch/sdk-nested-classes-instance/client/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/client-fetch/sdk-nested-classes-instance/client/utils.gen.ts index a47509522..b9ec3cdd6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/client-fetch/sdk-nested-classes-instance/client/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/client-fetch/sdk-nested-classes-instance/client/utils.gen.ts @@ -183,17 +183,27 @@ export const mergeConfigs = (a: Config, b: Config): Config => { return config; }; +const headersEntries = (headers: Headers): Array<[string, string]> => { + const entries: Array<[string, string]> = []; + headers.forEach((value, key) => { + entries.push([key, value]); + }); + return entries; +}; + export const mergeHeaders = ( ...headers: Array['headers'] | undefined> ): Headers => { const mergedHeaders = new Headers(); for (const header of headers) { - if (!header || typeof header !== 'object') { + if (!header) { continue; } const iterator = - header instanceof Headers ? header.entries() : Object.entries(header); + header instanceof Headers + ? headersEntries(header) + : Object.entries(header); for (const [key, value] of iterator) { if (value === null) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/client-fetch/sdk-nested-classes/client/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/client-fetch/sdk-nested-classes/client/utils.gen.ts index a47509522..b9ec3cdd6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/client-fetch/sdk-nested-classes/client/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/client-fetch/sdk-nested-classes/client/utils.gen.ts @@ -183,17 +183,27 @@ export const mergeConfigs = (a: Config, b: Config): Config => { return config; }; +const headersEntries = (headers: Headers): Array<[string, string]> => { + const entries: Array<[string, string]> = []; + headers.forEach((value, key) => { + entries.push([key, value]); + }); + return entries; +}; + export const mergeHeaders = ( ...headers: Array['headers'] | undefined> ): Headers => { const mergedHeaders = new Headers(); for (const header of headers) { - if (!header || typeof header !== 'object') { + if (!header) { continue; } const iterator = - header instanceof Headers ? header.entries() : Object.entries(header); + header instanceof Headers + ? headersEntries(header) + : Object.entries(header); for (const [key, value] of iterator) { if (value === null) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/sdk/default/client/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/sdk/default/client/utils.gen.ts index a47509522..b9ec3cdd6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/sdk/default/client/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/sdk/default/client/utils.gen.ts @@ -183,17 +183,27 @@ export const mergeConfigs = (a: Config, b: Config): Config => { return config; }; +const headersEntries = (headers: Headers): Array<[string, string]> => { + const entries: Array<[string, string]> = []; + headers.forEach((value, key) => { + entries.push([key, value]); + }); + return entries; +}; + export const mergeHeaders = ( ...headers: Array['headers'] | undefined> ): Headers => { const mergedHeaders = new Headers(); for (const header of headers) { - if (!header || typeof header !== 'object') { + if (!header) { continue; } const iterator = - header instanceof Headers ? header.entries() : Object.entries(header); + header instanceof Headers + ? headersEntries(header) + : Object.entries(header); for (const [key, value] of iterator) { if (value === null) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/sdk/instance/client/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/sdk/instance/client/utils.gen.ts index a47509522..b9ec3cdd6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/sdk/instance/client/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/sdk/instance/client/utils.gen.ts @@ -183,17 +183,27 @@ export const mergeConfigs = (a: Config, b: Config): Config => { return config; }; +const headersEntries = (headers: Headers): Array<[string, string]> => { + const entries: Array<[string, string]> = []; + headers.forEach((value, key) => { + entries.push([key, value]); + }); + return entries; +}; + export const mergeHeaders = ( ...headers: Array['headers'] | undefined> ): Headers => { const mergedHeaders = new Headers(); for (const header of headers) { - if (!header || typeof header !== 'object') { + if (!header) { continue; } const iterator = - header instanceof Headers ? header.entries() : Object.entries(header); + header instanceof Headers + ? headersEntries(header) + : Object.entries(header); for (const [key, value] of iterator) { if (value === null) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/sdk/throwOnError/client/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/sdk/throwOnError/client/utils.gen.ts index a47509522..b9ec3cdd6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/sdk/throwOnError/client/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/sdk/throwOnError/client/utils.gen.ts @@ -183,17 +183,27 @@ export const mergeConfigs = (a: Config, b: Config): Config => { return config; }; +const headersEntries = (headers: Headers): Array<[string, string]> => { + const entries: Array<[string, string]> = []; + headers.forEach((value, key) => { + entries.push([key, value]); + }); + return entries; +}; + export const mergeHeaders = ( ...headers: Array['headers'] | undefined> ): Headers => { const mergedHeaders = new Headers(); for (const header of headers) { - if (!header || typeof header !== 'object') { + if (!header) { continue; } const iterator = - header instanceof Headers ? header.entries() : Object.entries(header); + header instanceof Headers + ? headersEntries(header) + : Object.entries(header); for (const [key, value] of iterator) { if (value === null) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/transformers/type-format-valibot/client/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/transformers/type-format-valibot/client/utils.gen.ts index a47509522..b9ec3cdd6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/transformers/type-format-valibot/client/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/transformers/type-format-valibot/client/utils.gen.ts @@ -183,17 +183,27 @@ export const mergeConfigs = (a: Config, b: Config): Config => { return config; }; +const headersEntries = (headers: Headers): Array<[string, string]> => { + const entries: Array<[string, string]> = []; + headers.forEach((value, key) => { + entries.push([key, value]); + }); + return entries; +}; + export const mergeHeaders = ( ...headers: Array['headers'] | undefined> ): Headers => { const mergedHeaders = new Headers(); for (const header of headers) { - if (!header || typeof header !== 'object') { + if (!header) { continue; } const iterator = - header instanceof Headers ? header.entries() : Object.entries(header); + header instanceof Headers + ? headersEntries(header) + : Object.entries(header); for (const [key, value] of iterator) { if (value === null) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/transformers/type-format-zod/client/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/transformers/type-format-zod/client/utils.gen.ts index a47509522..b9ec3cdd6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/transformers/type-format-zod/client/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/transformers/type-format-zod/client/utils.gen.ts @@ -183,17 +183,27 @@ export const mergeConfigs = (a: Config, b: Config): Config => { return config; }; +const headersEntries = (headers: Headers): Array<[string, string]> => { + const entries: Array<[string, string]> = []; + headers.forEach((value, key) => { + entries.push([key, value]); + }); + return entries; +}; + export const mergeHeaders = ( ...headers: Array['headers'] | undefined> ): Headers => { const mergedHeaders = new Headers(); for (const header of headers) { - if (!header || typeof header !== 'object') { + if (!header) { continue; } const iterator = - header instanceof Headers ? header.entries() : Object.entries(header); + header instanceof Headers + ? headersEntries(header) + : Object.entries(header); for (const [key, value] of iterator) { if (value === null) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/typescript/transforms-read-write-custom-name/client/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/typescript/transforms-read-write-custom-name/client/utils.gen.ts index a47509522..b9ec3cdd6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/typescript/transforms-read-write-custom-name/client/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/typescript/transforms-read-write-custom-name/client/utils.gen.ts @@ -183,17 +183,27 @@ export const mergeConfigs = (a: Config, b: Config): Config => { return config; }; +const headersEntries = (headers: Headers): Array<[string, string]> => { + const entries: Array<[string, string]> = []; + headers.forEach((value, key) => { + entries.push([key, value]); + }); + return entries; +}; + export const mergeHeaders = ( ...headers: Array['headers'] | undefined> ): Headers => { const mergedHeaders = new Headers(); for (const header of headers) { - if (!header || typeof header !== 'object') { + if (!header) { continue; } const iterator = - header instanceof Headers ? header.entries() : Object.entries(header); + header instanceof Headers + ? headersEntries(header) + : Object.entries(header); for (const [key, value] of iterator) { if (value === null) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/typescript/transforms-read-write-ignore/client/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/typescript/transforms-read-write-ignore/client/utils.gen.ts index a47509522..b9ec3cdd6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/typescript/transforms-read-write-ignore/client/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/typescript/transforms-read-write-ignore/client/utils.gen.ts @@ -183,17 +183,27 @@ export const mergeConfigs = (a: Config, b: Config): Config => { return config; }; +const headersEntries = (headers: Headers): Array<[string, string]> => { + const entries: Array<[string, string]> = []; + headers.forEach((value, key) => { + entries.push([key, value]); + }); + return entries; +}; + export const mergeHeaders = ( ...headers: Array['headers'] | undefined> ): Headers => { const mergedHeaders = new Headers(); for (const header of headers) { - if (!header || typeof header !== 'object') { + if (!header) { continue; } const iterator = - header instanceof Headers ? header.entries() : Object.entries(header); + header instanceof Headers + ? headersEntries(header) + : Object.entries(header); for (const [key, value] of iterator) { if (value === null) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@pinia/colada/fetch/client/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@pinia/colada/fetch/client/utils.gen.ts index a47509522..b9ec3cdd6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@pinia/colada/fetch/client/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@pinia/colada/fetch/client/utils.gen.ts @@ -183,17 +183,27 @@ export const mergeConfigs = (a: Config, b: Config): Config => { return config; }; +const headersEntries = (headers: Headers): Array<[string, string]> => { + const entries: Array<[string, string]> = []; + headers.forEach((value, key) => { + entries.push([key, value]); + }); + return entries; +}; + export const mergeHeaders = ( ...headers: Array['headers'] | undefined> ): Headers => { const mergedHeaders = new Headers(); for (const header of headers) { - if (!header || typeof header !== 'object') { + if (!header) { continue; } const iterator = - header instanceof Headers ? header.entries() : Object.entries(header); + header instanceof Headers + ? headersEntries(header) + : Object.entries(header); for (const [key, value] of iterator) { if (value === null) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@pinia/colada/group-by-tag/client/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@pinia/colada/group-by-tag/client/utils.gen.ts index a47509522..b9ec3cdd6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@pinia/colada/group-by-tag/client/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@pinia/colada/group-by-tag/client/utils.gen.ts @@ -183,17 +183,27 @@ export const mergeConfigs = (a: Config, b: Config): Config => { return config; }; +const headersEntries = (headers: Headers): Array<[string, string]> => { + const entries: Array<[string, string]> = []; + headers.forEach((value, key) => { + entries.push([key, value]); + }); + return entries; +}; + export const mergeHeaders = ( ...headers: Array['headers'] | undefined> ): Headers => { const mergedHeaders = new Headers(); for (const header of headers) { - if (!header || typeof header !== 'object') { + if (!header) { continue; } const iterator = - header instanceof Headers ? header.entries() : Object.entries(header); + header instanceof Headers + ? headersEntries(header) + : Object.entries(header); for (const [key, value] of iterator) { if (value === null) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/angular-query-experimental/asClass/client/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/angular-query-experimental/asClass/client/utils.gen.ts index a47509522..b9ec3cdd6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/angular-query-experimental/asClass/client/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/angular-query-experimental/asClass/client/utils.gen.ts @@ -183,17 +183,27 @@ export const mergeConfigs = (a: Config, b: Config): Config => { return config; }; +const headersEntries = (headers: Headers): Array<[string, string]> => { + const entries: Array<[string, string]> = []; + headers.forEach((value, key) => { + entries.push([key, value]); + }); + return entries; +}; + export const mergeHeaders = ( ...headers: Array['headers'] | undefined> ): Headers => { const mergedHeaders = new Headers(); for (const header of headers) { - if (!header || typeof header !== 'object') { + if (!header) { continue; } const iterator = - header instanceof Headers ? header.entries() : Object.entries(header); + header instanceof Headers + ? headersEntries(header) + : Object.entries(header); for (const [key, value] of iterator) { if (value === null) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/angular-query-experimental/fetch/client/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/angular-query-experimental/fetch/client/utils.gen.ts index a47509522..b9ec3cdd6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/angular-query-experimental/fetch/client/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/angular-query-experimental/fetch/client/utils.gen.ts @@ -183,17 +183,27 @@ export const mergeConfigs = (a: Config, b: Config): Config => { return config; }; +const headersEntries = (headers: Headers): Array<[string, string]> => { + const entries: Array<[string, string]> = []; + headers.forEach((value, key) => { + entries.push([key, value]); + }); + return entries; +}; + export const mergeHeaders = ( ...headers: Array['headers'] | undefined> ): Headers => { const mergedHeaders = new Headers(); for (const header of headers) { - if (!header || typeof header !== 'object') { + if (!header) { continue; } const iterator = - header instanceof Headers ? header.entries() : Object.entries(header); + header instanceof Headers + ? headersEntries(header) + : Object.entries(header); for (const [key, value] of iterator) { if (value === null) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/angular-query-experimental/name-builder/client/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/angular-query-experimental/name-builder/client/utils.gen.ts index a47509522..b9ec3cdd6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/angular-query-experimental/name-builder/client/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/angular-query-experimental/name-builder/client/utils.gen.ts @@ -183,17 +183,27 @@ export const mergeConfigs = (a: Config, b: Config): Config => { return config; }; +const headersEntries = (headers: Headers): Array<[string, string]> => { + const entries: Array<[string, string]> = []; + headers.forEach((value, key) => { + entries.push([key, value]); + }); + return entries; +}; + export const mergeHeaders = ( ...headers: Array['headers'] | undefined> ): Headers => { const mergedHeaders = new Headers(); for (const header of headers) { - if (!header || typeof header !== 'object') { + if (!header) { continue; } const iterator = - header instanceof Headers ? header.entries() : Object.entries(header); + header instanceof Headers + ? headersEntries(header) + : Object.entries(header); for (const [key, value] of iterator) { if (value === null) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/react-query/asClass/client/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/react-query/asClass/client/utils.gen.ts index a47509522..b9ec3cdd6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/react-query/asClass/client/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/react-query/asClass/client/utils.gen.ts @@ -183,17 +183,27 @@ export const mergeConfigs = (a: Config, b: Config): Config => { return config; }; +const headersEntries = (headers: Headers): Array<[string, string]> => { + const entries: Array<[string, string]> = []; + headers.forEach((value, key) => { + entries.push([key, value]); + }); + return entries; +}; + export const mergeHeaders = ( ...headers: Array['headers'] | undefined> ): Headers => { const mergedHeaders = new Headers(); for (const header of headers) { - if (!header || typeof header !== 'object') { + if (!header) { continue; } const iterator = - header instanceof Headers ? header.entries() : Object.entries(header); + header instanceof Headers + ? headersEntries(header) + : Object.entries(header); for (const [key, value] of iterator) { if (value === null) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/react-query/fetch/client/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/react-query/fetch/client/utils.gen.ts index a47509522..b9ec3cdd6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/react-query/fetch/client/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/react-query/fetch/client/utils.gen.ts @@ -183,17 +183,27 @@ export const mergeConfigs = (a: Config, b: Config): Config => { return config; }; +const headersEntries = (headers: Headers): Array<[string, string]> => { + const entries: Array<[string, string]> = []; + headers.forEach((value, key) => { + entries.push([key, value]); + }); + return entries; +}; + export const mergeHeaders = ( ...headers: Array['headers'] | undefined> ): Headers => { const mergedHeaders = new Headers(); for (const header of headers) { - if (!header || typeof header !== 'object') { + if (!header) { continue; } const iterator = - header instanceof Headers ? header.entries() : Object.entries(header); + header instanceof Headers + ? headersEntries(header) + : Object.entries(header); for (const [key, value] of iterator) { if (value === null) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/react-query/name-builder/client/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/react-query/name-builder/client/utils.gen.ts index a47509522..b9ec3cdd6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/react-query/name-builder/client/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/react-query/name-builder/client/utils.gen.ts @@ -183,17 +183,27 @@ export const mergeConfigs = (a: Config, b: Config): Config => { return config; }; +const headersEntries = (headers: Headers): Array<[string, string]> => { + const entries: Array<[string, string]> = []; + headers.forEach((value, key) => { + entries.push([key, value]); + }); + return entries; +}; + export const mergeHeaders = ( ...headers: Array['headers'] | undefined> ): Headers => { const mergedHeaders = new Headers(); for (const header of headers) { - if (!header || typeof header !== 'object') { + if (!header) { continue; } const iterator = - header instanceof Headers ? header.entries() : Object.entries(header); + header instanceof Headers + ? headersEntries(header) + : Object.entries(header); for (const [key, value] of iterator) { if (value === null) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/solid-query/asClass/client/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/solid-query/asClass/client/utils.gen.ts index a47509522..b9ec3cdd6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/solid-query/asClass/client/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/solid-query/asClass/client/utils.gen.ts @@ -183,17 +183,27 @@ export const mergeConfigs = (a: Config, b: Config): Config => { return config; }; +const headersEntries = (headers: Headers): Array<[string, string]> => { + const entries: Array<[string, string]> = []; + headers.forEach((value, key) => { + entries.push([key, value]); + }); + return entries; +}; + export const mergeHeaders = ( ...headers: Array['headers'] | undefined> ): Headers => { const mergedHeaders = new Headers(); for (const header of headers) { - if (!header || typeof header !== 'object') { + if (!header) { continue; } const iterator = - header instanceof Headers ? header.entries() : Object.entries(header); + header instanceof Headers + ? headersEntries(header) + : Object.entries(header); for (const [key, value] of iterator) { if (value === null) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/solid-query/fetch/client/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/solid-query/fetch/client/utils.gen.ts index a47509522..b9ec3cdd6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/solid-query/fetch/client/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/solid-query/fetch/client/utils.gen.ts @@ -183,17 +183,27 @@ export const mergeConfigs = (a: Config, b: Config): Config => { return config; }; +const headersEntries = (headers: Headers): Array<[string, string]> => { + const entries: Array<[string, string]> = []; + headers.forEach((value, key) => { + entries.push([key, value]); + }); + return entries; +}; + export const mergeHeaders = ( ...headers: Array['headers'] | undefined> ): Headers => { const mergedHeaders = new Headers(); for (const header of headers) { - if (!header || typeof header !== 'object') { + if (!header) { continue; } const iterator = - header instanceof Headers ? header.entries() : Object.entries(header); + header instanceof Headers + ? headersEntries(header) + : Object.entries(header); for (const [key, value] of iterator) { if (value === null) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/solid-query/name-builder/client/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/solid-query/name-builder/client/utils.gen.ts index a47509522..b9ec3cdd6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/solid-query/name-builder/client/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/solid-query/name-builder/client/utils.gen.ts @@ -183,17 +183,27 @@ export const mergeConfigs = (a: Config, b: Config): Config => { return config; }; +const headersEntries = (headers: Headers): Array<[string, string]> => { + const entries: Array<[string, string]> = []; + headers.forEach((value, key) => { + entries.push([key, value]); + }); + return entries; +}; + export const mergeHeaders = ( ...headers: Array['headers'] | undefined> ): Headers => { const mergedHeaders = new Headers(); for (const header of headers) { - if (!header || typeof header !== 'object') { + if (!header) { continue; } const iterator = - header instanceof Headers ? header.entries() : Object.entries(header); + header instanceof Headers + ? headersEntries(header) + : Object.entries(header); for (const [key, value] of iterator) { if (value === null) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/svelte-query/asClass/client/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/svelte-query/asClass/client/utils.gen.ts index a47509522..b9ec3cdd6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/svelte-query/asClass/client/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/svelte-query/asClass/client/utils.gen.ts @@ -183,17 +183,27 @@ export const mergeConfigs = (a: Config, b: Config): Config => { return config; }; +const headersEntries = (headers: Headers): Array<[string, string]> => { + const entries: Array<[string, string]> = []; + headers.forEach((value, key) => { + entries.push([key, value]); + }); + return entries; +}; + export const mergeHeaders = ( ...headers: Array['headers'] | undefined> ): Headers => { const mergedHeaders = new Headers(); for (const header of headers) { - if (!header || typeof header !== 'object') { + if (!header) { continue; } const iterator = - header instanceof Headers ? header.entries() : Object.entries(header); + header instanceof Headers + ? headersEntries(header) + : Object.entries(header); for (const [key, value] of iterator) { if (value === null) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/svelte-query/fetch/client/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/svelte-query/fetch/client/utils.gen.ts index a47509522..b9ec3cdd6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/svelte-query/fetch/client/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/svelte-query/fetch/client/utils.gen.ts @@ -183,17 +183,27 @@ export const mergeConfigs = (a: Config, b: Config): Config => { return config; }; +const headersEntries = (headers: Headers): Array<[string, string]> => { + const entries: Array<[string, string]> = []; + headers.forEach((value, key) => { + entries.push([key, value]); + }); + return entries; +}; + export const mergeHeaders = ( ...headers: Array['headers'] | undefined> ): Headers => { const mergedHeaders = new Headers(); for (const header of headers) { - if (!header || typeof header !== 'object') { + if (!header) { continue; } const iterator = - header instanceof Headers ? header.entries() : Object.entries(header); + header instanceof Headers + ? headersEntries(header) + : Object.entries(header); for (const [key, value] of iterator) { if (value === null) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/svelte-query/name-builder/client/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/svelte-query/name-builder/client/utils.gen.ts index a47509522..b9ec3cdd6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/svelte-query/name-builder/client/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/svelte-query/name-builder/client/utils.gen.ts @@ -183,17 +183,27 @@ export const mergeConfigs = (a: Config, b: Config): Config => { return config; }; +const headersEntries = (headers: Headers): Array<[string, string]> => { + const entries: Array<[string, string]> = []; + headers.forEach((value, key) => { + entries.push([key, value]); + }); + return entries; +}; + export const mergeHeaders = ( ...headers: Array['headers'] | undefined> ): Headers => { const mergedHeaders = new Headers(); for (const header of headers) { - if (!header || typeof header !== 'object') { + if (!header) { continue; } const iterator = - header instanceof Headers ? header.entries() : Object.entries(header); + header instanceof Headers + ? headersEntries(header) + : Object.entries(header); for (const [key, value] of iterator) { if (value === null) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/vue-query/asClass/client/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/vue-query/asClass/client/utils.gen.ts index a47509522..b9ec3cdd6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/vue-query/asClass/client/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/vue-query/asClass/client/utils.gen.ts @@ -183,17 +183,27 @@ export const mergeConfigs = (a: Config, b: Config): Config => { return config; }; +const headersEntries = (headers: Headers): Array<[string, string]> => { + const entries: Array<[string, string]> = []; + headers.forEach((value, key) => { + entries.push([key, value]); + }); + return entries; +}; + export const mergeHeaders = ( ...headers: Array['headers'] | undefined> ): Headers => { const mergedHeaders = new Headers(); for (const header of headers) { - if (!header || typeof header !== 'object') { + if (!header) { continue; } const iterator = - header instanceof Headers ? header.entries() : Object.entries(header); + header instanceof Headers + ? headersEntries(header) + : Object.entries(header); for (const [key, value] of iterator) { if (value === null) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/vue-query/fetch/client/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/vue-query/fetch/client/utils.gen.ts index a47509522..b9ec3cdd6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/vue-query/fetch/client/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/vue-query/fetch/client/utils.gen.ts @@ -183,17 +183,27 @@ export const mergeConfigs = (a: Config, b: Config): Config => { return config; }; +const headersEntries = (headers: Headers): Array<[string, string]> => { + const entries: Array<[string, string]> = []; + headers.forEach((value, key) => { + entries.push([key, value]); + }); + return entries; +}; + export const mergeHeaders = ( ...headers: Array['headers'] | undefined> ): Headers => { const mergedHeaders = new Headers(); for (const header of headers) { - if (!header || typeof header !== 'object') { + if (!header) { continue; } const iterator = - header instanceof Headers ? header.entries() : Object.entries(header); + header instanceof Headers + ? headersEntries(header) + : Object.entries(header); for (const [key, value] of iterator) { if (value === null) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/vue-query/name-builder/client/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/vue-query/name-builder/client/utils.gen.ts index a47509522..b9ec3cdd6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/vue-query/name-builder/client/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/vue-query/name-builder/client/utils.gen.ts @@ -183,17 +183,27 @@ export const mergeConfigs = (a: Config, b: Config): Config => { return config; }; +const headersEntries = (headers: Headers): Array<[string, string]> => { + const entries: Array<[string, string]> = []; + headers.forEach((value, key) => { + entries.push([key, value]); + }); + return entries; +}; + export const mergeHeaders = ( ...headers: Array['headers'] | undefined> ): Headers => { const mergedHeaders = new Headers(); for (const header of headers) { - if (!header || typeof header !== 'object') { + if (!header) { continue; } const iterator = - header instanceof Headers ? header.entries() : Object.entries(header); + header instanceof Headers + ? headersEntries(header) + : Object.entries(header); for (const [key, value] of iterator) { if (value === null) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-api-key/client/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-api-key/client/utils.gen.ts index a47509522..b9ec3cdd6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-api-key/client/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-api-key/client/utils.gen.ts @@ -183,17 +183,27 @@ export const mergeConfigs = (a: Config, b: Config): Config => { return config; }; +const headersEntries = (headers: Headers): Array<[string, string]> => { + const entries: Array<[string, string]> = []; + headers.forEach((value, key) => { + entries.push([key, value]); + }); + return entries; +}; + export const mergeHeaders = ( ...headers: Array['headers'] | undefined> ): Headers => { const mergedHeaders = new Headers(); for (const header of headers) { - if (!header || typeof header !== 'object') { + if (!header) { continue; } const iterator = - header instanceof Headers ? header.entries() : Object.entries(header); + header instanceof Headers + ? headersEntries(header) + : Object.entries(header); for (const [key, value] of iterator) { if (value === null) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-false/client/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-false/client/utils.gen.ts index a47509522..b9ec3cdd6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-false/client/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-false/client/utils.gen.ts @@ -183,17 +183,27 @@ export const mergeConfigs = (a: Config, b: Config): Config => { return config; }; +const headersEntries = (headers: Headers): Array<[string, string]> => { + const entries: Array<[string, string]> = []; + headers.forEach((value, key) => { + entries.push([key, value]); + }); + return entries; +}; + export const mergeHeaders = ( ...headers: Array['headers'] | undefined> ): Headers => { const mergedHeaders = new Headers(); for (const header of headers) { - if (!header || typeof header !== 'object') { + if (!header) { continue; } const iterator = - header instanceof Headers ? header.entries() : Object.entries(header); + header instanceof Headers + ? headersEntries(header) + : Object.entries(header); for (const [key, value] of iterator) { if (value === null) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-http-bearer/client/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-http-bearer/client/utils.gen.ts index a47509522..b9ec3cdd6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-http-bearer/client/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-http-bearer/client/utils.gen.ts @@ -183,17 +183,27 @@ export const mergeConfigs = (a: Config, b: Config): Config => { return config; }; +const headersEntries = (headers: Headers): Array<[string, string]> => { + const entries: Array<[string, string]> = []; + headers.forEach((value, key) => { + entries.push([key, value]); + }); + return entries; +}; + export const mergeHeaders = ( ...headers: Array['headers'] | undefined> ): Headers => { const mergedHeaders = new Headers(); for (const header of headers) { - if (!header || typeof header !== 'object') { + if (!header) { continue; } const iterator = - header instanceof Headers ? header.entries() : Object.entries(header); + header instanceof Headers + ? headersEntries(header) + : Object.entries(header); for (const [key, value] of iterator) { if (value === null) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-oauth2/client/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-oauth2/client/utils.gen.ts index a47509522..b9ec3cdd6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-oauth2/client/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-oauth2/client/utils.gen.ts @@ -183,17 +183,27 @@ export const mergeConfigs = (a: Config, b: Config): Config => { return config; }; +const headersEntries = (headers: Headers): Array<[string, string]> => { + const entries: Array<[string, string]> = []; + headers.forEach((value, key) => { + entries.push([key, value]); + }); + return entries; +}; + export const mergeHeaders = ( ...headers: Array['headers'] | undefined> ): Headers => { const mergedHeaders = new Headers(); for (const header of headers) { - if (!header || typeof header !== 'object') { + if (!header) { continue; } const iterator = - header instanceof Headers ? header.entries() : Object.entries(header); + header instanceof Headers + ? headersEntries(header) + : Object.entries(header); for (const [key, value] of iterator) { if (value === null) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-open-id-connect/client/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-open-id-connect/client/utils.gen.ts index a47509522..b9ec3cdd6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-open-id-connect/client/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-open-id-connect/client/utils.gen.ts @@ -183,17 +183,27 @@ export const mergeConfigs = (a: Config, b: Config): Config => { return config; }; +const headersEntries = (headers: Headers): Array<[string, string]> => { + const entries: Array<[string, string]> = []; + headers.forEach((value, key) => { + entries.push([key, value]); + }); + return entries; +}; + export const mergeHeaders = ( ...headers: Array['headers'] | undefined> ): Headers => { const mergedHeaders = new Headers(); for (const header of headers) { - if (!header || typeof header !== 'object') { + if (!header) { continue; } const iterator = - header instanceof Headers ? header.entries() : Object.entries(header); + header instanceof Headers + ? headersEntries(header) + : Object.entries(header); for (const [key, value] of iterator) { if (value === null) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/servers/client/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/servers/client/utils.gen.ts index a47509522..b9ec3cdd6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/servers/client/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/servers/client/utils.gen.ts @@ -183,17 +183,27 @@ export const mergeConfigs = (a: Config, b: Config): Config => { return config; }; +const headersEntries = (headers: Headers): Array<[string, string]> => { + const entries: Array<[string, string]> = []; + headers.forEach((value, key) => { + entries.push([key, value]); + }); + return entries; +}; + export const mergeHeaders = ( ...headers: Array['headers'] | undefined> ): Headers => { const mergedHeaders = new Headers(); for (const header of headers) { - if (!header || typeof header !== 'object') { + if (!header) { continue; } const iterator = - header instanceof Headers ? header.entries() : Object.entries(header); + header instanceof Headers + ? headersEntries(header) + : Object.entries(header); for (const [key, value] of iterator) { if (value === null) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transformers-all-of/client/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transformers-all-of/client/utils.gen.ts index a47509522..b9ec3cdd6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transformers-all-of/client/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transformers-all-of/client/utils.gen.ts @@ -183,17 +183,27 @@ export const mergeConfigs = (a: Config, b: Config): Config => { return config; }; +const headersEntries = (headers: Headers): Array<[string, string]> => { + const entries: Array<[string, string]> = []; + headers.forEach((value, key) => { + entries.push([key, value]); + }); + return entries; +}; + export const mergeHeaders = ( ...headers: Array['headers'] | undefined> ): Headers => { const mergedHeaders = new Headers(); for (const header of headers) { - if (!header || typeof header !== 'object') { + if (!header) { continue; } const iterator = - header instanceof Headers ? header.entries() : Object.entries(header); + header instanceof Headers + ? headersEntries(header) + : Object.entries(header); for (const [key, value] of iterator) { if (value === null) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transformers-any-of-null/client/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transformers-any-of-null/client/utils.gen.ts index a47509522..b9ec3cdd6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transformers-any-of-null/client/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transformers-any-of-null/client/utils.gen.ts @@ -183,17 +183,27 @@ export const mergeConfigs = (a: Config, b: Config): Config => { return config; }; +const headersEntries = (headers: Headers): Array<[string, string]> => { + const entries: Array<[string, string]> = []; + headers.forEach((value, key) => { + entries.push([key, value]); + }); + return entries; +}; + export const mergeHeaders = ( ...headers: Array['headers'] | undefined> ): Headers => { const mergedHeaders = new Headers(); for (const header of headers) { - if (!header || typeof header !== 'object') { + if (!header) { continue; } const iterator = - header instanceof Headers ? header.entries() : Object.entries(header); + header instanceof Headers + ? headersEntries(header) + : Object.entries(header); for (const [key, value] of iterator) { if (value === null) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transformers-array/client/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transformers-array/client/utils.gen.ts index a47509522..b9ec3cdd6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transformers-array/client/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transformers-array/client/utils.gen.ts @@ -183,17 +183,27 @@ export const mergeConfigs = (a: Config, b: Config): Config => { return config; }; +const headersEntries = (headers: Headers): Array<[string, string]> => { + const entries: Array<[string, string]> = []; + headers.forEach((value, key) => { + entries.push([key, value]); + }); + return entries; +}; + export const mergeHeaders = ( ...headers: Array['headers'] | undefined> ): Headers => { const mergedHeaders = new Headers(); for (const header of headers) { - if (!header || typeof header !== 'object') { + if (!header) { continue; } const iterator = - header instanceof Headers ? header.entries() : Object.entries(header); + header instanceof Headers + ? headersEntries(header) + : Object.entries(header); for (const [key, value] of iterator) { if (value === null) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transforms-read-write/client/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transforms-read-write/client/utils.gen.ts index a47509522..b9ec3cdd6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transforms-read-write/client/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transforms-read-write/client/utils.gen.ts @@ -183,17 +183,27 @@ export const mergeConfigs = (a: Config, b: Config): Config => { return config; }; +const headersEntries = (headers: Headers): Array<[string, string]> => { + const entries: Array<[string, string]> = []; + headers.forEach((value, key) => { + entries.push([key, value]); + }); + return entries; +}; + export const mergeHeaders = ( ...headers: Array['headers'] | undefined> ): Headers => { const mergedHeaders = new Headers(); for (const header of headers) { - if (!header || typeof header !== 'object') { + if (!header) { continue; } const iterator = - header instanceof Headers ? header.entries() : Object.entries(header); + header instanceof Headers + ? headersEntries(header) + : Object.entries(header); for (const [key, value] of iterator) { if (value === null) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/body-response-text-plain/client/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/body-response-text-plain/client/utils.gen.ts index a47509522..b9ec3cdd6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/body-response-text-plain/client/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/body-response-text-plain/client/utils.gen.ts @@ -183,17 +183,27 @@ export const mergeConfigs = (a: Config, b: Config): Config => { return config; }; +const headersEntries = (headers: Headers): Array<[string, string]> => { + const entries: Array<[string, string]> = []; + headers.forEach((value, key) => { + entries.push([key, value]); + }); + return entries; +}; + export const mergeHeaders = ( ...headers: Array['headers'] | undefined> ): Headers => { const mergedHeaders = new Headers(); for (const header of headers) { - if (!header || typeof header !== 'object') { + if (!header) { continue; } const iterator = - header instanceof Headers ? header.entries() : Object.entries(header); + header instanceof Headers + ? headersEntries(header) + : Object.entries(header); for (const [key, value] of iterator) { if (value === null) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-false/client/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-false/client/utils.gen.ts index a47509522..b9ec3cdd6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-false/client/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-false/client/utils.gen.ts @@ -183,17 +183,27 @@ export const mergeConfigs = (a: Config, b: Config): Config => { return config; }; +const headersEntries = (headers: Headers): Array<[string, string]> => { + const entries: Array<[string, string]> = []; + headers.forEach((value, key) => { + entries.push([key, value]); + }); + return entries; +}; + export const mergeHeaders = ( ...headers: Array['headers'] | undefined> ): Headers => { const mergedHeaders = new Headers(); for (const header of headers) { - if (!header || typeof header !== 'object') { + if (!header) { continue; } const iterator = - header instanceof Headers ? header.entries() : Object.entries(header); + header instanceof Headers + ? headersEntries(header) + : Object.entries(header); for (const [key, value] of iterator) { if (value === null) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-number/client/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-number/client/utils.gen.ts index a47509522..b9ec3cdd6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-number/client/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-number/client/utils.gen.ts @@ -183,17 +183,27 @@ export const mergeConfigs = (a: Config, b: Config): Config => { return config; }; +const headersEntries = (headers: Headers): Array<[string, string]> => { + const entries: Array<[string, string]> = []; + headers.forEach((value, key) => { + entries.push([key, value]); + }); + return entries; +}; + export const mergeHeaders = ( ...headers: Array['headers'] | undefined> ): Headers => { const mergedHeaders = new Headers(); for (const header of headers) { - if (!header || typeof header !== 'object') { + if (!header) { continue; } const iterator = - header instanceof Headers ? header.entries() : Object.entries(header); + header instanceof Headers + ? headersEntries(header) + : Object.entries(header); for (const [key, value] of iterator) { if (value === null) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-strict/client/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-strict/client/utils.gen.ts index a47509522..b9ec3cdd6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-strict/client/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-strict/client/utils.gen.ts @@ -183,17 +183,27 @@ export const mergeConfigs = (a: Config, b: Config): Config => { return config; }; +const headersEntries = (headers: Headers): Array<[string, string]> => { + const entries: Array<[string, string]> = []; + headers.forEach((value, key) => { + entries.push([key, value]); + }); + return entries; +}; + export const mergeHeaders = ( ...headers: Array['headers'] | undefined> ): Headers => { const mergedHeaders = new Headers(); for (const header of headers) { - if (!header || typeof header !== 'object') { + if (!header) { continue; } const iterator = - header instanceof Headers ? header.entries() : Object.entries(header); + header instanceof Headers + ? headersEntries(header) + : Object.entries(header); for (const [key, value] of iterator) { if (value === null) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-string/client/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-string/client/utils.gen.ts index a47509522..b9ec3cdd6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-string/client/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-string/client/utils.gen.ts @@ -183,17 +183,27 @@ export const mergeConfigs = (a: Config, b: Config): Config => { return config; }; +const headersEntries = (headers: Headers): Array<[string, string]> => { + const entries: Array<[string, string]> = []; + headers.forEach((value, key) => { + entries.push([key, value]); + }); + return entries; +}; + export const mergeHeaders = ( ...headers: Array['headers'] | undefined> ): Headers => { const mergedHeaders = new Headers(); for (const header of headers) { - if (!header || typeof header !== 'object') { + if (!header) { continue; } const iterator = - header instanceof Headers ? header.entries() : Object.entries(header); + header instanceof Headers + ? headersEntries(header) + : Object.entries(header); for (const [key, value] of iterator) { if (value === null) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/clean-false/client/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/clean-false/client/utils.gen.ts index a47509522..b9ec3cdd6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/clean-false/client/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/clean-false/client/utils.gen.ts @@ -183,17 +183,27 @@ export const mergeConfigs = (a: Config, b: Config): Config => { return config; }; +const headersEntries = (headers: Headers): Array<[string, string]> => { + const entries: Array<[string, string]> = []; + headers.forEach((value, key) => { + entries.push([key, value]); + }); + return entries; +}; + export const mergeHeaders = ( ...headers: Array['headers'] | undefined> ): Headers => { const mergedHeaders = new Headers(); for (const header of headers) { - if (!header || typeof header !== 'object') { + if (!header) { continue; } const iterator = - header instanceof Headers ? header.entries() : Object.entries(header); + header instanceof Headers + ? headersEntries(header) + : Object.entries(header); for (const [key, value] of iterator) { if (value === null) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/default/client/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/default/client/utils.gen.ts index a47509522..b9ec3cdd6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/default/client/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/default/client/utils.gen.ts @@ -183,17 +183,27 @@ export const mergeConfigs = (a: Config, b: Config): Config => { return config; }; +const headersEntries = (headers: Headers): Array<[string, string]> => { + const entries: Array<[string, string]> = []; + headers.forEach((value, key) => { + entries.push([key, value]); + }); + return entries; +}; + export const mergeHeaders = ( ...headers: Array['headers'] | undefined> ): Headers => { const mergedHeaders = new Headers(); for (const header of headers) { - if (!header || typeof header !== 'object') { + if (!header) { continue; } const iterator = - header instanceof Headers ? header.entries() : Object.entries(header); + header instanceof Headers + ? headersEntries(header) + : Object.entries(header); for (const [key, value] of iterator) { if (value === null) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/sdk-client-optional/client/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/sdk-client-optional/client/utils.gen.ts index a47509522..b9ec3cdd6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/sdk-client-optional/client/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/sdk-client-optional/client/utils.gen.ts @@ -183,17 +183,27 @@ export const mergeConfigs = (a: Config, b: Config): Config => { return config; }; +const headersEntries = (headers: Headers): Array<[string, string]> => { + const entries: Array<[string, string]> = []; + headers.forEach((value, key) => { + entries.push([key, value]); + }); + return entries; +}; + export const mergeHeaders = ( ...headers: Array['headers'] | undefined> ): Headers => { const mergedHeaders = new Headers(); for (const header of headers) { - if (!header || typeof header !== 'object') { + if (!header) { continue; } const iterator = - header instanceof Headers ? header.entries() : Object.entries(header); + header instanceof Headers + ? headersEntries(header) + : Object.entries(header); for (const [key, value] of iterator) { if (value === null) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/sdk-client-required/client/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/sdk-client-required/client/utils.gen.ts index a47509522..b9ec3cdd6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/sdk-client-required/client/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/sdk-client-required/client/utils.gen.ts @@ -183,17 +183,27 @@ export const mergeConfigs = (a: Config, b: Config): Config => { return config; }; +const headersEntries = (headers: Headers): Array<[string, string]> => { + const entries: Array<[string, string]> = []; + headers.forEach((value, key) => { + entries.push([key, value]); + }); + return entries; +}; + export const mergeHeaders = ( ...headers: Array['headers'] | undefined> ): Headers => { const mergedHeaders = new Headers(); for (const header of headers) { - if (!header || typeof header !== 'object') { + if (!header) { continue; } const iterator = - header instanceof Headers ? header.entries() : Object.entries(header); + header instanceof Headers + ? headersEntries(header) + : Object.entries(header); for (const [key, value] of iterator) { if (value === null) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/tsconfig-nodenext-sdk/client/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/tsconfig-nodenext-sdk/client/utils.gen.ts index 74868ee21..369894f5d 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/tsconfig-nodenext-sdk/client/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/tsconfig-nodenext-sdk/client/utils.gen.ts @@ -183,17 +183,27 @@ export const mergeConfigs = (a: Config, b: Config): Config => { return config; }; +const headersEntries = (headers: Headers): Array<[string, string]> => { + const entries: Array<[string, string]> = []; + headers.forEach((value, key) => { + entries.push([key, value]); + }); + return entries; +}; + export const mergeHeaders = ( ...headers: Array['headers'] | undefined> ): Headers => { const mergedHeaders = new Headers(); for (const header of headers) { - if (!header || typeof header !== 'object') { + if (!header) { continue; } const iterator = - header instanceof Headers ? header.entries() : Object.entries(header); + header instanceof Headers + ? headersEntries(header) + : Object.entries(header); for (const [key, value] of iterator) { if (value === null) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-false/client/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-false/client/utils.gen.ts index e7ec4bdab..f3cd764fc 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-false/client/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-false/client/utils.gen.ts @@ -295,6 +295,14 @@ export const mergeConfigs = (a: Config, b: Config): Config => { return config; }; +const headersEntries = (headers: Headers): Array<[string, string]> => { + const entries: Array<[string, string]> = []; + headers.forEach((value, key) => { + entries.push([key, value]); + }); + return entries; +}; + export const mergeHeaders = ( ...headers: Array['headers'] | undefined> ): Headers => { @@ -305,7 +313,9 @@ export const mergeHeaders = ( } const iterator = - header instanceof Headers ? header.entries() : Object.entries(header); + header instanceof Headers + ? headersEntries(header) + : Object.entries(header); for (const [key, value] of iterator) { if (value === null) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-number/client/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-number/client/utils.gen.ts index e7ec4bdab..f3cd764fc 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-number/client/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-number/client/utils.gen.ts @@ -295,6 +295,14 @@ export const mergeConfigs = (a: Config, b: Config): Config => { return config; }; +const headersEntries = (headers: Headers): Array<[string, string]> => { + const entries: Array<[string, string]> = []; + headers.forEach((value, key) => { + entries.push([key, value]); + }); + return entries; +}; + export const mergeHeaders = ( ...headers: Array['headers'] | undefined> ): Headers => { @@ -305,7 +313,9 @@ export const mergeHeaders = ( } const iterator = - header instanceof Headers ? header.entries() : Object.entries(header); + header instanceof Headers + ? headersEntries(header) + : Object.entries(header); for (const [key, value] of iterator) { if (value === null) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-strict/client/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-strict/client/utils.gen.ts index e7ec4bdab..f3cd764fc 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-strict/client/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-strict/client/utils.gen.ts @@ -295,6 +295,14 @@ export const mergeConfigs = (a: Config, b: Config): Config => { return config; }; +const headersEntries = (headers: Headers): Array<[string, string]> => { + const entries: Array<[string, string]> = []; + headers.forEach((value, key) => { + entries.push([key, value]); + }); + return entries; +}; + export const mergeHeaders = ( ...headers: Array['headers'] | undefined> ): Headers => { @@ -305,7 +313,9 @@ export const mergeHeaders = ( } const iterator = - header instanceof Headers ? header.entries() : Object.entries(header); + header instanceof Headers + ? headersEntries(header) + : Object.entries(header); for (const [key, value] of iterator) { if (value === null) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-string/client/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-string/client/utils.gen.ts index e7ec4bdab..f3cd764fc 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-string/client/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-string/client/utils.gen.ts @@ -295,6 +295,14 @@ export const mergeConfigs = (a: Config, b: Config): Config => { return config; }; +const headersEntries = (headers: Headers): Array<[string, string]> => { + const entries: Array<[string, string]> = []; + headers.forEach((value, key) => { + entries.push([key, value]); + }); + return entries; +}; + export const mergeHeaders = ( ...headers: Array['headers'] | undefined> ): Headers => { @@ -305,7 +313,9 @@ export const mergeHeaders = ( } const iterator = - header instanceof Headers ? header.entries() : Object.entries(header); + header instanceof Headers + ? headersEntries(header) + : Object.entries(header); for (const [key, value] of iterator) { if (value === null) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/clean-false/client/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/clean-false/client/utils.gen.ts index e7ec4bdab..f3cd764fc 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/clean-false/client/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/clean-false/client/utils.gen.ts @@ -295,6 +295,14 @@ export const mergeConfigs = (a: Config, b: Config): Config => { return config; }; +const headersEntries = (headers: Headers): Array<[string, string]> => { + const entries: Array<[string, string]> = []; + headers.forEach((value, key) => { + entries.push([key, value]); + }); + return entries; +}; + export const mergeHeaders = ( ...headers: Array['headers'] | undefined> ): Headers => { @@ -305,7 +313,9 @@ export const mergeHeaders = ( } const iterator = - header instanceof Headers ? header.entries() : Object.entries(header); + header instanceof Headers + ? headersEntries(header) + : Object.entries(header); for (const [key, value] of iterator) { if (value === null) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/default/client/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/default/client/utils.gen.ts index e7ec4bdab..f3cd764fc 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/default/client/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/default/client/utils.gen.ts @@ -295,6 +295,14 @@ export const mergeConfigs = (a: Config, b: Config): Config => { return config; }; +const headersEntries = (headers: Headers): Array<[string, string]> => { + const entries: Array<[string, string]> = []; + headers.forEach((value, key) => { + entries.push([key, value]); + }); + return entries; +}; + export const mergeHeaders = ( ...headers: Array['headers'] | undefined> ): Headers => { @@ -305,7 +313,9 @@ export const mergeHeaders = ( } const iterator = - header instanceof Headers ? header.entries() : Object.entries(header); + header instanceof Headers + ? headersEntries(header) + : Object.entries(header); for (const [key, value] of iterator) { if (value === null) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/sdk-client-optional/client/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/sdk-client-optional/client/utils.gen.ts index e7ec4bdab..f3cd764fc 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/sdk-client-optional/client/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/sdk-client-optional/client/utils.gen.ts @@ -295,6 +295,14 @@ export const mergeConfigs = (a: Config, b: Config): Config => { return config; }; +const headersEntries = (headers: Headers): Array<[string, string]> => { + const entries: Array<[string, string]> = []; + headers.forEach((value, key) => { + entries.push([key, value]); + }); + return entries; +}; + export const mergeHeaders = ( ...headers: Array['headers'] | undefined> ): Headers => { @@ -305,7 +313,9 @@ export const mergeHeaders = ( } const iterator = - header instanceof Headers ? header.entries() : Object.entries(header); + header instanceof Headers + ? headersEntries(header) + : Object.entries(header); for (const [key, value] of iterator) { if (value === null) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/sdk-client-required/client/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/sdk-client-required/client/utils.gen.ts index e7ec4bdab..f3cd764fc 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/sdk-client-required/client/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/sdk-client-required/client/utils.gen.ts @@ -295,6 +295,14 @@ export const mergeConfigs = (a: Config, b: Config): Config => { return config; }; +const headersEntries = (headers: Headers): Array<[string, string]> => { + const entries: Array<[string, string]> = []; + headers.forEach((value, key) => { + entries.push([key, value]); + }); + return entries; +}; + export const mergeHeaders = ( ...headers: Array['headers'] | undefined> ): Headers => { @@ -305,7 +313,9 @@ export const mergeHeaders = ( } const iterator = - header instanceof Headers ? header.entries() : Object.entries(header); + header instanceof Headers + ? headersEntries(header) + : Object.entries(header); for (const [key, value] of iterator) { if (value === null) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/tsconfig-nodenext-sdk/client/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/tsconfig-nodenext-sdk/client/utils.gen.ts index 7ee990bee..98945a49d 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/tsconfig-nodenext-sdk/client/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/tsconfig-nodenext-sdk/client/utils.gen.ts @@ -295,6 +295,14 @@ export const mergeConfigs = (a: Config, b: Config): Config => { return config; }; +const headersEntries = (headers: Headers): Array<[string, string]> => { + const entries: Array<[string, string]> = []; + headers.forEach((value, key) => { + entries.push([key, value]); + }); + return entries; +}; + export const mergeHeaders = ( ...headers: Array['headers'] | undefined> ): Headers => { @@ -305,7 +313,9 @@ export const mergeHeaders = ( } const iterator = - header instanceof Headers ? header.entries() : Object.entries(header); + header instanceof Headers + ? headersEntries(header) + : Object.entries(header); for (const [key, value] of iterator) { if (value === null) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/base-url-false/client/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/base-url-false/client/utils.gen.ts index 805978a9a..0a1d343e2 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/base-url-false/client/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/base-url-false/client/utils.gen.ts @@ -252,6 +252,14 @@ export const mergeConfigs = (a: Config, b: Config): Config => { return config; }; +const headersEntries = (headers: Headers): Array<[string, string]> => { + const entries: Array<[string, string]> = []; + headers.forEach((value, key) => { + entries.push([key, value]); + }); + return entries; +}; + export const mergeHeaders = ( ...headers: Array['headers'] | undefined> ): Headers => { @@ -268,7 +276,7 @@ export const mergeHeaders = ( const iterator = h instanceof Headers - ? h.entries() + ? headersEntries(h) : Object.entries(h as Record); for (const [key, value] of iterator) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/base-url-number/client/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/base-url-number/client/utils.gen.ts index 805978a9a..0a1d343e2 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/base-url-number/client/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/base-url-number/client/utils.gen.ts @@ -252,6 +252,14 @@ export const mergeConfigs = (a: Config, b: Config): Config => { return config; }; +const headersEntries = (headers: Headers): Array<[string, string]> => { + const entries: Array<[string, string]> = []; + headers.forEach((value, key) => { + entries.push([key, value]); + }); + return entries; +}; + export const mergeHeaders = ( ...headers: Array['headers'] | undefined> ): Headers => { @@ -268,7 +276,7 @@ export const mergeHeaders = ( const iterator = h instanceof Headers - ? h.entries() + ? headersEntries(h) : Object.entries(h as Record); for (const [key, value] of iterator) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/base-url-strict/client/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/base-url-strict/client/utils.gen.ts index 805978a9a..0a1d343e2 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/base-url-strict/client/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/base-url-strict/client/utils.gen.ts @@ -252,6 +252,14 @@ export const mergeConfigs = (a: Config, b: Config): Config => { return config; }; +const headersEntries = (headers: Headers): Array<[string, string]> => { + const entries: Array<[string, string]> = []; + headers.forEach((value, key) => { + entries.push([key, value]); + }); + return entries; +}; + export const mergeHeaders = ( ...headers: Array['headers'] | undefined> ): Headers => { @@ -268,7 +276,7 @@ export const mergeHeaders = ( const iterator = h instanceof Headers - ? h.entries() + ? headersEntries(h) : Object.entries(h as Record); for (const [key, value] of iterator) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/base-url-string/client/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/base-url-string/client/utils.gen.ts index 805978a9a..0a1d343e2 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/base-url-string/client/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/base-url-string/client/utils.gen.ts @@ -252,6 +252,14 @@ export const mergeConfigs = (a: Config, b: Config): Config => { return config; }; +const headersEntries = (headers: Headers): Array<[string, string]> => { + const entries: Array<[string, string]> = []; + headers.forEach((value, key) => { + entries.push([key, value]); + }); + return entries; +}; + export const mergeHeaders = ( ...headers: Array['headers'] | undefined> ): Headers => { @@ -268,7 +276,7 @@ export const mergeHeaders = ( const iterator = h instanceof Headers - ? h.entries() + ? headersEntries(h) : Object.entries(h as Record); for (const [key, value] of iterator) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/clean-false/client/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/clean-false/client/utils.gen.ts index 805978a9a..0a1d343e2 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/clean-false/client/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/clean-false/client/utils.gen.ts @@ -252,6 +252,14 @@ export const mergeConfigs = (a: Config, b: Config): Config => { return config; }; +const headersEntries = (headers: Headers): Array<[string, string]> => { + const entries: Array<[string, string]> = []; + headers.forEach((value, key) => { + entries.push([key, value]); + }); + return entries; +}; + export const mergeHeaders = ( ...headers: Array['headers'] | undefined> ): Headers => { @@ -268,7 +276,7 @@ export const mergeHeaders = ( const iterator = h instanceof Headers - ? h.entries() + ? headersEntries(h) : Object.entries(h as Record); for (const [key, value] of iterator) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/default/client/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/default/client/utils.gen.ts index 805978a9a..0a1d343e2 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/default/client/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/default/client/utils.gen.ts @@ -252,6 +252,14 @@ export const mergeConfigs = (a: Config, b: Config): Config => { return config; }; +const headersEntries = (headers: Headers): Array<[string, string]> => { + const entries: Array<[string, string]> = []; + headers.forEach((value, key) => { + entries.push([key, value]); + }); + return entries; +}; + export const mergeHeaders = ( ...headers: Array['headers'] | undefined> ): Headers => { @@ -268,7 +276,7 @@ export const mergeHeaders = ( const iterator = h instanceof Headers - ? h.entries() + ? headersEntries(h) : Object.entries(h as Record); for (const [key, value] of iterator) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/sdk-client-optional/client/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/sdk-client-optional/client/utils.gen.ts index 805978a9a..0a1d343e2 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/sdk-client-optional/client/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/sdk-client-optional/client/utils.gen.ts @@ -252,6 +252,14 @@ export const mergeConfigs = (a: Config, b: Config): Config => { return config; }; +const headersEntries = (headers: Headers): Array<[string, string]> => { + const entries: Array<[string, string]> = []; + headers.forEach((value, key) => { + entries.push([key, value]); + }); + return entries; +}; + export const mergeHeaders = ( ...headers: Array['headers'] | undefined> ): Headers => { @@ -268,7 +276,7 @@ export const mergeHeaders = ( const iterator = h instanceof Headers - ? h.entries() + ? headersEntries(h) : Object.entries(h as Record); for (const [key, value] of iterator) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/sdk-client-required/client/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/sdk-client-required/client/utils.gen.ts index 805978a9a..0a1d343e2 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/sdk-client-required/client/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/sdk-client-required/client/utils.gen.ts @@ -252,6 +252,14 @@ export const mergeConfigs = (a: Config, b: Config): Config => { return config; }; +const headersEntries = (headers: Headers): Array<[string, string]> => { + const entries: Array<[string, string]> = []; + headers.forEach((value, key) => { + entries.push([key, value]); + }); + return entries; +}; + export const mergeHeaders = ( ...headers: Array['headers'] | undefined> ): Headers => { @@ -268,7 +276,7 @@ export const mergeHeaders = ( const iterator = h instanceof Headers - ? h.entries() + ? headersEntries(h) : Object.entries(h as Record); for (const [key, value] of iterator) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/tsconfig-nodenext-sdk/client/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/tsconfig-nodenext-sdk/client/utils.gen.ts index 34918256f..6d18a7eac 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/tsconfig-nodenext-sdk/client/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/tsconfig-nodenext-sdk/client/utils.gen.ts @@ -252,6 +252,14 @@ export const mergeConfigs = (a: Config, b: Config): Config => { return config; }; +const headersEntries = (headers: Headers): Array<[string, string]> => { + const entries: Array<[string, string]> = []; + headers.forEach((value, key) => { + entries.push([key, value]); + }); + return entries; +}; + export const mergeHeaders = ( ...headers: Array['headers'] | undefined> ): Headers => { @@ -268,7 +276,7 @@ export const mergeHeaders = ( const iterator = h instanceof Headers - ? h.entries() + ? headersEntries(h) : Object.entries(h as Record); for (const [key, value] of iterator) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/headers/client/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/headers/client/utils.gen.ts index a47509522..b9ec3cdd6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/headers/client/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/headers/client/utils.gen.ts @@ -183,17 +183,27 @@ export const mergeConfigs = (a: Config, b: Config): Config => { return config; }; +const headersEntries = (headers: Headers): Array<[string, string]> => { + const entries: Array<[string, string]> = []; + headers.forEach((value, key) => { + entries.push([key, value]); + }); + return entries; +}; + export const mergeHeaders = ( ...headers: Array['headers'] | undefined> ): Headers => { const mergedHeaders = new Headers(); for (const header of headers) { - if (!header || typeof header !== 'object') { + if (!header) { continue; } const iterator = - header instanceof Headers ? header.entries() : Object.entries(header); + header instanceof Headers + ? headersEntries(header) + : Object.entries(header); for (const [key, value] of iterator) { if (value === null) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/internal-name-conflict/client/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/internal-name-conflict/client/utils.gen.ts index a47509522..b9ec3cdd6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/internal-name-conflict/client/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/internal-name-conflict/client/utils.gen.ts @@ -183,17 +183,27 @@ export const mergeConfigs = (a: Config, b: Config): Config => { return config; }; +const headersEntries = (headers: Headers): Array<[string, string]> => { + const entries: Array<[string, string]> = []; + headers.forEach((value, key) => { + entries.push([key, value]); + }); + return entries; +}; + export const mergeHeaders = ( ...headers: Array['headers'] | undefined> ): Headers => { const mergedHeaders = new Headers(); for (const header of headers) { - if (!header || typeof header !== 'object') { + if (!header) { continue; } const iterator = - header instanceof Headers ? header.entries() : Object.entries(header); + header instanceof Headers + ? headersEntries(header) + : Object.entries(header); for (const [key, value] of iterator) { if (value === null) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/pagination-ref/client/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/pagination-ref/client/utils.gen.ts index a47509522..b9ec3cdd6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/pagination-ref/client/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/pagination-ref/client/utils.gen.ts @@ -183,17 +183,27 @@ export const mergeConfigs = (a: Config, b: Config): Config => { return config; }; +const headersEntries = (headers: Headers): Array<[string, string]> => { + const entries: Array<[string, string]> = []; + headers.forEach((value, key) => { + entries.push([key, value]); + }); + return entries; +}; + export const mergeHeaders = ( ...headers: Array['headers'] | undefined> ): Headers => { const mergedHeaders = new Headers(); for (const header of headers) { - if (!header || typeof header !== 'object') { + if (!header) { continue; } const iterator = - header instanceof Headers ? header.entries() : Object.entries(header); + header instanceof Headers + ? headersEntries(header) + : Object.entries(header); for (const [key, value] of iterator) { if (value === null) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/parameter-explode-false/client/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/parameter-explode-false/client/utils.gen.ts index a47509522..b9ec3cdd6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/parameter-explode-false/client/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/parameter-explode-false/client/utils.gen.ts @@ -183,17 +183,27 @@ export const mergeConfigs = (a: Config, b: Config): Config => { return config; }; +const headersEntries = (headers: Headers): Array<[string, string]> => { + const entries: Array<[string, string]> = []; + headers.forEach((value, key) => { + entries.push([key, value]); + }); + return entries; +}; + export const mergeHeaders = ( ...headers: Array['headers'] | undefined> ): Headers => { const mergedHeaders = new Headers(); for (const header of headers) { - if (!header || typeof header !== 'object') { + if (!header) { continue; } const iterator = - header instanceof Headers ? header.entries() : Object.entries(header); + header instanceof Headers + ? headersEntries(header) + : Object.entries(header); for (const [key, value] of iterator) { if (value === null) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/client-fetch/sdk-nested-classes-instance/client/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/client-fetch/sdk-nested-classes-instance/client/utils.gen.ts index a47509522..b9ec3cdd6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/client-fetch/sdk-nested-classes-instance/client/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/client-fetch/sdk-nested-classes-instance/client/utils.gen.ts @@ -183,17 +183,27 @@ export const mergeConfigs = (a: Config, b: Config): Config => { return config; }; +const headersEntries = (headers: Headers): Array<[string, string]> => { + const entries: Array<[string, string]> = []; + headers.forEach((value, key) => { + entries.push([key, value]); + }); + return entries; +}; + export const mergeHeaders = ( ...headers: Array['headers'] | undefined> ): Headers => { const mergedHeaders = new Headers(); for (const header of headers) { - if (!header || typeof header !== 'object') { + if (!header) { continue; } const iterator = - header instanceof Headers ? header.entries() : Object.entries(header); + header instanceof Headers + ? headersEntries(header) + : Object.entries(header); for (const [key, value] of iterator) { if (value === null) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/client-fetch/sdk-nested-classes/client/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/client-fetch/sdk-nested-classes/client/utils.gen.ts index a47509522..b9ec3cdd6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/client-fetch/sdk-nested-classes/client/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/client-fetch/sdk-nested-classes/client/utils.gen.ts @@ -183,17 +183,27 @@ export const mergeConfigs = (a: Config, b: Config): Config => { return config; }; +const headersEntries = (headers: Headers): Array<[string, string]> => { + const entries: Array<[string, string]> = []; + headers.forEach((value, key) => { + entries.push([key, value]); + }); + return entries; +}; + export const mergeHeaders = ( ...headers: Array['headers'] | undefined> ): Headers => { const mergedHeaders = new Headers(); for (const header of headers) { - if (!header || typeof header !== 'object') { + if (!header) { continue; } const iterator = - header instanceof Headers ? header.entries() : Object.entries(header); + header instanceof Headers + ? headersEntries(header) + : Object.entries(header); for (const [key, value] of iterator) { if (value === null) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/sdk/default/client/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/sdk/default/client/utils.gen.ts index a47509522..b9ec3cdd6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/sdk/default/client/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/sdk/default/client/utils.gen.ts @@ -183,17 +183,27 @@ export const mergeConfigs = (a: Config, b: Config): Config => { return config; }; +const headersEntries = (headers: Headers): Array<[string, string]> => { + const entries: Array<[string, string]> = []; + headers.forEach((value, key) => { + entries.push([key, value]); + }); + return entries; +}; + export const mergeHeaders = ( ...headers: Array['headers'] | undefined> ): Headers => { const mergedHeaders = new Headers(); for (const header of headers) { - if (!header || typeof header !== 'object') { + if (!header) { continue; } const iterator = - header instanceof Headers ? header.entries() : Object.entries(header); + header instanceof Headers + ? headersEntries(header) + : Object.entries(header); for (const [key, value] of iterator) { if (value === null) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/sdk/instance/client/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/sdk/instance/client/utils.gen.ts index a47509522..b9ec3cdd6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/sdk/instance/client/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/sdk/instance/client/utils.gen.ts @@ -183,17 +183,27 @@ export const mergeConfigs = (a: Config, b: Config): Config => { return config; }; +const headersEntries = (headers: Headers): Array<[string, string]> => { + const entries: Array<[string, string]> = []; + headers.forEach((value, key) => { + entries.push([key, value]); + }); + return entries; +}; + export const mergeHeaders = ( ...headers: Array['headers'] | undefined> ): Headers => { const mergedHeaders = new Headers(); for (const header of headers) { - if (!header || typeof header !== 'object') { + if (!header) { continue; } const iterator = - header instanceof Headers ? header.entries() : Object.entries(header); + header instanceof Headers + ? headersEntries(header) + : Object.entries(header); for (const [key, value] of iterator) { if (value === null) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/sdk/throwOnError/client/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/sdk/throwOnError/client/utils.gen.ts index a47509522..b9ec3cdd6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/sdk/throwOnError/client/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/sdk/throwOnError/client/utils.gen.ts @@ -183,17 +183,27 @@ export const mergeConfigs = (a: Config, b: Config): Config => { return config; }; +const headersEntries = (headers: Headers): Array<[string, string]> => { + const entries: Array<[string, string]> = []; + headers.forEach((value, key) => { + entries.push([key, value]); + }); + return entries; +}; + export const mergeHeaders = ( ...headers: Array['headers'] | undefined> ): Headers => { const mergedHeaders = new Headers(); for (const header of headers) { - if (!header || typeof header !== 'object') { + if (!header) { continue; } const iterator = - header instanceof Headers ? header.entries() : Object.entries(header); + header instanceof Headers + ? headersEntries(header) + : Object.entries(header); for (const [key, value] of iterator) { if (value === null) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/transformers/type-format-valibot/client/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/transformers/type-format-valibot/client/utils.gen.ts index a47509522..b9ec3cdd6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/transformers/type-format-valibot/client/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/transformers/type-format-valibot/client/utils.gen.ts @@ -183,17 +183,27 @@ export const mergeConfigs = (a: Config, b: Config): Config => { return config; }; +const headersEntries = (headers: Headers): Array<[string, string]> => { + const entries: Array<[string, string]> = []; + headers.forEach((value, key) => { + entries.push([key, value]); + }); + return entries; +}; + export const mergeHeaders = ( ...headers: Array['headers'] | undefined> ): Headers => { const mergedHeaders = new Headers(); for (const header of headers) { - if (!header || typeof header !== 'object') { + if (!header) { continue; } const iterator = - header instanceof Headers ? header.entries() : Object.entries(header); + header instanceof Headers + ? headersEntries(header) + : Object.entries(header); for (const [key, value] of iterator) { if (value === null) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/transformers/type-format-zod/client/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/transformers/type-format-zod/client/utils.gen.ts index a47509522..b9ec3cdd6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/transformers/type-format-zod/client/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/transformers/type-format-zod/client/utils.gen.ts @@ -183,17 +183,27 @@ export const mergeConfigs = (a: Config, b: Config): Config => { return config; }; +const headersEntries = (headers: Headers): Array<[string, string]> => { + const entries: Array<[string, string]> = []; + headers.forEach((value, key) => { + entries.push([key, value]); + }); + return entries; +}; + export const mergeHeaders = ( ...headers: Array['headers'] | undefined> ): Headers => { const mergedHeaders = new Headers(); for (const header of headers) { - if (!header || typeof header !== 'object') { + if (!header) { continue; } const iterator = - header instanceof Headers ? header.entries() : Object.entries(header); + header instanceof Headers + ? headersEntries(header) + : Object.entries(header); for (const [key, value] of iterator) { if (value === null) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/typescript/transforms-read-write-custom-name/client/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/typescript/transforms-read-write-custom-name/client/utils.gen.ts index a47509522..b9ec3cdd6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/typescript/transforms-read-write-custom-name/client/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/typescript/transforms-read-write-custom-name/client/utils.gen.ts @@ -183,17 +183,27 @@ export const mergeConfigs = (a: Config, b: Config): Config => { return config; }; +const headersEntries = (headers: Headers): Array<[string, string]> => { + const entries: Array<[string, string]> = []; + headers.forEach((value, key) => { + entries.push([key, value]); + }); + return entries; +}; + export const mergeHeaders = ( ...headers: Array['headers'] | undefined> ): Headers => { const mergedHeaders = new Headers(); for (const header of headers) { - if (!header || typeof header !== 'object') { + if (!header) { continue; } const iterator = - header instanceof Headers ? header.entries() : Object.entries(header); + header instanceof Headers + ? headersEntries(header) + : Object.entries(header); for (const [key, value] of iterator) { if (value === null) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/typescript/transforms-read-write-ignore/client/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/typescript/transforms-read-write-ignore/client/utils.gen.ts index a47509522..b9ec3cdd6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/typescript/transforms-read-write-ignore/client/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/typescript/transforms-read-write-ignore/client/utils.gen.ts @@ -183,17 +183,27 @@ export const mergeConfigs = (a: Config, b: Config): Config => { return config; }; +const headersEntries = (headers: Headers): Array<[string, string]> => { + const entries: Array<[string, string]> = []; + headers.forEach((value, key) => { + entries.push([key, value]); + }); + return entries; +}; + export const mergeHeaders = ( ...headers: Array['headers'] | undefined> ): Headers => { const mergedHeaders = new Headers(); for (const header of headers) { - if (!header || typeof header !== 'object') { + if (!header) { continue; } const iterator = - header instanceof Headers ? header.entries() : Object.entries(header); + header instanceof Headers + ? headersEntries(header) + : Object.entries(header); for (const [key, value] of iterator) { if (value === null) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@pinia/colada/fetch/client/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@pinia/colada/fetch/client/utils.gen.ts index a47509522..b9ec3cdd6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@pinia/colada/fetch/client/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@pinia/colada/fetch/client/utils.gen.ts @@ -183,17 +183,27 @@ export const mergeConfigs = (a: Config, b: Config): Config => { return config; }; +const headersEntries = (headers: Headers): Array<[string, string]> => { + const entries: Array<[string, string]> = []; + headers.forEach((value, key) => { + entries.push([key, value]); + }); + return entries; +}; + export const mergeHeaders = ( ...headers: Array['headers'] | undefined> ): Headers => { const mergedHeaders = new Headers(); for (const header of headers) { - if (!header || typeof header !== 'object') { + if (!header) { continue; } const iterator = - header instanceof Headers ? header.entries() : Object.entries(header); + header instanceof Headers + ? headersEntries(header) + : Object.entries(header); for (const [key, value] of iterator) { if (value === null) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@pinia/colada/group-by-tag/client/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@pinia/colada/group-by-tag/client/utils.gen.ts index a47509522..b9ec3cdd6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@pinia/colada/group-by-tag/client/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@pinia/colada/group-by-tag/client/utils.gen.ts @@ -183,17 +183,27 @@ export const mergeConfigs = (a: Config, b: Config): Config => { return config; }; +const headersEntries = (headers: Headers): Array<[string, string]> => { + const entries: Array<[string, string]> = []; + headers.forEach((value, key) => { + entries.push([key, value]); + }); + return entries; +}; + export const mergeHeaders = ( ...headers: Array['headers'] | undefined> ): Headers => { const mergedHeaders = new Headers(); for (const header of headers) { - if (!header || typeof header !== 'object') { + if (!header) { continue; } const iterator = - header instanceof Headers ? header.entries() : Object.entries(header); + header instanceof Headers + ? headersEntries(header) + : Object.entries(header); for (const [key, value] of iterator) { if (value === null) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/angular-query-experimental/asClass/client/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/angular-query-experimental/asClass/client/utils.gen.ts index a47509522..b9ec3cdd6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/angular-query-experimental/asClass/client/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/angular-query-experimental/asClass/client/utils.gen.ts @@ -183,17 +183,27 @@ export const mergeConfigs = (a: Config, b: Config): Config => { return config; }; +const headersEntries = (headers: Headers): Array<[string, string]> => { + const entries: Array<[string, string]> = []; + headers.forEach((value, key) => { + entries.push([key, value]); + }); + return entries; +}; + export const mergeHeaders = ( ...headers: Array['headers'] | undefined> ): Headers => { const mergedHeaders = new Headers(); for (const header of headers) { - if (!header || typeof header !== 'object') { + if (!header) { continue; } const iterator = - header instanceof Headers ? header.entries() : Object.entries(header); + header instanceof Headers + ? headersEntries(header) + : Object.entries(header); for (const [key, value] of iterator) { if (value === null) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/angular-query-experimental/fetch/client/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/angular-query-experimental/fetch/client/utils.gen.ts index a47509522..b9ec3cdd6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/angular-query-experimental/fetch/client/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/angular-query-experimental/fetch/client/utils.gen.ts @@ -183,17 +183,27 @@ export const mergeConfigs = (a: Config, b: Config): Config => { return config; }; +const headersEntries = (headers: Headers): Array<[string, string]> => { + const entries: Array<[string, string]> = []; + headers.forEach((value, key) => { + entries.push([key, value]); + }); + return entries; +}; + export const mergeHeaders = ( ...headers: Array['headers'] | undefined> ): Headers => { const mergedHeaders = new Headers(); for (const header of headers) { - if (!header || typeof header !== 'object') { + if (!header) { continue; } const iterator = - header instanceof Headers ? header.entries() : Object.entries(header); + header instanceof Headers + ? headersEntries(header) + : Object.entries(header); for (const [key, value] of iterator) { if (value === null) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/angular-query-experimental/name-builder/client/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/angular-query-experimental/name-builder/client/utils.gen.ts index a47509522..b9ec3cdd6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/angular-query-experimental/name-builder/client/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/angular-query-experimental/name-builder/client/utils.gen.ts @@ -183,17 +183,27 @@ export const mergeConfigs = (a: Config, b: Config): Config => { return config; }; +const headersEntries = (headers: Headers): Array<[string, string]> => { + const entries: Array<[string, string]> = []; + headers.forEach((value, key) => { + entries.push([key, value]); + }); + return entries; +}; + export const mergeHeaders = ( ...headers: Array['headers'] | undefined> ): Headers => { const mergedHeaders = new Headers(); for (const header of headers) { - if (!header || typeof header !== 'object') { + if (!header) { continue; } const iterator = - header instanceof Headers ? header.entries() : Object.entries(header); + header instanceof Headers + ? headersEntries(header) + : Object.entries(header); for (const [key, value] of iterator) { if (value === null) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/react-query/asClass/client/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/react-query/asClass/client/utils.gen.ts index a47509522..b9ec3cdd6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/react-query/asClass/client/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/react-query/asClass/client/utils.gen.ts @@ -183,17 +183,27 @@ export const mergeConfigs = (a: Config, b: Config): Config => { return config; }; +const headersEntries = (headers: Headers): Array<[string, string]> => { + const entries: Array<[string, string]> = []; + headers.forEach((value, key) => { + entries.push([key, value]); + }); + return entries; +}; + export const mergeHeaders = ( ...headers: Array['headers'] | undefined> ): Headers => { const mergedHeaders = new Headers(); for (const header of headers) { - if (!header || typeof header !== 'object') { + if (!header) { continue; } const iterator = - header instanceof Headers ? header.entries() : Object.entries(header); + header instanceof Headers + ? headersEntries(header) + : Object.entries(header); for (const [key, value] of iterator) { if (value === null) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/react-query/fetch/client/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/react-query/fetch/client/utils.gen.ts index a47509522..b9ec3cdd6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/react-query/fetch/client/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/react-query/fetch/client/utils.gen.ts @@ -183,17 +183,27 @@ export const mergeConfigs = (a: Config, b: Config): Config => { return config; }; +const headersEntries = (headers: Headers): Array<[string, string]> => { + const entries: Array<[string, string]> = []; + headers.forEach((value, key) => { + entries.push([key, value]); + }); + return entries; +}; + export const mergeHeaders = ( ...headers: Array['headers'] | undefined> ): Headers => { const mergedHeaders = new Headers(); for (const header of headers) { - if (!header || typeof header !== 'object') { + if (!header) { continue; } const iterator = - header instanceof Headers ? header.entries() : Object.entries(header); + header instanceof Headers + ? headersEntries(header) + : Object.entries(header); for (const [key, value] of iterator) { if (value === null) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/react-query/name-builder/client/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/react-query/name-builder/client/utils.gen.ts index a47509522..b9ec3cdd6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/react-query/name-builder/client/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/react-query/name-builder/client/utils.gen.ts @@ -183,17 +183,27 @@ export const mergeConfigs = (a: Config, b: Config): Config => { return config; }; +const headersEntries = (headers: Headers): Array<[string, string]> => { + const entries: Array<[string, string]> = []; + headers.forEach((value, key) => { + entries.push([key, value]); + }); + return entries; +}; + export const mergeHeaders = ( ...headers: Array['headers'] | undefined> ): Headers => { const mergedHeaders = new Headers(); for (const header of headers) { - if (!header || typeof header !== 'object') { + if (!header) { continue; } const iterator = - header instanceof Headers ? header.entries() : Object.entries(header); + header instanceof Headers + ? headersEntries(header) + : Object.entries(header); for (const [key, value] of iterator) { if (value === null) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/solid-query/asClass/client/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/solid-query/asClass/client/utils.gen.ts index a47509522..b9ec3cdd6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/solid-query/asClass/client/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/solid-query/asClass/client/utils.gen.ts @@ -183,17 +183,27 @@ export const mergeConfigs = (a: Config, b: Config): Config => { return config; }; +const headersEntries = (headers: Headers): Array<[string, string]> => { + const entries: Array<[string, string]> = []; + headers.forEach((value, key) => { + entries.push([key, value]); + }); + return entries; +}; + export const mergeHeaders = ( ...headers: Array['headers'] | undefined> ): Headers => { const mergedHeaders = new Headers(); for (const header of headers) { - if (!header || typeof header !== 'object') { + if (!header) { continue; } const iterator = - header instanceof Headers ? header.entries() : Object.entries(header); + header instanceof Headers + ? headersEntries(header) + : Object.entries(header); for (const [key, value] of iterator) { if (value === null) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/solid-query/fetch/client/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/solid-query/fetch/client/utils.gen.ts index a47509522..b9ec3cdd6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/solid-query/fetch/client/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/solid-query/fetch/client/utils.gen.ts @@ -183,17 +183,27 @@ export const mergeConfigs = (a: Config, b: Config): Config => { return config; }; +const headersEntries = (headers: Headers): Array<[string, string]> => { + const entries: Array<[string, string]> = []; + headers.forEach((value, key) => { + entries.push([key, value]); + }); + return entries; +}; + export const mergeHeaders = ( ...headers: Array['headers'] | undefined> ): Headers => { const mergedHeaders = new Headers(); for (const header of headers) { - if (!header || typeof header !== 'object') { + if (!header) { continue; } const iterator = - header instanceof Headers ? header.entries() : Object.entries(header); + header instanceof Headers + ? headersEntries(header) + : Object.entries(header); for (const [key, value] of iterator) { if (value === null) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/solid-query/name-builder/client/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/solid-query/name-builder/client/utils.gen.ts index a47509522..b9ec3cdd6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/solid-query/name-builder/client/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/solid-query/name-builder/client/utils.gen.ts @@ -183,17 +183,27 @@ export const mergeConfigs = (a: Config, b: Config): Config => { return config; }; +const headersEntries = (headers: Headers): Array<[string, string]> => { + const entries: Array<[string, string]> = []; + headers.forEach((value, key) => { + entries.push([key, value]); + }); + return entries; +}; + export const mergeHeaders = ( ...headers: Array['headers'] | undefined> ): Headers => { const mergedHeaders = new Headers(); for (const header of headers) { - if (!header || typeof header !== 'object') { + if (!header) { continue; } const iterator = - header instanceof Headers ? header.entries() : Object.entries(header); + header instanceof Headers + ? headersEntries(header) + : Object.entries(header); for (const [key, value] of iterator) { if (value === null) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/svelte-query/asClass/client/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/svelte-query/asClass/client/utils.gen.ts index a47509522..b9ec3cdd6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/svelte-query/asClass/client/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/svelte-query/asClass/client/utils.gen.ts @@ -183,17 +183,27 @@ export const mergeConfigs = (a: Config, b: Config): Config => { return config; }; +const headersEntries = (headers: Headers): Array<[string, string]> => { + const entries: Array<[string, string]> = []; + headers.forEach((value, key) => { + entries.push([key, value]); + }); + return entries; +}; + export const mergeHeaders = ( ...headers: Array['headers'] | undefined> ): Headers => { const mergedHeaders = new Headers(); for (const header of headers) { - if (!header || typeof header !== 'object') { + if (!header) { continue; } const iterator = - header instanceof Headers ? header.entries() : Object.entries(header); + header instanceof Headers + ? headersEntries(header) + : Object.entries(header); for (const [key, value] of iterator) { if (value === null) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/svelte-query/fetch/client/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/svelte-query/fetch/client/utils.gen.ts index a47509522..b9ec3cdd6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/svelte-query/fetch/client/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/svelte-query/fetch/client/utils.gen.ts @@ -183,17 +183,27 @@ export const mergeConfigs = (a: Config, b: Config): Config => { return config; }; +const headersEntries = (headers: Headers): Array<[string, string]> => { + const entries: Array<[string, string]> = []; + headers.forEach((value, key) => { + entries.push([key, value]); + }); + return entries; +}; + export const mergeHeaders = ( ...headers: Array['headers'] | undefined> ): Headers => { const mergedHeaders = new Headers(); for (const header of headers) { - if (!header || typeof header !== 'object') { + if (!header) { continue; } const iterator = - header instanceof Headers ? header.entries() : Object.entries(header); + header instanceof Headers + ? headersEntries(header) + : Object.entries(header); for (const [key, value] of iterator) { if (value === null) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/svelte-query/name-builder/client/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/svelte-query/name-builder/client/utils.gen.ts index a47509522..b9ec3cdd6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/svelte-query/name-builder/client/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/svelte-query/name-builder/client/utils.gen.ts @@ -183,17 +183,27 @@ export const mergeConfigs = (a: Config, b: Config): Config => { return config; }; +const headersEntries = (headers: Headers): Array<[string, string]> => { + const entries: Array<[string, string]> = []; + headers.forEach((value, key) => { + entries.push([key, value]); + }); + return entries; +}; + export const mergeHeaders = ( ...headers: Array['headers'] | undefined> ): Headers => { const mergedHeaders = new Headers(); for (const header of headers) { - if (!header || typeof header !== 'object') { + if (!header) { continue; } const iterator = - header instanceof Headers ? header.entries() : Object.entries(header); + header instanceof Headers + ? headersEntries(header) + : Object.entries(header); for (const [key, value] of iterator) { if (value === null) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/vue-query/asClass/client/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/vue-query/asClass/client/utils.gen.ts index a47509522..b9ec3cdd6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/vue-query/asClass/client/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/vue-query/asClass/client/utils.gen.ts @@ -183,17 +183,27 @@ export const mergeConfigs = (a: Config, b: Config): Config => { return config; }; +const headersEntries = (headers: Headers): Array<[string, string]> => { + const entries: Array<[string, string]> = []; + headers.forEach((value, key) => { + entries.push([key, value]); + }); + return entries; +}; + export const mergeHeaders = ( ...headers: Array['headers'] | undefined> ): Headers => { const mergedHeaders = new Headers(); for (const header of headers) { - if (!header || typeof header !== 'object') { + if (!header) { continue; } const iterator = - header instanceof Headers ? header.entries() : Object.entries(header); + header instanceof Headers + ? headersEntries(header) + : Object.entries(header); for (const [key, value] of iterator) { if (value === null) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/vue-query/fetch/client/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/vue-query/fetch/client/utils.gen.ts index a47509522..b9ec3cdd6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/vue-query/fetch/client/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/vue-query/fetch/client/utils.gen.ts @@ -183,17 +183,27 @@ export const mergeConfigs = (a: Config, b: Config): Config => { return config; }; +const headersEntries = (headers: Headers): Array<[string, string]> => { + const entries: Array<[string, string]> = []; + headers.forEach((value, key) => { + entries.push([key, value]); + }); + return entries; +}; + export const mergeHeaders = ( ...headers: Array['headers'] | undefined> ): Headers => { const mergedHeaders = new Headers(); for (const header of headers) { - if (!header || typeof header !== 'object') { + if (!header) { continue; } const iterator = - header instanceof Headers ? header.entries() : Object.entries(header); + header instanceof Headers + ? headersEntries(header) + : Object.entries(header); for (const [key, value] of iterator) { if (value === null) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/vue-query/name-builder/client/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/vue-query/name-builder/client/utils.gen.ts index a47509522..b9ec3cdd6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/vue-query/name-builder/client/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/vue-query/name-builder/client/utils.gen.ts @@ -183,17 +183,27 @@ export const mergeConfigs = (a: Config, b: Config): Config => { return config; }; +const headersEntries = (headers: Headers): Array<[string, string]> => { + const entries: Array<[string, string]> = []; + headers.forEach((value, key) => { + entries.push([key, value]); + }); + return entries; +}; + export const mergeHeaders = ( ...headers: Array['headers'] | undefined> ): Headers => { const mergedHeaders = new Headers(); for (const header of headers) { - if (!header || typeof header !== 'object') { + if (!header) { continue; } const iterator = - header instanceof Headers ? header.entries() : Object.entries(header); + header instanceof Headers + ? headersEntries(header) + : Object.entries(header); for (const [key, value] of iterator) { if (value === null) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-api-key/client/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-api-key/client/utils.gen.ts index a47509522..b9ec3cdd6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-api-key/client/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-api-key/client/utils.gen.ts @@ -183,17 +183,27 @@ export const mergeConfigs = (a: Config, b: Config): Config => { return config; }; +const headersEntries = (headers: Headers): Array<[string, string]> => { + const entries: Array<[string, string]> = []; + headers.forEach((value, key) => { + entries.push([key, value]); + }); + return entries; +}; + export const mergeHeaders = ( ...headers: Array['headers'] | undefined> ): Headers => { const mergedHeaders = new Headers(); for (const header of headers) { - if (!header || typeof header !== 'object') { + if (!header) { continue; } const iterator = - header instanceof Headers ? header.entries() : Object.entries(header); + header instanceof Headers + ? headersEntries(header) + : Object.entries(header); for (const [key, value] of iterator) { if (value === null) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-false/client/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-false/client/utils.gen.ts index a47509522..b9ec3cdd6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-false/client/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-false/client/utils.gen.ts @@ -183,17 +183,27 @@ export const mergeConfigs = (a: Config, b: Config): Config => { return config; }; +const headersEntries = (headers: Headers): Array<[string, string]> => { + const entries: Array<[string, string]> = []; + headers.forEach((value, key) => { + entries.push([key, value]); + }); + return entries; +}; + export const mergeHeaders = ( ...headers: Array['headers'] | undefined> ): Headers => { const mergedHeaders = new Headers(); for (const header of headers) { - if (!header || typeof header !== 'object') { + if (!header) { continue; } const iterator = - header instanceof Headers ? header.entries() : Object.entries(header); + header instanceof Headers + ? headersEntries(header) + : Object.entries(header); for (const [key, value] of iterator) { if (value === null) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-http-bearer/client/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-http-bearer/client/utils.gen.ts index a47509522..b9ec3cdd6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-http-bearer/client/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-http-bearer/client/utils.gen.ts @@ -183,17 +183,27 @@ export const mergeConfigs = (a: Config, b: Config): Config => { return config; }; +const headersEntries = (headers: Headers): Array<[string, string]> => { + const entries: Array<[string, string]> = []; + headers.forEach((value, key) => { + entries.push([key, value]); + }); + return entries; +}; + export const mergeHeaders = ( ...headers: Array['headers'] | undefined> ): Headers => { const mergedHeaders = new Headers(); for (const header of headers) { - if (!header || typeof header !== 'object') { + if (!header) { continue; } const iterator = - header instanceof Headers ? header.entries() : Object.entries(header); + header instanceof Headers + ? headersEntries(header) + : Object.entries(header); for (const [key, value] of iterator) { if (value === null) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-oauth2/client/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-oauth2/client/utils.gen.ts index a47509522..b9ec3cdd6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-oauth2/client/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-oauth2/client/utils.gen.ts @@ -183,17 +183,27 @@ export const mergeConfigs = (a: Config, b: Config): Config => { return config; }; +const headersEntries = (headers: Headers): Array<[string, string]> => { + const entries: Array<[string, string]> = []; + headers.forEach((value, key) => { + entries.push([key, value]); + }); + return entries; +}; + export const mergeHeaders = ( ...headers: Array['headers'] | undefined> ): Headers => { const mergedHeaders = new Headers(); for (const header of headers) { - if (!header || typeof header !== 'object') { + if (!header) { continue; } const iterator = - header instanceof Headers ? header.entries() : Object.entries(header); + header instanceof Headers + ? headersEntries(header) + : Object.entries(header); for (const [key, value] of iterator) { if (value === null) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-open-id-connect/client/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-open-id-connect/client/utils.gen.ts index a47509522..b9ec3cdd6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-open-id-connect/client/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-open-id-connect/client/utils.gen.ts @@ -183,17 +183,27 @@ export const mergeConfigs = (a: Config, b: Config): Config => { return config; }; +const headersEntries = (headers: Headers): Array<[string, string]> => { + const entries: Array<[string, string]> = []; + headers.forEach((value, key) => { + entries.push([key, value]); + }); + return entries; +}; + export const mergeHeaders = ( ...headers: Array['headers'] | undefined> ): Headers => { const mergedHeaders = new Headers(); for (const header of headers) { - if (!header || typeof header !== 'object') { + if (!header) { continue; } const iterator = - header instanceof Headers ? header.entries() : Object.entries(header); + header instanceof Headers + ? headersEntries(header) + : Object.entries(header); for (const [key, value] of iterator) { if (value === null) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/servers/client/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/servers/client/utils.gen.ts index a47509522..b9ec3cdd6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/servers/client/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/servers/client/utils.gen.ts @@ -183,17 +183,27 @@ export const mergeConfigs = (a: Config, b: Config): Config => { return config; }; +const headersEntries = (headers: Headers): Array<[string, string]> => { + const entries: Array<[string, string]> = []; + headers.forEach((value, key) => { + entries.push([key, value]); + }); + return entries; +}; + export const mergeHeaders = ( ...headers: Array['headers'] | undefined> ): Headers => { const mergedHeaders = new Headers(); for (const header of headers) { - if (!header || typeof header !== 'object') { + if (!header) { continue; } const iterator = - header instanceof Headers ? header.entries() : Object.entries(header); + header instanceof Headers + ? headersEntries(header) + : Object.entries(header); for (const [key, value] of iterator) { if (value === null) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-fetch/client/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-fetch/client/utils.gen.ts index a47509522..b9ec3cdd6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-fetch/client/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-fetch/client/utils.gen.ts @@ -183,17 +183,27 @@ export const mergeConfigs = (a: Config, b: Config): Config => { return config; }; +const headersEntries = (headers: Headers): Array<[string, string]> => { + const entries: Array<[string, string]> = []; + headers.forEach((value, key) => { + entries.push([key, value]); + }); + return entries; +}; + export const mergeHeaders = ( ...headers: Array['headers'] | undefined> ): Headers => { const mergedHeaders = new Headers(); for (const header of headers) { - if (!header || typeof header !== 'object') { + if (!header) { continue; } const iterator = - header instanceof Headers ? header.entries() : Object.entries(header); + header instanceof Headers + ? headersEntries(header) + : Object.entries(header); for (const [key, value] of iterator) { if (value === null) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-next/client/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-next/client/utils.gen.ts index e7ec4bdab..f3cd764fc 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-next/client/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-next/client/utils.gen.ts @@ -295,6 +295,14 @@ export const mergeConfigs = (a: Config, b: Config): Config => { return config; }; +const headersEntries = (headers: Headers): Array<[string, string]> => { + const entries: Array<[string, string]> = []; + headers.forEach((value, key) => { + entries.push([key, value]); + }); + return entries; +}; + export const mergeHeaders = ( ...headers: Array['headers'] | undefined> ): Headers => { @@ -305,7 +313,9 @@ export const mergeHeaders = ( } const iterator = - header instanceof Headers ? header.entries() : Object.entries(header); + header instanceof Headers + ? headersEntries(header) + : Object.entries(header); for (const [key, value] of iterator) { if (value === null) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-nuxt/client/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-nuxt/client/utils.gen.ts index 805978a9a..0a1d343e2 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-nuxt/client/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-nuxt/client/utils.gen.ts @@ -252,6 +252,14 @@ export const mergeConfigs = (a: Config, b: Config): Config => { return config; }; +const headersEntries = (headers: Headers): Array<[string, string]> => { + const entries: Array<[string, string]> = []; + headers.forEach((value, key) => { + entries.push([key, value]); + }); + return entries; +}; + export const mergeHeaders = ( ...headers: Array['headers'] | undefined> ): Headers => { @@ -268,7 +276,7 @@ export const mergeHeaders = ( const iterator = h instanceof Headers - ? h.entries() + ? headersEntries(h) : Object.entries(h as Record); for (const [key, value] of iterator) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-all-of/client/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-all-of/client/utils.gen.ts index a47509522..b9ec3cdd6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-all-of/client/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-all-of/client/utils.gen.ts @@ -183,17 +183,27 @@ export const mergeConfigs = (a: Config, b: Config): Config => { return config; }; +const headersEntries = (headers: Headers): Array<[string, string]> => { + const entries: Array<[string, string]> = []; + headers.forEach((value, key) => { + entries.push([key, value]); + }); + return entries; +}; + export const mergeHeaders = ( ...headers: Array['headers'] | undefined> ): Headers => { const mergedHeaders = new Headers(); for (const header of headers) { - if (!header || typeof header !== 'object') { + if (!header) { continue; } const iterator = - header instanceof Headers ? header.entries() : Object.entries(header); + header instanceof Headers + ? headersEntries(header) + : Object.entries(header); for (const [key, value] of iterator) { if (value === null) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-any-of-null/client/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-any-of-null/client/utils.gen.ts index a47509522..b9ec3cdd6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-any-of-null/client/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-any-of-null/client/utils.gen.ts @@ -183,17 +183,27 @@ export const mergeConfigs = (a: Config, b: Config): Config => { return config; }; +const headersEntries = (headers: Headers): Array<[string, string]> => { + const entries: Array<[string, string]> = []; + headers.forEach((value, key) => { + entries.push([key, value]); + }); + return entries; +}; + export const mergeHeaders = ( ...headers: Array['headers'] | undefined> ): Headers => { const mergedHeaders = new Headers(); for (const header of headers) { - if (!header || typeof header !== 'object') { + if (!header) { continue; } const iterator = - header instanceof Headers ? header.entries() : Object.entries(header); + header instanceof Headers + ? headersEntries(header) + : Object.entries(header); for (const [key, value] of iterator) { if (value === null) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-array/client/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-array/client/utils.gen.ts index a47509522..b9ec3cdd6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-array/client/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-array/client/utils.gen.ts @@ -183,17 +183,27 @@ export const mergeConfigs = (a: Config, b: Config): Config => { return config; }; +const headersEntries = (headers: Headers): Array<[string, string]> => { + const entries: Array<[string, string]> = []; + headers.forEach((value, key) => { + entries.push([key, value]); + }); + return entries; +}; + export const mergeHeaders = ( ...headers: Array['headers'] | undefined> ): Headers => { const mergedHeaders = new Headers(); for (const header of headers) { - if (!header || typeof header !== 'object') { + if (!header) { continue; } const iterator = - header instanceof Headers ? header.entries() : Object.entries(header); + header instanceof Headers + ? headersEntries(header) + : Object.entries(header); for (const [key, value] of iterator) { if (value === null) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transforms-read-write/client/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transforms-read-write/client/utils.gen.ts index a47509522..b9ec3cdd6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transforms-read-write/client/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transforms-read-write/client/utils.gen.ts @@ -183,17 +183,27 @@ export const mergeConfigs = (a: Config, b: Config): Config => { return config; }; +const headersEntries = (headers: Headers): Array<[string, string]> => { + const entries: Array<[string, string]> = []; + headers.forEach((value, key) => { + entries.push([key, value]); + }); + return entries; +}; + export const mergeHeaders = ( ...headers: Array['headers'] | undefined> ): Headers => { const mergedHeaders = new Headers(); for (const header of headers) { - if (!header || typeof header !== 'object') { + if (!header) { continue; } const iterator = - header instanceof Headers ? header.entries() : Object.entries(header); + header instanceof Headers + ? headersEntries(header) + : Object.entries(header); for (const [key, value] of iterator) { if (value === null) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/plugins/@tanstack/meta/client/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/plugins/@tanstack/meta/client/utils.gen.ts index a47509522..b9ec3cdd6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/plugins/@tanstack/meta/client/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/plugins/@tanstack/meta/client/utils.gen.ts @@ -183,17 +183,27 @@ export const mergeConfigs = (a: Config, b: Config): Config => { return config; }; +const headersEntries = (headers: Headers): Array<[string, string]> => { + const entries: Array<[string, string]> = []; + headers.forEach((value, key) => { + entries.push([key, value]); + }); + return entries; +}; + export const mergeHeaders = ( ...headers: Array['headers'] | undefined> ): Headers => { const mergedHeaders = new Headers(); for (const header of headers) { - if (!header || typeof header !== 'object') { + if (!header) { continue; } const iterator = - header instanceof Headers ? header.entries() : Object.entries(header); + header instanceof Headers + ? headersEntries(header) + : Object.entries(header); for (const [key, value] of iterator) { if (value === null) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/test/generated/v3_no_index/client/utils.gen.ts.snap b/packages/openapi-ts-tests/main/test/__snapshots__/test/generated/v3_no_index/client/utils.gen.ts.snap index a47509522..b9ec3cdd6 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/test/generated/v3_no_index/client/utils.gen.ts.snap +++ b/packages/openapi-ts-tests/main/test/__snapshots__/test/generated/v3_no_index/client/utils.gen.ts.snap @@ -183,17 +183,27 @@ export const mergeConfigs = (a: Config, b: Config): Config => { return config; }; +const headersEntries = (headers: Headers): Array<[string, string]> => { + const entries: Array<[string, string]> = []; + headers.forEach((value, key) => { + entries.push([key, value]); + }); + return entries; +}; + export const mergeHeaders = ( ...headers: Array['headers'] | undefined> ): Headers => { const mergedHeaders = new Headers(); for (const header of headers) { - if (!header || typeof header !== 'object') { + if (!header) { continue; } const iterator = - header instanceof Headers ? header.entries() : Object.entries(header); + header instanceof Headers + ? headersEntries(header) + : Object.entries(header); for (const [key, value] of iterator) { if (value === null) { -- 2.51.2 From debba72348e450f8dc884223681f10e80da77545 Mon Sep 17 00:00:00 2001 From: Lubos Date: Sun, 7 Sep 2025 18:37:11 +0800 Subject: [PATCH 42/46] Create metal-brooms-yawn.md --- .changeset/metal-brooms-yawn.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/metal-brooms-yawn.md diff --git a/.changeset/metal-brooms-yawn.md b/.changeset/metal-brooms-yawn.md new file mode 100644 index 000000000..b29d04926 --- /dev/null +++ b/.changeset/metal-brooms-yawn.md @@ -0,0 +1,5 @@ +--- +"@hey-api/openapi-ts": patch +--- + +fix(client): `mergeHeaders` functions use `.forEach()` instead of `.entries()` -- 2.51.2 From a542b20c1bf9d73a38e22c8aa12602129224ee0c Mon Sep 17 00:00:00 2001 From: Fransis Young Date: Sun, 7 Sep 2025 10:32:29 -0400 Subject: [PATCH 43/46] chore(client): consolidates serialized body conditions into one block refs: #2604 --- .../plugins/@hey-api/client-core/bundle/utils.ts | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/packages/openapi-ts/src/plugins/@hey-api/client-core/bundle/utils.ts b/packages/openapi-ts/src/plugins/@hey-api/client-core/bundle/utils.ts index 01c88fcee..77c8f2401 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/client-core/bundle/utils.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/client-core/bundle/utils.ts @@ -119,14 +119,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } -- 2.51.2 From 77deab545ff5ea7cc4a511ec4aa5aa049c332292 Mon Sep 17 00:00:00 2001 From: Fransis Young Date: Sun, 7 Sep 2025 10:33:45 -0400 Subject: [PATCH 44/46] test(client): updates snapshots refs: #2604 --- .../body-response-text-plain/core/utils.gen.ts | 13 +++++++------ .../__snapshots__/2.0.x/form-data/core/utils.gen.ts | 13 +++++++------ .../sdk-nested-classes-instance/core/utils.gen.ts | 13 +++++++------ .../sdk-nested-classes/core/utils.gen.ts | 13 +++++++------ .../plugins/@hey-api/sdk/default/core/utils.gen.ts | 13 +++++++------ .../plugins/@hey-api/sdk/instance/core/utils.gen.ts | 13 +++++++------ .../@hey-api/sdk/throwOnError/core/utils.gen.ts | 13 +++++++------ .../type-format-valibot/core/utils.gen.ts | 13 +++++++------ .../transformers/type-format-zod/core/utils.gen.ts | 13 +++++++------ .../core/utils.gen.ts | 13 +++++++------ .../transforms-read-write-ignore/core/utils.gen.ts | 13 +++++++------ .../plugins/@pinia/colada/fetch/core/utils.gen.ts | 13 +++++++------ .../@pinia/colada/group-by-tag/core/utils.gen.ts | 13 +++++++------ .../asClass/core/utils.gen.ts | 13 +++++++------ .../axios/core/utils.gen.ts | 13 +++++++------ .../fetch/core/utils.gen.ts | 13 +++++++------ .../name-builder/core/utils.gen.ts | 13 +++++++------ .../@tanstack/react-query/asClass/core/utils.gen.ts | 13 +++++++------ .../@tanstack/react-query/axios/core/utils.gen.ts | 13 +++++++------ .../@tanstack/react-query/fetch/core/utils.gen.ts | 13 +++++++------ .../react-query/name-builder/core/utils.gen.ts | 13 +++++++------ .../@tanstack/solid-query/asClass/core/utils.gen.ts | 13 +++++++------ .../@tanstack/solid-query/axios/core/utils.gen.ts | 13 +++++++------ .../@tanstack/solid-query/fetch/core/utils.gen.ts | 13 +++++++------ .../solid-query/name-builder/core/utils.gen.ts | 13 +++++++------ .../svelte-query/asClass/core/utils.gen.ts | 13 +++++++------ .../@tanstack/svelte-query/axios/core/utils.gen.ts | 13 +++++++------ .../@tanstack/svelte-query/fetch/core/utils.gen.ts | 13 +++++++------ .../svelte-query/name-builder/core/utils.gen.ts | 13 +++++++------ .../@tanstack/vue-query/asClass/core/utils.gen.ts | 13 +++++++------ .../@tanstack/vue-query/axios/core/utils.gen.ts | 13 +++++++------ .../@tanstack/vue-query/fetch/core/utils.gen.ts | 13 +++++++------ .../vue-query/name-builder/core/utils.gen.ts | 13 +++++++------ .../2.0.x/schema-unknown/core/utils.gen.ts | 13 +++++++------ .../2.0.x/security-api-key/core/utils.gen.ts | 13 +++++++------ .../2.0.x/security-basic/core/utils.gen.ts | 13 +++++++------ .../2.0.x/security-false/core/utils.gen.ts | 13 +++++++------ .../2.0.x/security-oauth2/core/utils.gen.ts | 13 +++++++------ .../2.0.x/servers-base-path/core/utils.gen.ts | 13 +++++++------ .../2.0.x/servers-host/core/utils.gen.ts | 13 +++++++------ .../__snapshots__/2.0.x/servers/core/utils.gen.ts | 13 +++++++------ .../2.0.x/transforms-read-write/core/utils.gen.ts | 13 +++++++------ .../body-response-text-plain/core/utils.gen.ts | 13 +++++++------ .../3.0.x/content-types/core/utils.gen.ts | 13 +++++++------ .../3.0.x/internal-name-conflict/core/utils.gen.ts | 13 +++++++------ .../parameter-explode-false-axios/core/utils.gen.ts | 13 +++++++------ .../3.0.x/parameter-explode-false/core/utils.gen.ts | 13 +++++++------ .../sdk-nested-classes-instance/core/utils.gen.ts | 13 +++++++------ .../sdk-nested-classes/core/utils.gen.ts | 13 +++++++------ .../plugins/@hey-api/sdk/default/core/utils.gen.ts | 13 +++++++------ .../plugins/@hey-api/sdk/instance/core/utils.gen.ts | 13 +++++++------ .../@hey-api/sdk/throwOnError/core/utils.gen.ts | 13 +++++++------ .../type-format-valibot/core/utils.gen.ts | 13 +++++++------ .../transformers/type-format-zod/core/utils.gen.ts | 13 +++++++------ .../core/utils.gen.ts | 13 +++++++------ .../transforms-read-write-ignore/core/utils.gen.ts | 13 +++++++------ .../plugins/@pinia/colada/fetch/core/utils.gen.ts | 13 +++++++------ .../@pinia/colada/group-by-tag/core/utils.gen.ts | 13 +++++++------ .../asClass/core/utils.gen.ts | 13 +++++++------ .../axios/core/utils.gen.ts | 13 +++++++------ .../fetch/core/utils.gen.ts | 13 +++++++------ .../name-builder/core/utils.gen.ts | 13 +++++++------ .../@tanstack/react-query/asClass/core/utils.gen.ts | 13 +++++++------ .../@tanstack/react-query/axios/core/utils.gen.ts | 13 +++++++------ .../@tanstack/react-query/fetch/core/utils.gen.ts | 13 +++++++------ .../react-query/name-builder/core/utils.gen.ts | 13 +++++++------ .../@tanstack/solid-query/asClass/core/utils.gen.ts | 13 +++++++------ .../@tanstack/solid-query/axios/core/utils.gen.ts | 13 +++++++------ .../@tanstack/solid-query/fetch/core/utils.gen.ts | 13 +++++++------ .../solid-query/name-builder/core/utils.gen.ts | 13 +++++++------ .../svelte-query/asClass/core/utils.gen.ts | 13 +++++++------ .../@tanstack/svelte-query/axios/core/utils.gen.ts | 13 +++++++------ .../@tanstack/svelte-query/fetch/core/utils.gen.ts | 13 +++++++------ .../svelte-query/name-builder/core/utils.gen.ts | 13 +++++++------ .../@tanstack/vue-query/asClass/core/utils.gen.ts | 13 +++++++------ .../@tanstack/vue-query/axios/core/utils.gen.ts | 13 +++++++------ .../@tanstack/vue-query/fetch/core/utils.gen.ts | 13 +++++++------ .../vue-query/name-builder/core/utils.gen.ts | 13 +++++++------ .../3.0.x/security-api-key/core/utils.gen.ts | 13 +++++++------ .../3.0.x/security-false/core/utils.gen.ts | 13 +++++++------ .../3.0.x/security-http-bearer/core/utils.gen.ts | 13 +++++++------ .../3.0.x/security-oauth2/core/utils.gen.ts | 13 +++++++------ .../security-open-id-connect/core/utils.gen.ts | 13 +++++++------ .../__snapshots__/3.0.x/servers/core/utils.gen.ts | 13 +++++++------ .../3.0.x/transformers-all-of/core/utils.gen.ts | 13 +++++++------ .../transformers-any-of-null/core/utils.gen.ts | 13 +++++++------ .../3.0.x/transformers-array/core/utils.gen.ts | 13 +++++++------ .../3.0.x/transforms-read-write/core/utils.gen.ts | 13 +++++++------ .../body-response-text-plain/core/utils.gen.ts | 13 +++++++------ .../client-axios/base-url-false/core/utils.gen.ts | 13 +++++++------ .../client-axios/base-url-number/core/utils.gen.ts | 13 +++++++------ .../client-axios/base-url-strict/core/utils.gen.ts | 13 +++++++------ .../client-axios/base-url-string/core/utils.gen.ts | 13 +++++++------ .../client-axios/clean-false/core/utils.gen.ts | 13 +++++++------ .../@hey-api/client-axios/default/core/utils.gen.ts | 13 +++++++------ .../sdk-client-optional/core/utils.gen.ts | 13 +++++++------ .../sdk-client-required/core/utils.gen.ts | 13 +++++++------ .../tsconfig-nodenext-sdk/core/utils.gen.ts | 13 +++++++------ .../client-fetch/base-url-false/core/utils.gen.ts | 13 +++++++------ .../client-fetch/base-url-number/core/utils.gen.ts | 13 +++++++------ .../client-fetch/base-url-strict/core/utils.gen.ts | 13 +++++++------ .../client-fetch/base-url-string/core/utils.gen.ts | 13 +++++++------ .../client-fetch/clean-false/core/utils.gen.ts | 13 +++++++------ .../@hey-api/client-fetch/default/core/utils.gen.ts | 13 +++++++------ .../sdk-client-optional/core/utils.gen.ts | 13 +++++++------ .../sdk-client-required/core/utils.gen.ts | 13 +++++++------ .../tsconfig-nodenext-sdk/core/utils.gen.ts | 13 +++++++------ .../client-next/base-url-false/core/utils.gen.ts | 13 +++++++------ .../client-next/base-url-number/core/utils.gen.ts | 13 +++++++------ .../client-next/base-url-strict/core/utils.gen.ts | 13 +++++++------ .../client-next/base-url-string/core/utils.gen.ts | 13 +++++++------ .../client-next/clean-false/core/utils.gen.ts | 13 +++++++------ .../@hey-api/client-next/default/core/utils.gen.ts | 13 +++++++------ .../sdk-client-optional/core/utils.gen.ts | 13 +++++++------ .../sdk-client-required/core/utils.gen.ts | 13 +++++++------ .../tsconfig-nodenext-sdk/core/utils.gen.ts | 13 +++++++------ .../client-nuxt/base-url-false/core/utils.gen.ts | 13 +++++++------ .../client-nuxt/base-url-number/core/utils.gen.ts | 13 +++++++------ .../client-nuxt/base-url-strict/core/utils.gen.ts | 13 +++++++------ .../client-nuxt/base-url-string/core/utils.gen.ts | 13 +++++++------ .../client-nuxt/clean-false/core/utils.gen.ts | 13 +++++++------ .../@hey-api/client-nuxt/default/core/utils.gen.ts | 13 +++++++------ .../sdk-client-optional/core/utils.gen.ts | 13 +++++++------ .../sdk-client-required/core/utils.gen.ts | 13 +++++++------ .../tsconfig-nodenext-sdk/core/utils.gen.ts | 13 +++++++------ .../3.1.x/content-types/core/utils.gen.ts | 13 +++++++------ .../__snapshots__/3.1.x/headers/core/utils.gen.ts | 13 +++++++------ .../3.1.x/internal-name-conflict/core/utils.gen.ts | 13 +++++++------ .../3.1.x/pagination-ref/core/utils.gen.ts | 13 +++++++------ .../parameter-explode-false-axios/core/utils.gen.ts | 13 +++++++------ .../3.1.x/parameter-explode-false/core/utils.gen.ts | 13 +++++++------ .../sdk-nested-classes-instance/core/utils.gen.ts | 13 +++++++------ .../sdk-nested-classes/core/utils.gen.ts | 13 +++++++------ .../plugins/@hey-api/sdk/default/core/utils.gen.ts | 13 +++++++------ .../plugins/@hey-api/sdk/instance/core/utils.gen.ts | 13 +++++++------ .../@hey-api/sdk/throwOnError/core/utils.gen.ts | 13 +++++++------ .../type-format-valibot/core/utils.gen.ts | 13 +++++++------ .../transformers/type-format-zod/core/utils.gen.ts | 13 +++++++------ .../core/utils.gen.ts | 13 +++++++------ .../transforms-read-write-ignore/core/utils.gen.ts | 13 +++++++------ .../plugins/@pinia/colada/fetch/core/utils.gen.ts | 13 +++++++------ .../@pinia/colada/group-by-tag/core/utils.gen.ts | 13 +++++++------ .../asClass/core/utils.gen.ts | 13 +++++++------ .../axios/core/utils.gen.ts | 13 +++++++------ .../fetch/core/utils.gen.ts | 13 +++++++------ .../name-builder/core/utils.gen.ts | 13 +++++++------ .../@tanstack/react-query/asClass/core/utils.gen.ts | 13 +++++++------ .../@tanstack/react-query/axios/core/utils.gen.ts | 13 +++++++------ .../@tanstack/react-query/fetch/core/utils.gen.ts | 13 +++++++------ .../react-query/name-builder/core/utils.gen.ts | 13 +++++++------ .../@tanstack/solid-query/asClass/core/utils.gen.ts | 13 +++++++------ .../@tanstack/solid-query/axios/core/utils.gen.ts | 13 +++++++------ .../@tanstack/solid-query/fetch/core/utils.gen.ts | 13 +++++++------ .../solid-query/name-builder/core/utils.gen.ts | 13 +++++++------ .../svelte-query/asClass/core/utils.gen.ts | 13 +++++++------ .../@tanstack/svelte-query/axios/core/utils.gen.ts | 13 +++++++------ .../@tanstack/svelte-query/fetch/core/utils.gen.ts | 13 +++++++------ .../svelte-query/name-builder/core/utils.gen.ts | 13 +++++++------ .../@tanstack/vue-query/asClass/core/utils.gen.ts | 13 +++++++------ .../@tanstack/vue-query/axios/core/utils.gen.ts | 13 +++++++------ .../@tanstack/vue-query/fetch/core/utils.gen.ts | 13 +++++++------ .../vue-query/name-builder/core/utils.gen.ts | 13 +++++++------ .../3.1.x/security-api-key/core/utils.gen.ts | 13 +++++++------ .../3.1.x/security-false/core/utils.gen.ts | 13 +++++++------ .../3.1.x/security-http-bearer/core/utils.gen.ts | 13 +++++++------ .../3.1.x/security-oauth2/core/utils.gen.ts | 13 +++++++------ .../security-open-id-connect/core/utils.gen.ts | 13 +++++++------ .../__snapshots__/3.1.x/servers/core/utils.gen.ts | 13 +++++++------ .../3.1.x/sse-angular/core/utils.gen.ts | 13 +++++++------ .../__snapshots__/3.1.x/sse-axios/core/utils.gen.ts | 13 +++++++------ .../__snapshots__/3.1.x/sse-fetch/core/utils.gen.ts | 13 +++++++------ .../__snapshots__/3.1.x/sse-next/core/utils.gen.ts | 13 +++++++------ .../__snapshots__/3.1.x/sse-nuxt/core/utils.gen.ts | 13 +++++++------ .../3.1.x/transformers-all-of/core/utils.gen.ts | 13 +++++++------ .../transformers-any-of-null/core/utils.gen.ts | 13 +++++++------ .../3.1.x/transformers-array/core/utils.gen.ts | 13 +++++++------ .../3.1.x/transforms-read-write/core/utils.gen.ts | 13 +++++++------ .../plugins/@tanstack/meta/core/utils.gen.ts | 13 +++++++------ .../generated/v3_no_index/core/utils.gen.ts.snap | 13 +++++++------ 179 files changed, 1253 insertions(+), 1074 deletions(-) diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/body-response-text-plain/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/body-response-text-plain/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/body-response-text-plain/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/body-response-text-plain/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/form-data/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/form-data/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/form-data/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/form-data/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/client-fetch/sdk-nested-classes-instance/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/client-fetch/sdk-nested-classes-instance/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/client-fetch/sdk-nested-classes-instance/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/client-fetch/sdk-nested-classes-instance/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/client-fetch/sdk-nested-classes/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/client-fetch/sdk-nested-classes/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/client-fetch/sdk-nested-classes/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/client-fetch/sdk-nested-classes/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/sdk/default/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/sdk/default/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/sdk/default/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/sdk/default/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/sdk/instance/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/sdk/instance/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/sdk/instance/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/sdk/instance/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/sdk/throwOnError/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/sdk/throwOnError/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/sdk/throwOnError/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/sdk/throwOnError/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/transformers/type-format-valibot/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/transformers/type-format-valibot/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/transformers/type-format-valibot/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/transformers/type-format-valibot/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/transformers/type-format-zod/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/transformers/type-format-zod/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/transformers/type-format-zod/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/transformers/type-format-zod/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/typescript/transforms-read-write-custom-name/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/typescript/transforms-read-write-custom-name/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/typescript/transforms-read-write-custom-name/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/typescript/transforms-read-write-custom-name/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/typescript/transforms-read-write-ignore/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/typescript/transforms-read-write-ignore/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/typescript/transforms-read-write-ignore/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/typescript/transforms-read-write-ignore/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@pinia/colada/fetch/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@pinia/colada/fetch/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@pinia/colada/fetch/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@pinia/colada/fetch/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@pinia/colada/group-by-tag/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@pinia/colada/group-by-tag/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@pinia/colada/group-by-tag/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@pinia/colada/group-by-tag/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/asClass/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/asClass/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/asClass/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/asClass/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/axios/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/axios/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/axios/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/axios/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/fetch/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/fetch/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/fetch/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/fetch/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/name-builder/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/name-builder/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/name-builder/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/name-builder/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/react-query/asClass/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/react-query/asClass/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/react-query/asClass/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/react-query/asClass/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/react-query/axios/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/react-query/axios/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/react-query/axios/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/react-query/axios/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/react-query/fetch/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/react-query/fetch/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/react-query/fetch/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/react-query/fetch/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/react-query/name-builder/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/react-query/name-builder/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/react-query/name-builder/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/react-query/name-builder/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/solid-query/asClass/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/solid-query/asClass/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/solid-query/asClass/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/solid-query/asClass/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/solid-query/axios/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/solid-query/axios/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/solid-query/axios/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/solid-query/axios/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/solid-query/fetch/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/solid-query/fetch/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/solid-query/fetch/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/solid-query/fetch/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/solid-query/name-builder/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/solid-query/name-builder/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/solid-query/name-builder/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/solid-query/name-builder/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/svelte-query/asClass/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/svelte-query/asClass/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/svelte-query/asClass/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/svelte-query/asClass/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/svelte-query/axios/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/svelte-query/axios/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/svelte-query/axios/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/svelte-query/axios/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/svelte-query/fetch/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/svelte-query/fetch/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/svelte-query/fetch/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/svelte-query/fetch/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/svelte-query/name-builder/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/svelte-query/name-builder/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/svelte-query/name-builder/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/svelte-query/name-builder/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/vue-query/asClass/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/vue-query/asClass/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/vue-query/asClass/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/vue-query/asClass/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/vue-query/axios/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/vue-query/axios/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/vue-query/axios/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/vue-query/axios/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/vue-query/fetch/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/vue-query/fetch/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/vue-query/fetch/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/vue-query/fetch/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/vue-query/name-builder/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/vue-query/name-builder/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/vue-query/name-builder/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/vue-query/name-builder/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/schema-unknown/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/schema-unknown/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/schema-unknown/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/schema-unknown/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-api-key/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-api-key/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-api-key/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-api-key/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-basic/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-basic/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-basic/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-basic/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-false/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-false/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-false/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-false/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-oauth2/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-oauth2/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-oauth2/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-oauth2/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/servers-base-path/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/servers-base-path/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/servers-base-path/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/servers-base-path/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/servers-host/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/servers-host/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/servers-host/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/servers-host/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/servers/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/servers/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/servers/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/servers/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/transforms-read-write/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/transforms-read-write/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/transforms-read-write/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/transforms-read-write/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/body-response-text-plain/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/body-response-text-plain/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/body-response-text-plain/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/body-response-text-plain/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/content-types/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/content-types/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/content-types/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/content-types/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/internal-name-conflict/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/internal-name-conflict/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/internal-name-conflict/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/internal-name-conflict/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/parameter-explode-false-axios/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/parameter-explode-false-axios/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/parameter-explode-false-axios/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/parameter-explode-false-axios/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/parameter-explode-false/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/parameter-explode-false/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/parameter-explode-false/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/parameter-explode-false/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/client-fetch/sdk-nested-classes-instance/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/client-fetch/sdk-nested-classes-instance/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/client-fetch/sdk-nested-classes-instance/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/client-fetch/sdk-nested-classes-instance/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/client-fetch/sdk-nested-classes/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/client-fetch/sdk-nested-classes/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/client-fetch/sdk-nested-classes/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/client-fetch/sdk-nested-classes/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/sdk/default/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/sdk/default/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/sdk/default/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/sdk/default/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/sdk/instance/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/sdk/instance/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/sdk/instance/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/sdk/instance/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/sdk/throwOnError/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/sdk/throwOnError/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/sdk/throwOnError/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/sdk/throwOnError/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/transformers/type-format-valibot/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/transformers/type-format-valibot/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/transformers/type-format-valibot/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/transformers/type-format-valibot/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/transformers/type-format-zod/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/transformers/type-format-zod/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/transformers/type-format-zod/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/transformers/type-format-zod/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/typescript/transforms-read-write-custom-name/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/typescript/transforms-read-write-custom-name/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/typescript/transforms-read-write-custom-name/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/typescript/transforms-read-write-custom-name/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/typescript/transforms-read-write-ignore/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/typescript/transforms-read-write-ignore/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/typescript/transforms-read-write-ignore/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/typescript/transforms-read-write-ignore/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@pinia/colada/fetch/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@pinia/colada/fetch/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@pinia/colada/fetch/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@pinia/colada/fetch/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@pinia/colada/group-by-tag/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@pinia/colada/group-by-tag/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@pinia/colada/group-by-tag/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@pinia/colada/group-by-tag/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/angular-query-experimental/asClass/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/angular-query-experimental/asClass/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/angular-query-experimental/asClass/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/angular-query-experimental/asClass/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/angular-query-experimental/axios/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/angular-query-experimental/axios/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/angular-query-experimental/axios/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/angular-query-experimental/axios/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/angular-query-experimental/fetch/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/angular-query-experimental/fetch/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/angular-query-experimental/fetch/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/angular-query-experimental/fetch/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/angular-query-experimental/name-builder/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/angular-query-experimental/name-builder/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/angular-query-experimental/name-builder/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/angular-query-experimental/name-builder/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/react-query/asClass/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/react-query/asClass/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/react-query/asClass/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/react-query/asClass/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/react-query/axios/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/react-query/axios/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/react-query/axios/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/react-query/axios/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/react-query/fetch/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/react-query/fetch/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/react-query/fetch/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/react-query/fetch/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/react-query/name-builder/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/react-query/name-builder/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/react-query/name-builder/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/react-query/name-builder/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/solid-query/asClass/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/solid-query/asClass/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/solid-query/asClass/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/solid-query/asClass/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/solid-query/axios/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/solid-query/axios/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/solid-query/axios/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/solid-query/axios/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/solid-query/fetch/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/solid-query/fetch/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/solid-query/fetch/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/solid-query/fetch/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/solid-query/name-builder/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/solid-query/name-builder/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/solid-query/name-builder/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/solid-query/name-builder/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/svelte-query/asClass/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/svelte-query/asClass/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/svelte-query/asClass/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/svelte-query/asClass/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/svelte-query/axios/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/svelte-query/axios/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/svelte-query/axios/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/svelte-query/axios/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/svelte-query/fetch/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/svelte-query/fetch/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/svelte-query/fetch/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/svelte-query/fetch/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/svelte-query/name-builder/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/svelte-query/name-builder/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/svelte-query/name-builder/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/svelte-query/name-builder/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/vue-query/asClass/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/vue-query/asClass/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/vue-query/asClass/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/vue-query/asClass/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/vue-query/axios/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/vue-query/axios/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/vue-query/axios/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/vue-query/axios/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/vue-query/fetch/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/vue-query/fetch/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/vue-query/fetch/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/vue-query/fetch/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/vue-query/name-builder/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/vue-query/name-builder/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/vue-query/name-builder/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/vue-query/name-builder/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-api-key/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-api-key/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-api-key/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-api-key/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-false/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-false/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-false/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-false/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-http-bearer/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-http-bearer/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-http-bearer/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-http-bearer/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-oauth2/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-oauth2/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-oauth2/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-oauth2/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-open-id-connect/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-open-id-connect/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-open-id-connect/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-open-id-connect/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/servers/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/servers/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/servers/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/servers/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transformers-all-of/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transformers-all-of/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transformers-all-of/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transformers-all-of/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transformers-any-of-null/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transformers-any-of-null/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transformers-any-of-null/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transformers-any-of-null/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transformers-array/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transformers-array/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transformers-array/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transformers-array/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transforms-read-write/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transforms-read-write/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transforms-read-write/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transforms-read-write/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/body-response-text-plain/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/body-response-text-plain/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/body-response-text-plain/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/body-response-text-plain/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/base-url-false/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/base-url-false/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/base-url-false/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/base-url-false/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/base-url-number/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/base-url-number/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/base-url-number/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/base-url-number/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/base-url-strict/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/base-url-strict/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/base-url-strict/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/base-url-strict/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/base-url-string/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/base-url-string/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/base-url-string/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/base-url-string/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/clean-false/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/clean-false/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/clean-false/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/clean-false/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/default/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/default/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/default/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/default/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/sdk-client-optional/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/sdk-client-optional/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/sdk-client-optional/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/sdk-client-optional/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/sdk-client-required/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/sdk-client-required/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/sdk-client-required/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/sdk-client-required/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/tsconfig-nodenext-sdk/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/tsconfig-nodenext-sdk/core/utils.gen.ts index 7aed565b1..3029f7b3c 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/tsconfig-nodenext-sdk/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/tsconfig-nodenext-sdk/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-false/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-false/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-false/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-false/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-number/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-number/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-number/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-number/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-strict/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-strict/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-strict/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-strict/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-string/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-string/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-string/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-string/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/clean-false/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/clean-false/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/clean-false/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/clean-false/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/default/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/default/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/default/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/default/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/sdk-client-optional/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/sdk-client-optional/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/sdk-client-optional/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/sdk-client-optional/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/sdk-client-required/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/sdk-client-required/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/sdk-client-required/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/sdk-client-required/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/tsconfig-nodenext-sdk/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/tsconfig-nodenext-sdk/core/utils.gen.ts index 7aed565b1..3029f7b3c 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/tsconfig-nodenext-sdk/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/tsconfig-nodenext-sdk/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-false/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-false/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-false/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-false/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-number/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-number/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-number/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-number/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-strict/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-strict/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-strict/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-strict/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-string/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-string/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-string/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-string/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/clean-false/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/clean-false/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/clean-false/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/clean-false/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/default/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/default/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/default/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/default/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/sdk-client-optional/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/sdk-client-optional/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/sdk-client-optional/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/sdk-client-optional/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/sdk-client-required/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/sdk-client-required/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/sdk-client-required/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/sdk-client-required/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/tsconfig-nodenext-sdk/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/tsconfig-nodenext-sdk/core/utils.gen.ts index 7aed565b1..3029f7b3c 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/tsconfig-nodenext-sdk/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/tsconfig-nodenext-sdk/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/base-url-false/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/base-url-false/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/base-url-false/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/base-url-false/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/base-url-number/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/base-url-number/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/base-url-number/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/base-url-number/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/base-url-strict/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/base-url-strict/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/base-url-strict/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/base-url-strict/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/base-url-string/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/base-url-string/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/base-url-string/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/base-url-string/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/clean-false/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/clean-false/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/clean-false/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/clean-false/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/default/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/default/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/default/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/default/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/sdk-client-optional/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/sdk-client-optional/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/sdk-client-optional/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/sdk-client-optional/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/sdk-client-required/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/sdk-client-required/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/sdk-client-required/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/sdk-client-required/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/tsconfig-nodenext-sdk/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/tsconfig-nodenext-sdk/core/utils.gen.ts index 7aed565b1..3029f7b3c 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/tsconfig-nodenext-sdk/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/tsconfig-nodenext-sdk/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/content-types/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/content-types/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/content-types/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/content-types/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/headers/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/headers/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/headers/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/headers/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/internal-name-conflict/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/internal-name-conflict/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/internal-name-conflict/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/internal-name-conflict/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/pagination-ref/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/pagination-ref/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/pagination-ref/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/pagination-ref/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/parameter-explode-false-axios/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/parameter-explode-false-axios/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/parameter-explode-false-axios/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/parameter-explode-false-axios/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/parameter-explode-false/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/parameter-explode-false/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/parameter-explode-false/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/parameter-explode-false/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/client-fetch/sdk-nested-classes-instance/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/client-fetch/sdk-nested-classes-instance/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/client-fetch/sdk-nested-classes-instance/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/client-fetch/sdk-nested-classes-instance/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/client-fetch/sdk-nested-classes/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/client-fetch/sdk-nested-classes/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/client-fetch/sdk-nested-classes/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/client-fetch/sdk-nested-classes/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/sdk/default/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/sdk/default/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/sdk/default/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/sdk/default/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/sdk/instance/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/sdk/instance/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/sdk/instance/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/sdk/instance/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/sdk/throwOnError/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/sdk/throwOnError/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/sdk/throwOnError/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/sdk/throwOnError/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/transformers/type-format-valibot/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/transformers/type-format-valibot/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/transformers/type-format-valibot/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/transformers/type-format-valibot/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/transformers/type-format-zod/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/transformers/type-format-zod/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/transformers/type-format-zod/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/transformers/type-format-zod/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/typescript/transforms-read-write-custom-name/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/typescript/transforms-read-write-custom-name/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/typescript/transforms-read-write-custom-name/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/typescript/transforms-read-write-custom-name/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/typescript/transforms-read-write-ignore/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/typescript/transforms-read-write-ignore/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/typescript/transforms-read-write-ignore/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/typescript/transforms-read-write-ignore/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@pinia/colada/fetch/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@pinia/colada/fetch/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@pinia/colada/fetch/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@pinia/colada/fetch/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@pinia/colada/group-by-tag/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@pinia/colada/group-by-tag/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@pinia/colada/group-by-tag/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@pinia/colada/group-by-tag/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/angular-query-experimental/asClass/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/angular-query-experimental/asClass/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/angular-query-experimental/asClass/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/angular-query-experimental/asClass/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/angular-query-experimental/axios/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/angular-query-experimental/axios/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/angular-query-experimental/axios/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/angular-query-experimental/axios/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/angular-query-experimental/fetch/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/angular-query-experimental/fetch/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/angular-query-experimental/fetch/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/angular-query-experimental/fetch/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/angular-query-experimental/name-builder/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/angular-query-experimental/name-builder/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/angular-query-experimental/name-builder/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/angular-query-experimental/name-builder/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/react-query/asClass/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/react-query/asClass/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/react-query/asClass/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/react-query/asClass/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/react-query/axios/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/react-query/axios/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/react-query/axios/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/react-query/axios/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/react-query/fetch/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/react-query/fetch/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/react-query/fetch/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/react-query/fetch/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/react-query/name-builder/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/react-query/name-builder/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/react-query/name-builder/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/react-query/name-builder/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/solid-query/asClass/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/solid-query/asClass/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/solid-query/asClass/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/solid-query/asClass/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/solid-query/axios/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/solid-query/axios/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/solid-query/axios/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/solid-query/axios/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/solid-query/fetch/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/solid-query/fetch/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/solid-query/fetch/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/solid-query/fetch/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/solid-query/name-builder/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/solid-query/name-builder/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/solid-query/name-builder/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/solid-query/name-builder/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/svelte-query/asClass/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/svelte-query/asClass/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/svelte-query/asClass/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/svelte-query/asClass/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/svelte-query/axios/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/svelte-query/axios/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/svelte-query/axios/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/svelte-query/axios/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/svelte-query/fetch/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/svelte-query/fetch/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/svelte-query/fetch/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/svelte-query/fetch/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/svelte-query/name-builder/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/svelte-query/name-builder/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/svelte-query/name-builder/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/svelte-query/name-builder/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/vue-query/asClass/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/vue-query/asClass/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/vue-query/asClass/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/vue-query/asClass/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/vue-query/axios/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/vue-query/axios/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/vue-query/axios/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/vue-query/axios/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/vue-query/fetch/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/vue-query/fetch/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/vue-query/fetch/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/vue-query/fetch/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/vue-query/name-builder/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/vue-query/name-builder/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/vue-query/name-builder/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/vue-query/name-builder/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-api-key/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-api-key/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-api-key/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-api-key/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-false/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-false/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-false/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-false/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-http-bearer/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-http-bearer/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-http-bearer/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-http-bearer/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-oauth2/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-oauth2/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-oauth2/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-oauth2/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-open-id-connect/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-open-id-connect/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-open-id-connect/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-open-id-connect/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/servers/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/servers/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/servers/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/servers/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-angular/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-angular/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-angular/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-angular/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-axios/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-axios/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-axios/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-axios/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-fetch/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-fetch/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-fetch/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-fetch/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-next/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-next/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-next/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-next/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-nuxt/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-nuxt/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-nuxt/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/sse-nuxt/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-all-of/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-all-of/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-all-of/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-all-of/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-any-of-null/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-any-of-null/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-any-of-null/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-any-of-null/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-array/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-array/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-array/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-array/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transforms-read-write/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transforms-read-write/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transforms-read-write/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transforms-read-write/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/plugins/@tanstack/meta/core/utils.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/plugins/@tanstack/meta/core/utils.gen.ts index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/plugins/@tanstack/meta/core/utils.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/plugins/@tanstack/meta/core/utils.gen.ts @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/test/generated/v3_no_index/core/utils.gen.ts.snap b/packages/openapi-ts-tests/main/test/__snapshots__/test/generated/v3_no_index/core/utils.gen.ts.snap index 719b5f853..0b5389d08 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/test/generated/v3_no_index/core/utils.gen.ts.snap +++ b/packages/openapi-ts-tests/main/test/__snapshots__/test/generated/v3_no_index/core/utils.gen.ts.snap @@ -121,14 +121,15 @@ export function getValidRequestBody(options: { const hasBody = options.body !== undefined; const isSerializedBody = hasBody && options.bodySerializer; - if (isSerializedBody && Object.hasOwn(options, 'serializedBody')) { - const hasSerializedBody = - options.serializedBody !== undefined && options.serializedBody !== ''; + if (isSerializedBody) { + if ('serializedBody' in options) { + const hasSerializedBody = + options.serializedBody !== undefined && options.serializedBody !== ''; - return hasSerializedBody ? options.serializedBody : null; - } + return hasSerializedBody ? options.serializedBody : null; + } - if (isSerializedBody) { + // not all clients implement a serializedBody property (i.e. client-axios) return options.body !== '' ? options.body : null; } -- 2.51.2 From b180e4e105d1d8008e4c92d79857d592080feac7 Mon Sep 17 00:00:00 2001 From: Lubos Date: Sun, 7 Sep 2025 22:53:17 +0800 Subject: [PATCH 45/46] Create two-deers-pump.md --- .changeset/two-deers-pump.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/two-deers-pump.md diff --git a/.changeset/two-deers-pump.md b/.changeset/two-deers-pump.md new file mode 100644 index 000000000..558fb9306 --- /dev/null +++ b/.changeset/two-deers-pump.md @@ -0,0 +1,5 @@ +--- +"@hey-api/openapi-ts": patch +--- + +fix(client): move `getValidRequestBody()` function to `client-core` -- 2.51.2 From bdb61b90df1e92c3d1c776ab4b3352d49bc70604 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sun, 7 Sep 2025 15:35:45 +0000 Subject: [PATCH 46/46] ci: release --- .changeset/metal-brooms-yawn.md | 5 ----- .changeset/two-deers-pump.md | 5 ----- packages/openapi-ts/CHANGELOG.md | 8 ++++++++ packages/openapi-ts/package.json | 2 +- 4 files changed, 9 insertions(+), 11 deletions(-) delete mode 100644 .changeset/metal-brooms-yawn.md delete mode 100644 .changeset/two-deers-pump.md diff --git a/.changeset/metal-brooms-yawn.md b/.changeset/metal-brooms-yawn.md deleted file mode 100644 index b29d04926..000000000 --- a/.changeset/metal-brooms-yawn.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@hey-api/openapi-ts": patch ---- - -fix(client): `mergeHeaders` functions use `.forEach()` instead of `.entries()` diff --git a/.changeset/two-deers-pump.md b/.changeset/two-deers-pump.md deleted file mode 100644 index 558fb9306..000000000 --- a/.changeset/two-deers-pump.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@hey-api/openapi-ts": patch ---- - -fix(client): move `getValidRequestBody()` function to `client-core` diff --git a/packages/openapi-ts/CHANGELOG.md b/packages/openapi-ts/CHANGELOG.md index c33bc64b8..e4fd2042f 100644 --- a/packages/openapi-ts/CHANGELOG.md +++ b/packages/openapi-ts/CHANGELOG.md @@ -1,5 +1,13 @@ # @hey-api/openapi-ts +## 0.82.5 + +### Patch Changes + +- fix(client): `mergeHeaders` functions use `.forEach()` instead of `.entries()` ([#2585](https://github.com/hey-api/openapi-ts/pull/2585)) ([`debba72`](https://github.com/hey-api/openapi-ts/commit/debba72348e450f8dc884223681f10e80da77545)) by [@volesen](https://github.com/volesen) + +- fix(client): move `getValidRequestBody()` function to `client-core` ([#2605](https://github.com/hey-api/openapi-ts/pull/2605)) ([`b180e4e`](https://github.com/hey-api/openapi-ts/commit/b180e4e105d1d8008e4c92d79857d592080feac7)) by [@franworks](https://github.com/franworks) + ## 0.82.4 ### Patch Changes diff --git a/packages/openapi-ts/package.json b/packages/openapi-ts/package.json index 663d6a47a..83765dc9a 100644 --- a/packages/openapi-ts/package.json +++ b/packages/openapi-ts/package.json @@ -1,6 +1,6 @@ { "name": "@hey-api/openapi-ts", - "version": "0.82.4", + "version": "0.82.5", "description": "🚀 The OpenAPI to TypeScript codegen. Generate clients, SDKs, validators, and more.", "homepage": "https://heyapi.dev/", "repository": { -- 2.51.2