From eddfd39bb78ce48bb7e02e5b50eba82f61919c15 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 3 Sep 2026 13:59:18 +0000 Subject: [PATCH 1/3] fix(plugin-fetch): avoid relying on global BodyInit in Node projects The generated .kubb/client.ts and .kubb/serializers.ts referenced the global BodyInit type, which a Node-only project (@types/node without the dom lib) never declares. Both files now use a local RequestBody type derived from RequestInit['body'], which resolves the same way without requiring a global BodyInit name. plugin-axios shares the same serializers.ts template and gets the same fix. Co-Authored-By: Claude Sonnet 5 Claude-Session: https://claude.ai/code/session_01H2LADp1sJjG9BQz5sQbsBX --- .changeset/lazy-plugs-yell.md | 6 ++++++ examples/advanced/src/gen/.kubb/serializers.ts | 12 +++++++++--- examples/axios/src/gen/.kubb/serializers.ts | 12 +++++++++--- examples/fetch/src/gen/.kubb/client.ts | 10 ++++++++-- examples/fetch/src/gen/.kubb/serializers.ts | 12 +++++++++--- examples/mcp/src/gen/.kubb/serializers.ts | 12 +++++++++--- examples/react-query/src/gen/.kubb/client.ts | 10 ++++++++-- examples/react-query/src/gen/.kubb/serializers.ts | 12 +++++++++--- examples/sdk/src/gen/.kubb/client.ts | 10 ++++++++-- examples/sdk/src/gen/.kubb/serializers.ts | 12 +++++++++--- examples/simple-single/src/gen/.kubb/client.ts | 10 ++++++++-- examples/simple-single/src/gen/.kubb/serializers.ts | 12 +++++++++--- examples/swr/src/gen/.kubb/client.ts | 10 ++++++++-- examples/swr/src/gen/.kubb/serializers.ts | 12 +++++++++--- examples/vue-query/src/gen/.kubb/client.ts | 10 ++++++++-- examples/vue-query/src/gen/.kubb/serializers.ts | 12 +++++++++--- packages/plugin-axios/templates/serializers.ts | 12 +++++++++--- packages/plugin-fetch/templates/fetch.ts | 10 ++++++++-- packages/plugin-fetch/templates/serializers.ts | 12 +++++++++--- .../pluginAxios/default/.kubb/serializers.ts | 12 +++++++++--- .../pluginAxios/paramsCasing/.kubb/serializers.ts | 12 +++++++++--- .../pluginAxios/sdkClass/.kubb/serializers.ts | 12 +++++++++--- .../sdkClassWithName/.kubb/serializers.ts | 12 +++++++++--- .../pluginAxios/sdkSingle/.kubb/serializers.ts | 12 +++++++++--- .../pluginAxios/zodTypes/.kubb/serializers.ts | 12 +++++++++--- .../pluginFetch/default/.kubb/client.ts | 10 ++++++++-- .../pluginFetch/default/.kubb/serializers.ts | 12 +++++++++--- .../pluginFetch/paramsCasing/.kubb/client.ts | 10 ++++++++-- .../pluginFetch/paramsCasing/.kubb/serializers.ts | 12 +++++++++--- .../pluginFetch/sdkClass/.kubb/client.ts | 10 ++++++++-- .../pluginFetch/sdkClass/.kubb/serializers.ts | 12 +++++++++--- .../pluginFetch/sdkClassWithName/.kubb/client.ts | 10 ++++++++-- .../sdkClassWithName/.kubb/serializers.ts | 12 +++++++++--- .../pluginFetch/sdkSingle/.kubb/client.ts | 10 ++++++++-- .../pluginFetch/sdkSingle/.kubb/serializers.ts | 12 +++++++++--- .../pluginFetch/zodTypes/.kubb/client.ts | 10 ++++++++-- .../pluginFetch/zodTypes/.kubb/serializers.ts | 12 +++++++++--- .../pluginFetch/zodTypesSdk/.kubb/client.ts | 10 ++++++++-- .../pluginFetch/zodTypesSdk/.kubb/serializers.ts | 12 +++++++++--- .../excludeByOperationId/.kubb/serializers.ts | 12 +++++++++--- .../pluginMcp/groupByTag/.kubb/serializers.ts | 12 +++++++++--- .../pluginMcp/includeByTag/.kubb/serializers.ts | 12 +++++++++--- .../pluginMcp/paramsCasing/.kubb/serializers.ts | 12 +++++++++--- .../pluginMcp/petStore/.kubb/serializers.ts | 12 +++++++++--- .../pluginMcp/withClientPlugin/.kubb/serializers.ts | 12 +++++++++--- .../excludeByOperationId/.kubb/serializers.ts | 12 +++++++++--- .../pluginReactQuery/groupByTag/.kubb/serializers.ts | 12 +++++++++--- .../includeByTag/.kubb/serializers.ts | 12 +++++++++--- .../pluginReactQuery/infinite/.kubb/serializers.ts | 12 +++++++++--- .../mutationDisabled/.kubb/serializers.ts | 12 +++++++++--- .../paramsCasing/.kubb/serializers.ts | 12 +++++++++--- .../pluginReactQuery/parserZod/.kubb/serializers.ts | 12 +++++++++--- .../pluginReactQuery/petStore/.kubb/serializers.ts | 12 +++++++++--- .../queryMethods/.kubb/serializers.ts | 12 +++++++++--- .../pluginReactQuery/suspense/.kubb/serializers.ts | 12 +++++++++--- .../withClientPlugin/.kubb/serializers.ts | 12 +++++++++--- .../excludeByOperationId/.kubb/serializers.ts | 12 +++++++++--- .../pluginSwr/groupByTag/.kubb/serializers.ts | 12 +++++++++--- .../pluginSwr/includeByTag/.kubb/serializers.ts | 12 +++++++++--- .../pluginSwr/mutationDisabled/.kubb/serializers.ts | 12 +++++++++--- .../pluginSwr/paramsCasing/.kubb/serializers.ts | 12 +++++++++--- .../pluginSwr/parserZod/.kubb/serializers.ts | 12 +++++++++--- .../pluginSwr/petStore/.kubb/serializers.ts | 12 +++++++++--- .../pluginSwr/queryDisabled/.kubb/serializers.ts | 12 +++++++++--- .../pluginSwr/queryMethods/.kubb/serializers.ts | 12 +++++++++--- .../pluginSwr/withClientPlugin/.kubb/serializers.ts | 12 +++++++++--- .../excludeByOperationId/.kubb/serializers.ts | 12 +++++++++--- .../pluginVueQuery/groupByTag/.kubb/serializers.ts | 12 +++++++++--- .../pluginVueQuery/includeByTag/.kubb/serializers.ts | 12 +++++++++--- .../pluginVueQuery/infinite/.kubb/serializers.ts | 12 +++++++++--- .../mutationDisabled/.kubb/serializers.ts | 12 +++++++++--- .../pluginVueQuery/paramsCasing/.kubb/serializers.ts | 12 +++++++++--- .../pluginVueQuery/parserZod/.kubb/serializers.ts | 12 +++++++++--- .../pluginVueQuery/petStore/.kubb/serializers.ts | 12 +++++++++--- .../withClientPlugin/.kubb/serializers.ts | 12 +++++++++--- 75 files changed, 658 insertions(+), 208 deletions(-) create mode 100644 .changeset/lazy-plugs-yell.md diff --git a/.changeset/lazy-plugs-yell.md b/.changeset/lazy-plugs-yell.md new file mode 100644 index 000000000..5647e54a0 --- /dev/null +++ b/.changeset/lazy-plugs-yell.md @@ -0,0 +1,6 @@ +--- +'@kubb/plugin-fetch': patch +'@kubb/plugin-axios': patch +--- + +Fix the generated client failing to type-check in Node-only projects (`@types/node` without the `dom` lib). The generated `.kubb/client.ts` and `.kubb/serializers.ts` no longer reference the global `BodyInit` name, which such a project never declares. They now use a local `RequestBody` type derived from `RequestInit['body']`. diff --git a/examples/advanced/src/gen/.kubb/serializers.ts b/examples/advanced/src/gen/.kubb/serializers.ts index dd2b2e1fc..d928f56c7 100644 --- a/examples/advanced/src/gen/.kubb/serializers.ts +++ b/examples/advanced/src/gen/.kubb/serializers.ts @@ -1,6 +1,12 @@ export type HeaderValue = string | number | boolean | null | undefined | object export type HeadersInit = Array<[string, HeaderValue]> | Record +/** + * The request body type `fetch` accepts, derived from `RequestInit` instead of the global `BodyInit` + * name, which a Node-only project (`@types/node` without the `dom` lib) does not declare. + */ +export type RequestBody = NonNullable + /** * The OpenAPI query-parameter serialization style. `form` is the default; `spaceDelimited` and * `pipeDelimited` join arrays with a space or pipe, and `deepObject` renders objects as @@ -67,7 +73,7 @@ export type BodyEncoding = SerializationStyle & { * `ArrayBuffer`, and string bodies pass through untouched. The optional `encoding` argument carries * the per-property OpenAPI `encoding` metadata for form bodies. */ -export type BodySerializer = (args: { body: unknown; contentType?: string; encoding?: Record }) => BodyInit | undefined +export type BodySerializer = (args: { body: unknown; contentType?: string; encoding?: Record }) => RequestBody | undefined /** * The OpenAPI path-parameter serialization style. `simple` is the default and emits the bare value; @@ -111,7 +117,7 @@ export type Styles = { body?: Record } -function isFormBody(body: unknown): body is BodyInit { +function isFormBody(body: unknown): body is RequestBody { return ( body instanceof FormData || body instanceof URLSearchParams || @@ -163,7 +169,7 @@ function appendFormDataValue({ formData, key, value, contentType }: { formData: */ export const defaultBodySerializer: BodySerializer = ({ body, contentType, encoding }) => { if (body === undefined || body === null) return undefined - if (isFormBody(body)) return body as BodyInit + if (isFormBody(body)) return body as RequestBody if (contentType?.includes('multipart/form-data')) { const formData = new FormData() for (const [key, value] of Object.entries(body as Record)) { diff --git a/examples/axios/src/gen/.kubb/serializers.ts b/examples/axios/src/gen/.kubb/serializers.ts index dd2b2e1fc..d928f56c7 100644 --- a/examples/axios/src/gen/.kubb/serializers.ts +++ b/examples/axios/src/gen/.kubb/serializers.ts @@ -1,6 +1,12 @@ export type HeaderValue = string | number | boolean | null | undefined | object export type HeadersInit = Array<[string, HeaderValue]> | Record +/** + * The request body type `fetch` accepts, derived from `RequestInit` instead of the global `BodyInit` + * name, which a Node-only project (`@types/node` without the `dom` lib) does not declare. + */ +export type RequestBody = NonNullable + /** * The OpenAPI query-parameter serialization style. `form` is the default; `spaceDelimited` and * `pipeDelimited` join arrays with a space or pipe, and `deepObject` renders objects as @@ -67,7 +73,7 @@ export type BodyEncoding = SerializationStyle & { * `ArrayBuffer`, and string bodies pass through untouched. The optional `encoding` argument carries * the per-property OpenAPI `encoding` metadata for form bodies. */ -export type BodySerializer = (args: { body: unknown; contentType?: string; encoding?: Record }) => BodyInit | undefined +export type BodySerializer = (args: { body: unknown; contentType?: string; encoding?: Record }) => RequestBody | undefined /** * The OpenAPI path-parameter serialization style. `simple` is the default and emits the bare value; @@ -111,7 +117,7 @@ export type Styles = { body?: Record } -function isFormBody(body: unknown): body is BodyInit { +function isFormBody(body: unknown): body is RequestBody { return ( body instanceof FormData || body instanceof URLSearchParams || @@ -163,7 +169,7 @@ function appendFormDataValue({ formData, key, value, contentType }: { formData: */ export const defaultBodySerializer: BodySerializer = ({ body, contentType, encoding }) => { if (body === undefined || body === null) return undefined - if (isFormBody(body)) return body as BodyInit + if (isFormBody(body)) return body as RequestBody if (contentType?.includes('multipart/form-data')) { const formData = new FormData() for (const [key, value] of Object.entries(body as Record)) { diff --git a/examples/fetch/src/gen/.kubb/client.ts b/examples/fetch/src/gen/.kubb/client.ts index ea6223eff..47911f024 100644 --- a/examples/fetch/src/gen/.kubb/client.ts +++ b/examples/fetch/src/gen/.kubb/client.ts @@ -7,6 +7,12 @@ import { type StandardSchemaValidator, validateStandardSchema } from './standard */ export type SuccessStatusCode = '200' | '201' | '202' | '203' | '204' | '205' | '206' | '207' | '208' | '226' +/** + * The request body type `fetch` accepts, derived from `RequestInit` instead of the global `BodyInit` + * name, which a Node-only project (`@types/node` without the `dom` lib) does not declare. + */ +export type RequestBody = NonNullable + /** * The success members of a per-status responses record. */ @@ -124,7 +130,7 @@ export type Deserializer = (raw: unknown, contentType: string) => T /** * Serializes a request body for a single media type, registered per content type as a codec's `serialize` to encode formats the default serializer does not handle. */ -export type ContentBodySerializer = (body: unknown, contentType?: string) => BodyInit | undefined +export type ContentBodySerializer = (body: unknown, contentType?: string) => RequestBody | undefined /** * A per-content-type codec registered on `codecs`, keyed by content type. `serialize` encodes the @@ -238,7 +244,7 @@ export type ResolvedRequest = { url: string method: string headers: Record - body?: BodyInit + body?: RequestBody signal?: AbortSignal credentials?: RequestCredentials options?: FetchOptions diff --git a/examples/fetch/src/gen/.kubb/serializers.ts b/examples/fetch/src/gen/.kubb/serializers.ts index dd2b2e1fc..d928f56c7 100644 --- a/examples/fetch/src/gen/.kubb/serializers.ts +++ b/examples/fetch/src/gen/.kubb/serializers.ts @@ -1,6 +1,12 @@ export type HeaderValue = string | number | boolean | null | undefined | object export type HeadersInit = Array<[string, HeaderValue]> | Record +/** + * The request body type `fetch` accepts, derived from `RequestInit` instead of the global `BodyInit` + * name, which a Node-only project (`@types/node` without the `dom` lib) does not declare. + */ +export type RequestBody = NonNullable + /** * The OpenAPI query-parameter serialization style. `form` is the default; `spaceDelimited` and * `pipeDelimited` join arrays with a space or pipe, and `deepObject` renders objects as @@ -67,7 +73,7 @@ export type BodyEncoding = SerializationStyle & { * `ArrayBuffer`, and string bodies pass through untouched. The optional `encoding` argument carries * the per-property OpenAPI `encoding` metadata for form bodies. */ -export type BodySerializer = (args: { body: unknown; contentType?: string; encoding?: Record }) => BodyInit | undefined +export type BodySerializer = (args: { body: unknown; contentType?: string; encoding?: Record }) => RequestBody | undefined /** * The OpenAPI path-parameter serialization style. `simple` is the default and emits the bare value; @@ -111,7 +117,7 @@ export type Styles = { body?: Record } -function isFormBody(body: unknown): body is BodyInit { +function isFormBody(body: unknown): body is RequestBody { return ( body instanceof FormData || body instanceof URLSearchParams || @@ -163,7 +169,7 @@ function appendFormDataValue({ formData, key, value, contentType }: { formData: */ export const defaultBodySerializer: BodySerializer = ({ body, contentType, encoding }) => { if (body === undefined || body === null) return undefined - if (isFormBody(body)) return body as BodyInit + if (isFormBody(body)) return body as RequestBody if (contentType?.includes('multipart/form-data')) { const formData = new FormData() for (const [key, value] of Object.entries(body as Record)) { diff --git a/examples/mcp/src/gen/.kubb/serializers.ts b/examples/mcp/src/gen/.kubb/serializers.ts index dd2b2e1fc..d928f56c7 100644 --- a/examples/mcp/src/gen/.kubb/serializers.ts +++ b/examples/mcp/src/gen/.kubb/serializers.ts @@ -1,6 +1,12 @@ export type HeaderValue = string | number | boolean | null | undefined | object export type HeadersInit = Array<[string, HeaderValue]> | Record +/** + * The request body type `fetch` accepts, derived from `RequestInit` instead of the global `BodyInit` + * name, which a Node-only project (`@types/node` without the `dom` lib) does not declare. + */ +export type RequestBody = NonNullable + /** * The OpenAPI query-parameter serialization style. `form` is the default; `spaceDelimited` and * `pipeDelimited` join arrays with a space or pipe, and `deepObject` renders objects as @@ -67,7 +73,7 @@ export type BodyEncoding = SerializationStyle & { * `ArrayBuffer`, and string bodies pass through untouched. The optional `encoding` argument carries * the per-property OpenAPI `encoding` metadata for form bodies. */ -export type BodySerializer = (args: { body: unknown; contentType?: string; encoding?: Record }) => BodyInit | undefined +export type BodySerializer = (args: { body: unknown; contentType?: string; encoding?: Record }) => RequestBody | undefined /** * The OpenAPI path-parameter serialization style. `simple` is the default and emits the bare value; @@ -111,7 +117,7 @@ export type Styles = { body?: Record } -function isFormBody(body: unknown): body is BodyInit { +function isFormBody(body: unknown): body is RequestBody { return ( body instanceof FormData || body instanceof URLSearchParams || @@ -163,7 +169,7 @@ function appendFormDataValue({ formData, key, value, contentType }: { formData: */ export const defaultBodySerializer: BodySerializer = ({ body, contentType, encoding }) => { if (body === undefined || body === null) return undefined - if (isFormBody(body)) return body as BodyInit + if (isFormBody(body)) return body as RequestBody if (contentType?.includes('multipart/form-data')) { const formData = new FormData() for (const [key, value] of Object.entries(body as Record)) { diff --git a/examples/react-query/src/gen/.kubb/client.ts b/examples/react-query/src/gen/.kubb/client.ts index ea6223eff..47911f024 100644 --- a/examples/react-query/src/gen/.kubb/client.ts +++ b/examples/react-query/src/gen/.kubb/client.ts @@ -7,6 +7,12 @@ import { type StandardSchemaValidator, validateStandardSchema } from './standard */ export type SuccessStatusCode = '200' | '201' | '202' | '203' | '204' | '205' | '206' | '207' | '208' | '226' +/** + * The request body type `fetch` accepts, derived from `RequestInit` instead of the global `BodyInit` + * name, which a Node-only project (`@types/node` without the `dom` lib) does not declare. + */ +export type RequestBody = NonNullable + /** * The success members of a per-status responses record. */ @@ -124,7 +130,7 @@ export type Deserializer = (raw: unknown, contentType: string) => T /** * Serializes a request body for a single media type, registered per content type as a codec's `serialize` to encode formats the default serializer does not handle. */ -export type ContentBodySerializer = (body: unknown, contentType?: string) => BodyInit | undefined +export type ContentBodySerializer = (body: unknown, contentType?: string) => RequestBody | undefined /** * A per-content-type codec registered on `codecs`, keyed by content type. `serialize` encodes the @@ -238,7 +244,7 @@ export type ResolvedRequest = { url: string method: string headers: Record - body?: BodyInit + body?: RequestBody signal?: AbortSignal credentials?: RequestCredentials options?: FetchOptions diff --git a/examples/react-query/src/gen/.kubb/serializers.ts b/examples/react-query/src/gen/.kubb/serializers.ts index dd2b2e1fc..d928f56c7 100644 --- a/examples/react-query/src/gen/.kubb/serializers.ts +++ b/examples/react-query/src/gen/.kubb/serializers.ts @@ -1,6 +1,12 @@ export type HeaderValue = string | number | boolean | null | undefined | object export type HeadersInit = Array<[string, HeaderValue]> | Record +/** + * The request body type `fetch` accepts, derived from `RequestInit` instead of the global `BodyInit` + * name, which a Node-only project (`@types/node` without the `dom` lib) does not declare. + */ +export type RequestBody = NonNullable + /** * The OpenAPI query-parameter serialization style. `form` is the default; `spaceDelimited` and * `pipeDelimited` join arrays with a space or pipe, and `deepObject` renders objects as @@ -67,7 +73,7 @@ export type BodyEncoding = SerializationStyle & { * `ArrayBuffer`, and string bodies pass through untouched. The optional `encoding` argument carries * the per-property OpenAPI `encoding` metadata for form bodies. */ -export type BodySerializer = (args: { body: unknown; contentType?: string; encoding?: Record }) => BodyInit | undefined +export type BodySerializer = (args: { body: unknown; contentType?: string; encoding?: Record }) => RequestBody | undefined /** * The OpenAPI path-parameter serialization style. `simple` is the default and emits the bare value; @@ -111,7 +117,7 @@ export type Styles = { body?: Record } -function isFormBody(body: unknown): body is BodyInit { +function isFormBody(body: unknown): body is RequestBody { return ( body instanceof FormData || body instanceof URLSearchParams || @@ -163,7 +169,7 @@ function appendFormDataValue({ formData, key, value, contentType }: { formData: */ export const defaultBodySerializer: BodySerializer = ({ body, contentType, encoding }) => { if (body === undefined || body === null) return undefined - if (isFormBody(body)) return body as BodyInit + if (isFormBody(body)) return body as RequestBody if (contentType?.includes('multipart/form-data')) { const formData = new FormData() for (const [key, value] of Object.entries(body as Record)) { diff --git a/examples/sdk/src/gen/.kubb/client.ts b/examples/sdk/src/gen/.kubb/client.ts index ea6223eff..47911f024 100644 --- a/examples/sdk/src/gen/.kubb/client.ts +++ b/examples/sdk/src/gen/.kubb/client.ts @@ -7,6 +7,12 @@ import { type StandardSchemaValidator, validateStandardSchema } from './standard */ export type SuccessStatusCode = '200' | '201' | '202' | '203' | '204' | '205' | '206' | '207' | '208' | '226' +/** + * The request body type `fetch` accepts, derived from `RequestInit` instead of the global `BodyInit` + * name, which a Node-only project (`@types/node` without the `dom` lib) does not declare. + */ +export type RequestBody = NonNullable + /** * The success members of a per-status responses record. */ @@ -124,7 +130,7 @@ export type Deserializer = (raw: unknown, contentType: string) => T /** * Serializes a request body for a single media type, registered per content type as a codec's `serialize` to encode formats the default serializer does not handle. */ -export type ContentBodySerializer = (body: unknown, contentType?: string) => BodyInit | undefined +export type ContentBodySerializer = (body: unknown, contentType?: string) => RequestBody | undefined /** * A per-content-type codec registered on `codecs`, keyed by content type. `serialize` encodes the @@ -238,7 +244,7 @@ export type ResolvedRequest = { url: string method: string headers: Record - body?: BodyInit + body?: RequestBody signal?: AbortSignal credentials?: RequestCredentials options?: FetchOptions diff --git a/examples/sdk/src/gen/.kubb/serializers.ts b/examples/sdk/src/gen/.kubb/serializers.ts index dd2b2e1fc..d928f56c7 100644 --- a/examples/sdk/src/gen/.kubb/serializers.ts +++ b/examples/sdk/src/gen/.kubb/serializers.ts @@ -1,6 +1,12 @@ export type HeaderValue = string | number | boolean | null | undefined | object export type HeadersInit = Array<[string, HeaderValue]> | Record +/** + * The request body type `fetch` accepts, derived from `RequestInit` instead of the global `BodyInit` + * name, which a Node-only project (`@types/node` without the `dom` lib) does not declare. + */ +export type RequestBody = NonNullable + /** * The OpenAPI query-parameter serialization style. `form` is the default; `spaceDelimited` and * `pipeDelimited` join arrays with a space or pipe, and `deepObject` renders objects as @@ -67,7 +73,7 @@ export type BodyEncoding = SerializationStyle & { * `ArrayBuffer`, and string bodies pass through untouched. The optional `encoding` argument carries * the per-property OpenAPI `encoding` metadata for form bodies. */ -export type BodySerializer = (args: { body: unknown; contentType?: string; encoding?: Record }) => BodyInit | undefined +export type BodySerializer = (args: { body: unknown; contentType?: string; encoding?: Record }) => RequestBody | undefined /** * The OpenAPI path-parameter serialization style. `simple` is the default and emits the bare value; @@ -111,7 +117,7 @@ export type Styles = { body?: Record } -function isFormBody(body: unknown): body is BodyInit { +function isFormBody(body: unknown): body is RequestBody { return ( body instanceof FormData || body instanceof URLSearchParams || @@ -163,7 +169,7 @@ function appendFormDataValue({ formData, key, value, contentType }: { formData: */ export const defaultBodySerializer: BodySerializer = ({ body, contentType, encoding }) => { if (body === undefined || body === null) return undefined - if (isFormBody(body)) return body as BodyInit + if (isFormBody(body)) return body as RequestBody if (contentType?.includes('multipart/form-data')) { const formData = new FormData() for (const [key, value] of Object.entries(body as Record)) { diff --git a/examples/simple-single/src/gen/.kubb/client.ts b/examples/simple-single/src/gen/.kubb/client.ts index ea6223eff..47911f024 100644 --- a/examples/simple-single/src/gen/.kubb/client.ts +++ b/examples/simple-single/src/gen/.kubb/client.ts @@ -7,6 +7,12 @@ import { type StandardSchemaValidator, validateStandardSchema } from './standard */ export type SuccessStatusCode = '200' | '201' | '202' | '203' | '204' | '205' | '206' | '207' | '208' | '226' +/** + * The request body type `fetch` accepts, derived from `RequestInit` instead of the global `BodyInit` + * name, which a Node-only project (`@types/node` without the `dom` lib) does not declare. + */ +export type RequestBody = NonNullable + /** * The success members of a per-status responses record. */ @@ -124,7 +130,7 @@ export type Deserializer = (raw: unknown, contentType: string) => T /** * Serializes a request body for a single media type, registered per content type as a codec's `serialize` to encode formats the default serializer does not handle. */ -export type ContentBodySerializer = (body: unknown, contentType?: string) => BodyInit | undefined +export type ContentBodySerializer = (body: unknown, contentType?: string) => RequestBody | undefined /** * A per-content-type codec registered on `codecs`, keyed by content type. `serialize` encodes the @@ -238,7 +244,7 @@ export type ResolvedRequest = { url: string method: string headers: Record - body?: BodyInit + body?: RequestBody signal?: AbortSignal credentials?: RequestCredentials options?: FetchOptions diff --git a/examples/simple-single/src/gen/.kubb/serializers.ts b/examples/simple-single/src/gen/.kubb/serializers.ts index dd2b2e1fc..d928f56c7 100644 --- a/examples/simple-single/src/gen/.kubb/serializers.ts +++ b/examples/simple-single/src/gen/.kubb/serializers.ts @@ -1,6 +1,12 @@ export type HeaderValue = string | number | boolean | null | undefined | object export type HeadersInit = Array<[string, HeaderValue]> | Record +/** + * The request body type `fetch` accepts, derived from `RequestInit` instead of the global `BodyInit` + * name, which a Node-only project (`@types/node` without the `dom` lib) does not declare. + */ +export type RequestBody = NonNullable + /** * The OpenAPI query-parameter serialization style. `form` is the default; `spaceDelimited` and * `pipeDelimited` join arrays with a space or pipe, and `deepObject` renders objects as @@ -67,7 +73,7 @@ export type BodyEncoding = SerializationStyle & { * `ArrayBuffer`, and string bodies pass through untouched. The optional `encoding` argument carries * the per-property OpenAPI `encoding` metadata for form bodies. */ -export type BodySerializer = (args: { body: unknown; contentType?: string; encoding?: Record }) => BodyInit | undefined +export type BodySerializer = (args: { body: unknown; contentType?: string; encoding?: Record }) => RequestBody | undefined /** * The OpenAPI path-parameter serialization style. `simple` is the default and emits the bare value; @@ -111,7 +117,7 @@ export type Styles = { body?: Record } -function isFormBody(body: unknown): body is BodyInit { +function isFormBody(body: unknown): body is RequestBody { return ( body instanceof FormData || body instanceof URLSearchParams || @@ -163,7 +169,7 @@ function appendFormDataValue({ formData, key, value, contentType }: { formData: */ export const defaultBodySerializer: BodySerializer = ({ body, contentType, encoding }) => { if (body === undefined || body === null) return undefined - if (isFormBody(body)) return body as BodyInit + if (isFormBody(body)) return body as RequestBody if (contentType?.includes('multipart/form-data')) { const formData = new FormData() for (const [key, value] of Object.entries(body as Record)) { diff --git a/examples/swr/src/gen/.kubb/client.ts b/examples/swr/src/gen/.kubb/client.ts index ea6223eff..47911f024 100644 --- a/examples/swr/src/gen/.kubb/client.ts +++ b/examples/swr/src/gen/.kubb/client.ts @@ -7,6 +7,12 @@ import { type StandardSchemaValidator, validateStandardSchema } from './standard */ export type SuccessStatusCode = '200' | '201' | '202' | '203' | '204' | '205' | '206' | '207' | '208' | '226' +/** + * The request body type `fetch` accepts, derived from `RequestInit` instead of the global `BodyInit` + * name, which a Node-only project (`@types/node` without the `dom` lib) does not declare. + */ +export type RequestBody = NonNullable + /** * The success members of a per-status responses record. */ @@ -124,7 +130,7 @@ export type Deserializer = (raw: unknown, contentType: string) => T /** * Serializes a request body for a single media type, registered per content type as a codec's `serialize` to encode formats the default serializer does not handle. */ -export type ContentBodySerializer = (body: unknown, contentType?: string) => BodyInit | undefined +export type ContentBodySerializer = (body: unknown, contentType?: string) => RequestBody | undefined /** * A per-content-type codec registered on `codecs`, keyed by content type. `serialize` encodes the @@ -238,7 +244,7 @@ export type ResolvedRequest = { url: string method: string headers: Record - body?: BodyInit + body?: RequestBody signal?: AbortSignal credentials?: RequestCredentials options?: FetchOptions diff --git a/examples/swr/src/gen/.kubb/serializers.ts b/examples/swr/src/gen/.kubb/serializers.ts index dd2b2e1fc..d928f56c7 100644 --- a/examples/swr/src/gen/.kubb/serializers.ts +++ b/examples/swr/src/gen/.kubb/serializers.ts @@ -1,6 +1,12 @@ export type HeaderValue = string | number | boolean | null | undefined | object export type HeadersInit = Array<[string, HeaderValue]> | Record +/** + * The request body type `fetch` accepts, derived from `RequestInit` instead of the global `BodyInit` + * name, which a Node-only project (`@types/node` without the `dom` lib) does not declare. + */ +export type RequestBody = NonNullable + /** * The OpenAPI query-parameter serialization style. `form` is the default; `spaceDelimited` and * `pipeDelimited` join arrays with a space or pipe, and `deepObject` renders objects as @@ -67,7 +73,7 @@ export type BodyEncoding = SerializationStyle & { * `ArrayBuffer`, and string bodies pass through untouched. The optional `encoding` argument carries * the per-property OpenAPI `encoding` metadata for form bodies. */ -export type BodySerializer = (args: { body: unknown; contentType?: string; encoding?: Record }) => BodyInit | undefined +export type BodySerializer = (args: { body: unknown; contentType?: string; encoding?: Record }) => RequestBody | undefined /** * The OpenAPI path-parameter serialization style. `simple` is the default and emits the bare value; @@ -111,7 +117,7 @@ export type Styles = { body?: Record } -function isFormBody(body: unknown): body is BodyInit { +function isFormBody(body: unknown): body is RequestBody { return ( body instanceof FormData || body instanceof URLSearchParams || @@ -163,7 +169,7 @@ function appendFormDataValue({ formData, key, value, contentType }: { formData: */ export const defaultBodySerializer: BodySerializer = ({ body, contentType, encoding }) => { if (body === undefined || body === null) return undefined - if (isFormBody(body)) return body as BodyInit + if (isFormBody(body)) return body as RequestBody if (contentType?.includes('multipart/form-data')) { const formData = new FormData() for (const [key, value] of Object.entries(body as Record)) { diff --git a/examples/vue-query/src/gen/.kubb/client.ts b/examples/vue-query/src/gen/.kubb/client.ts index ea6223eff..47911f024 100644 --- a/examples/vue-query/src/gen/.kubb/client.ts +++ b/examples/vue-query/src/gen/.kubb/client.ts @@ -7,6 +7,12 @@ import { type StandardSchemaValidator, validateStandardSchema } from './standard */ export type SuccessStatusCode = '200' | '201' | '202' | '203' | '204' | '205' | '206' | '207' | '208' | '226' +/** + * The request body type `fetch` accepts, derived from `RequestInit` instead of the global `BodyInit` + * name, which a Node-only project (`@types/node` without the `dom` lib) does not declare. + */ +export type RequestBody = NonNullable + /** * The success members of a per-status responses record. */ @@ -124,7 +130,7 @@ export type Deserializer = (raw: unknown, contentType: string) => T /** * Serializes a request body for a single media type, registered per content type as a codec's `serialize` to encode formats the default serializer does not handle. */ -export type ContentBodySerializer = (body: unknown, contentType?: string) => BodyInit | undefined +export type ContentBodySerializer = (body: unknown, contentType?: string) => RequestBody | undefined /** * A per-content-type codec registered on `codecs`, keyed by content type. `serialize` encodes the @@ -238,7 +244,7 @@ export type ResolvedRequest = { url: string method: string headers: Record - body?: BodyInit + body?: RequestBody signal?: AbortSignal credentials?: RequestCredentials options?: FetchOptions diff --git a/examples/vue-query/src/gen/.kubb/serializers.ts b/examples/vue-query/src/gen/.kubb/serializers.ts index dd2b2e1fc..d928f56c7 100644 --- a/examples/vue-query/src/gen/.kubb/serializers.ts +++ b/examples/vue-query/src/gen/.kubb/serializers.ts @@ -1,6 +1,12 @@ export type HeaderValue = string | number | boolean | null | undefined | object export type HeadersInit = Array<[string, HeaderValue]> | Record +/** + * The request body type `fetch` accepts, derived from `RequestInit` instead of the global `BodyInit` + * name, which a Node-only project (`@types/node` without the `dom` lib) does not declare. + */ +export type RequestBody = NonNullable + /** * The OpenAPI query-parameter serialization style. `form` is the default; `spaceDelimited` and * `pipeDelimited` join arrays with a space or pipe, and `deepObject` renders objects as @@ -67,7 +73,7 @@ export type BodyEncoding = SerializationStyle & { * `ArrayBuffer`, and string bodies pass through untouched. The optional `encoding` argument carries * the per-property OpenAPI `encoding` metadata for form bodies. */ -export type BodySerializer = (args: { body: unknown; contentType?: string; encoding?: Record }) => BodyInit | undefined +export type BodySerializer = (args: { body: unknown; contentType?: string; encoding?: Record }) => RequestBody | undefined /** * The OpenAPI path-parameter serialization style. `simple` is the default and emits the bare value; @@ -111,7 +117,7 @@ export type Styles = { body?: Record } -function isFormBody(body: unknown): body is BodyInit { +function isFormBody(body: unknown): body is RequestBody { return ( body instanceof FormData || body instanceof URLSearchParams || @@ -163,7 +169,7 @@ function appendFormDataValue({ formData, key, value, contentType }: { formData: */ export const defaultBodySerializer: BodySerializer = ({ body, contentType, encoding }) => { if (body === undefined || body === null) return undefined - if (isFormBody(body)) return body as BodyInit + if (isFormBody(body)) return body as RequestBody if (contentType?.includes('multipart/form-data')) { const formData = new FormData() for (const [key, value] of Object.entries(body as Record)) { diff --git a/packages/plugin-axios/templates/serializers.ts b/packages/plugin-axios/templates/serializers.ts index dd2b2e1fc..d928f56c7 100644 --- a/packages/plugin-axios/templates/serializers.ts +++ b/packages/plugin-axios/templates/serializers.ts @@ -1,6 +1,12 @@ export type HeaderValue = string | number | boolean | null | undefined | object export type HeadersInit = Array<[string, HeaderValue]> | Record +/** + * The request body type `fetch` accepts, derived from `RequestInit` instead of the global `BodyInit` + * name, which a Node-only project (`@types/node` without the `dom` lib) does not declare. + */ +export type RequestBody = NonNullable + /** * The OpenAPI query-parameter serialization style. `form` is the default; `spaceDelimited` and * `pipeDelimited` join arrays with a space or pipe, and `deepObject` renders objects as @@ -67,7 +73,7 @@ export type BodyEncoding = SerializationStyle & { * `ArrayBuffer`, and string bodies pass through untouched. The optional `encoding` argument carries * the per-property OpenAPI `encoding` metadata for form bodies. */ -export type BodySerializer = (args: { body: unknown; contentType?: string; encoding?: Record }) => BodyInit | undefined +export type BodySerializer = (args: { body: unknown; contentType?: string; encoding?: Record }) => RequestBody | undefined /** * The OpenAPI path-parameter serialization style. `simple` is the default and emits the bare value; @@ -111,7 +117,7 @@ export type Styles = { body?: Record } -function isFormBody(body: unknown): body is BodyInit { +function isFormBody(body: unknown): body is RequestBody { return ( body instanceof FormData || body instanceof URLSearchParams || @@ -163,7 +169,7 @@ function appendFormDataValue({ formData, key, value, contentType }: { formData: */ export const defaultBodySerializer: BodySerializer = ({ body, contentType, encoding }) => { if (body === undefined || body === null) return undefined - if (isFormBody(body)) return body as BodyInit + if (isFormBody(body)) return body as RequestBody if (contentType?.includes('multipart/form-data')) { const formData = new FormData() for (const [key, value] of Object.entries(body as Record)) { diff --git a/packages/plugin-fetch/templates/fetch.ts b/packages/plugin-fetch/templates/fetch.ts index ea6223eff..47911f024 100644 --- a/packages/plugin-fetch/templates/fetch.ts +++ b/packages/plugin-fetch/templates/fetch.ts @@ -7,6 +7,12 @@ import { type StandardSchemaValidator, validateStandardSchema } from './standard */ export type SuccessStatusCode = '200' | '201' | '202' | '203' | '204' | '205' | '206' | '207' | '208' | '226' +/** + * The request body type `fetch` accepts, derived from `RequestInit` instead of the global `BodyInit` + * name, which a Node-only project (`@types/node` without the `dom` lib) does not declare. + */ +export type RequestBody = NonNullable + /** * The success members of a per-status responses record. */ @@ -124,7 +130,7 @@ export type Deserializer = (raw: unknown, contentType: string) => T /** * Serializes a request body for a single media type, registered per content type as a codec's `serialize` to encode formats the default serializer does not handle. */ -export type ContentBodySerializer = (body: unknown, contentType?: string) => BodyInit | undefined +export type ContentBodySerializer = (body: unknown, contentType?: string) => RequestBody | undefined /** * A per-content-type codec registered on `codecs`, keyed by content type. `serialize` encodes the @@ -238,7 +244,7 @@ export type ResolvedRequest = { url: string method: string headers: Record - body?: BodyInit + body?: RequestBody signal?: AbortSignal credentials?: RequestCredentials options?: FetchOptions diff --git a/packages/plugin-fetch/templates/serializers.ts b/packages/plugin-fetch/templates/serializers.ts index dd2b2e1fc..d928f56c7 100644 --- a/packages/plugin-fetch/templates/serializers.ts +++ b/packages/plugin-fetch/templates/serializers.ts @@ -1,6 +1,12 @@ export type HeaderValue = string | number | boolean | null | undefined | object export type HeadersInit = Array<[string, HeaderValue]> | Record +/** + * The request body type `fetch` accepts, derived from `RequestInit` instead of the global `BodyInit` + * name, which a Node-only project (`@types/node` without the `dom` lib) does not declare. + */ +export type RequestBody = NonNullable + /** * The OpenAPI query-parameter serialization style. `form` is the default; `spaceDelimited` and * `pipeDelimited` join arrays with a space or pipe, and `deepObject` renders objects as @@ -67,7 +73,7 @@ export type BodyEncoding = SerializationStyle & { * `ArrayBuffer`, and string bodies pass through untouched. The optional `encoding` argument carries * the per-property OpenAPI `encoding` metadata for form bodies. */ -export type BodySerializer = (args: { body: unknown; contentType?: string; encoding?: Record }) => BodyInit | undefined +export type BodySerializer = (args: { body: unknown; contentType?: string; encoding?: Record }) => RequestBody | undefined /** * The OpenAPI path-parameter serialization style. `simple` is the default and emits the bare value; @@ -111,7 +117,7 @@ export type Styles = { body?: Record } -function isFormBody(body: unknown): body is BodyInit { +function isFormBody(body: unknown): body is RequestBody { return ( body instanceof FormData || body instanceof URLSearchParams || @@ -163,7 +169,7 @@ function appendFormDataValue({ formData, key, value, contentType }: { formData: */ export const defaultBodySerializer: BodySerializer = ({ body, contentType, encoding }) => { if (body === undefined || body === null) return undefined - if (isFormBody(body)) return body as BodyInit + if (isFormBody(body)) return body as RequestBody if (contentType?.includes('multipart/form-data')) { const formData = new FormData() for (const [key, value] of Object.entries(body as Record)) { diff --git a/tests/3.0.x/__snapshots__/pluginAxios/default/.kubb/serializers.ts b/tests/3.0.x/__snapshots__/pluginAxios/default/.kubb/serializers.ts index dd2b2e1fc..d928f56c7 100644 --- a/tests/3.0.x/__snapshots__/pluginAxios/default/.kubb/serializers.ts +++ b/tests/3.0.x/__snapshots__/pluginAxios/default/.kubb/serializers.ts @@ -1,6 +1,12 @@ export type HeaderValue = string | number | boolean | null | undefined | object export type HeadersInit = Array<[string, HeaderValue]> | Record +/** + * The request body type `fetch` accepts, derived from `RequestInit` instead of the global `BodyInit` + * name, which a Node-only project (`@types/node` without the `dom` lib) does not declare. + */ +export type RequestBody = NonNullable + /** * The OpenAPI query-parameter serialization style. `form` is the default; `spaceDelimited` and * `pipeDelimited` join arrays with a space or pipe, and `deepObject` renders objects as @@ -67,7 +73,7 @@ export type BodyEncoding = SerializationStyle & { * `ArrayBuffer`, and string bodies pass through untouched. The optional `encoding` argument carries * the per-property OpenAPI `encoding` metadata for form bodies. */ -export type BodySerializer = (args: { body: unknown; contentType?: string; encoding?: Record }) => BodyInit | undefined +export type BodySerializer = (args: { body: unknown; contentType?: string; encoding?: Record }) => RequestBody | undefined /** * The OpenAPI path-parameter serialization style. `simple` is the default and emits the bare value; @@ -111,7 +117,7 @@ export type Styles = { body?: Record } -function isFormBody(body: unknown): body is BodyInit { +function isFormBody(body: unknown): body is RequestBody { return ( body instanceof FormData || body instanceof URLSearchParams || @@ -163,7 +169,7 @@ function appendFormDataValue({ formData, key, value, contentType }: { formData: */ export const defaultBodySerializer: BodySerializer = ({ body, contentType, encoding }) => { if (body === undefined || body === null) return undefined - if (isFormBody(body)) return body as BodyInit + if (isFormBody(body)) return body as RequestBody if (contentType?.includes('multipart/form-data')) { const formData = new FormData() for (const [key, value] of Object.entries(body as Record)) { diff --git a/tests/3.0.x/__snapshots__/pluginAxios/paramsCasing/.kubb/serializers.ts b/tests/3.0.x/__snapshots__/pluginAxios/paramsCasing/.kubb/serializers.ts index dd2b2e1fc..d928f56c7 100644 --- a/tests/3.0.x/__snapshots__/pluginAxios/paramsCasing/.kubb/serializers.ts +++ b/tests/3.0.x/__snapshots__/pluginAxios/paramsCasing/.kubb/serializers.ts @@ -1,6 +1,12 @@ export type HeaderValue = string | number | boolean | null | undefined | object export type HeadersInit = Array<[string, HeaderValue]> | Record +/** + * The request body type `fetch` accepts, derived from `RequestInit` instead of the global `BodyInit` + * name, which a Node-only project (`@types/node` without the `dom` lib) does not declare. + */ +export type RequestBody = NonNullable + /** * The OpenAPI query-parameter serialization style. `form` is the default; `spaceDelimited` and * `pipeDelimited` join arrays with a space or pipe, and `deepObject` renders objects as @@ -67,7 +73,7 @@ export type BodyEncoding = SerializationStyle & { * `ArrayBuffer`, and string bodies pass through untouched. The optional `encoding` argument carries * the per-property OpenAPI `encoding` metadata for form bodies. */ -export type BodySerializer = (args: { body: unknown; contentType?: string; encoding?: Record }) => BodyInit | undefined +export type BodySerializer = (args: { body: unknown; contentType?: string; encoding?: Record }) => RequestBody | undefined /** * The OpenAPI path-parameter serialization style. `simple` is the default and emits the bare value; @@ -111,7 +117,7 @@ export type Styles = { body?: Record } -function isFormBody(body: unknown): body is BodyInit { +function isFormBody(body: unknown): body is RequestBody { return ( body instanceof FormData || body instanceof URLSearchParams || @@ -163,7 +169,7 @@ function appendFormDataValue({ formData, key, value, contentType }: { formData: */ export const defaultBodySerializer: BodySerializer = ({ body, contentType, encoding }) => { if (body === undefined || body === null) return undefined - if (isFormBody(body)) return body as BodyInit + if (isFormBody(body)) return body as RequestBody if (contentType?.includes('multipart/form-data')) { const formData = new FormData() for (const [key, value] of Object.entries(body as Record)) { diff --git a/tests/3.0.x/__snapshots__/pluginAxios/sdkClass/.kubb/serializers.ts b/tests/3.0.x/__snapshots__/pluginAxios/sdkClass/.kubb/serializers.ts index dd2b2e1fc..d928f56c7 100644 --- a/tests/3.0.x/__snapshots__/pluginAxios/sdkClass/.kubb/serializers.ts +++ b/tests/3.0.x/__snapshots__/pluginAxios/sdkClass/.kubb/serializers.ts @@ -1,6 +1,12 @@ export type HeaderValue = string | number | boolean | null | undefined | object export type HeadersInit = Array<[string, HeaderValue]> | Record +/** + * The request body type `fetch` accepts, derived from `RequestInit` instead of the global `BodyInit` + * name, which a Node-only project (`@types/node` without the `dom` lib) does not declare. + */ +export type RequestBody = NonNullable + /** * The OpenAPI query-parameter serialization style. `form` is the default; `spaceDelimited` and * `pipeDelimited` join arrays with a space or pipe, and `deepObject` renders objects as @@ -67,7 +73,7 @@ export type BodyEncoding = SerializationStyle & { * `ArrayBuffer`, and string bodies pass through untouched. The optional `encoding` argument carries * the per-property OpenAPI `encoding` metadata for form bodies. */ -export type BodySerializer = (args: { body: unknown; contentType?: string; encoding?: Record }) => BodyInit | undefined +export type BodySerializer = (args: { body: unknown; contentType?: string; encoding?: Record }) => RequestBody | undefined /** * The OpenAPI path-parameter serialization style. `simple` is the default and emits the bare value; @@ -111,7 +117,7 @@ export type Styles = { body?: Record } -function isFormBody(body: unknown): body is BodyInit { +function isFormBody(body: unknown): body is RequestBody { return ( body instanceof FormData || body instanceof URLSearchParams || @@ -163,7 +169,7 @@ function appendFormDataValue({ formData, key, value, contentType }: { formData: */ export const defaultBodySerializer: BodySerializer = ({ body, contentType, encoding }) => { if (body === undefined || body === null) return undefined - if (isFormBody(body)) return body as BodyInit + if (isFormBody(body)) return body as RequestBody if (contentType?.includes('multipart/form-data')) { const formData = new FormData() for (const [key, value] of Object.entries(body as Record)) { diff --git a/tests/3.0.x/__snapshots__/pluginAxios/sdkClassWithName/.kubb/serializers.ts b/tests/3.0.x/__snapshots__/pluginAxios/sdkClassWithName/.kubb/serializers.ts index dd2b2e1fc..d928f56c7 100644 --- a/tests/3.0.x/__snapshots__/pluginAxios/sdkClassWithName/.kubb/serializers.ts +++ b/tests/3.0.x/__snapshots__/pluginAxios/sdkClassWithName/.kubb/serializers.ts @@ -1,6 +1,12 @@ export type HeaderValue = string | number | boolean | null | undefined | object export type HeadersInit = Array<[string, HeaderValue]> | Record +/** + * The request body type `fetch` accepts, derived from `RequestInit` instead of the global `BodyInit` + * name, which a Node-only project (`@types/node` without the `dom` lib) does not declare. + */ +export type RequestBody = NonNullable + /** * The OpenAPI query-parameter serialization style. `form` is the default; `spaceDelimited` and * `pipeDelimited` join arrays with a space or pipe, and `deepObject` renders objects as @@ -67,7 +73,7 @@ export type BodyEncoding = SerializationStyle & { * `ArrayBuffer`, and string bodies pass through untouched. The optional `encoding` argument carries * the per-property OpenAPI `encoding` metadata for form bodies. */ -export type BodySerializer = (args: { body: unknown; contentType?: string; encoding?: Record }) => BodyInit | undefined +export type BodySerializer = (args: { body: unknown; contentType?: string; encoding?: Record }) => RequestBody | undefined /** * The OpenAPI path-parameter serialization style. `simple` is the default and emits the bare value; @@ -111,7 +117,7 @@ export type Styles = { body?: Record } -function isFormBody(body: unknown): body is BodyInit { +function isFormBody(body: unknown): body is RequestBody { return ( body instanceof FormData || body instanceof URLSearchParams || @@ -163,7 +169,7 @@ function appendFormDataValue({ formData, key, value, contentType }: { formData: */ export const defaultBodySerializer: BodySerializer = ({ body, contentType, encoding }) => { if (body === undefined || body === null) return undefined - if (isFormBody(body)) return body as BodyInit + if (isFormBody(body)) return body as RequestBody if (contentType?.includes('multipart/form-data')) { const formData = new FormData() for (const [key, value] of Object.entries(body as Record)) { diff --git a/tests/3.0.x/__snapshots__/pluginAxios/sdkSingle/.kubb/serializers.ts b/tests/3.0.x/__snapshots__/pluginAxios/sdkSingle/.kubb/serializers.ts index dd2b2e1fc..d928f56c7 100644 --- a/tests/3.0.x/__snapshots__/pluginAxios/sdkSingle/.kubb/serializers.ts +++ b/tests/3.0.x/__snapshots__/pluginAxios/sdkSingle/.kubb/serializers.ts @@ -1,6 +1,12 @@ export type HeaderValue = string | number | boolean | null | undefined | object export type HeadersInit = Array<[string, HeaderValue]> | Record +/** + * The request body type `fetch` accepts, derived from `RequestInit` instead of the global `BodyInit` + * name, which a Node-only project (`@types/node` without the `dom` lib) does not declare. + */ +export type RequestBody = NonNullable + /** * The OpenAPI query-parameter serialization style. `form` is the default; `spaceDelimited` and * `pipeDelimited` join arrays with a space or pipe, and `deepObject` renders objects as @@ -67,7 +73,7 @@ export type BodyEncoding = SerializationStyle & { * `ArrayBuffer`, and string bodies pass through untouched. The optional `encoding` argument carries * the per-property OpenAPI `encoding` metadata for form bodies. */ -export type BodySerializer = (args: { body: unknown; contentType?: string; encoding?: Record }) => BodyInit | undefined +export type BodySerializer = (args: { body: unknown; contentType?: string; encoding?: Record }) => RequestBody | undefined /** * The OpenAPI path-parameter serialization style. `simple` is the default and emits the bare value; @@ -111,7 +117,7 @@ export type Styles = { body?: Record } -function isFormBody(body: unknown): body is BodyInit { +function isFormBody(body: unknown): body is RequestBody { return ( body instanceof FormData || body instanceof URLSearchParams || @@ -163,7 +169,7 @@ function appendFormDataValue({ formData, key, value, contentType }: { formData: */ export const defaultBodySerializer: BodySerializer = ({ body, contentType, encoding }) => { if (body === undefined || body === null) return undefined - if (isFormBody(body)) return body as BodyInit + if (isFormBody(body)) return body as RequestBody if (contentType?.includes('multipart/form-data')) { const formData = new FormData() for (const [key, value] of Object.entries(body as Record)) { diff --git a/tests/3.0.x/__snapshots__/pluginAxios/zodTypes/.kubb/serializers.ts b/tests/3.0.x/__snapshots__/pluginAxios/zodTypes/.kubb/serializers.ts index dd2b2e1fc..d928f56c7 100644 --- a/tests/3.0.x/__snapshots__/pluginAxios/zodTypes/.kubb/serializers.ts +++ b/tests/3.0.x/__snapshots__/pluginAxios/zodTypes/.kubb/serializers.ts @@ -1,6 +1,12 @@ export type HeaderValue = string | number | boolean | null | undefined | object export type HeadersInit = Array<[string, HeaderValue]> | Record +/** + * The request body type `fetch` accepts, derived from `RequestInit` instead of the global `BodyInit` + * name, which a Node-only project (`@types/node` without the `dom` lib) does not declare. + */ +export type RequestBody = NonNullable + /** * The OpenAPI query-parameter serialization style. `form` is the default; `spaceDelimited` and * `pipeDelimited` join arrays with a space or pipe, and `deepObject` renders objects as @@ -67,7 +73,7 @@ export type BodyEncoding = SerializationStyle & { * `ArrayBuffer`, and string bodies pass through untouched. The optional `encoding` argument carries * the per-property OpenAPI `encoding` metadata for form bodies. */ -export type BodySerializer = (args: { body: unknown; contentType?: string; encoding?: Record }) => BodyInit | undefined +export type BodySerializer = (args: { body: unknown; contentType?: string; encoding?: Record }) => RequestBody | undefined /** * The OpenAPI path-parameter serialization style. `simple` is the default and emits the bare value; @@ -111,7 +117,7 @@ export type Styles = { body?: Record } -function isFormBody(body: unknown): body is BodyInit { +function isFormBody(body: unknown): body is RequestBody { return ( body instanceof FormData || body instanceof URLSearchParams || @@ -163,7 +169,7 @@ function appendFormDataValue({ formData, key, value, contentType }: { formData: */ export const defaultBodySerializer: BodySerializer = ({ body, contentType, encoding }) => { if (body === undefined || body === null) return undefined - if (isFormBody(body)) return body as BodyInit + if (isFormBody(body)) return body as RequestBody if (contentType?.includes('multipart/form-data')) { const formData = new FormData() for (const [key, value] of Object.entries(body as Record)) { diff --git a/tests/3.0.x/__snapshots__/pluginFetch/default/.kubb/client.ts b/tests/3.0.x/__snapshots__/pluginFetch/default/.kubb/client.ts index ea6223eff..47911f024 100644 --- a/tests/3.0.x/__snapshots__/pluginFetch/default/.kubb/client.ts +++ b/tests/3.0.x/__snapshots__/pluginFetch/default/.kubb/client.ts @@ -7,6 +7,12 @@ import { type StandardSchemaValidator, validateStandardSchema } from './standard */ export type SuccessStatusCode = '200' | '201' | '202' | '203' | '204' | '205' | '206' | '207' | '208' | '226' +/** + * The request body type `fetch` accepts, derived from `RequestInit` instead of the global `BodyInit` + * name, which a Node-only project (`@types/node` without the `dom` lib) does not declare. + */ +export type RequestBody = NonNullable + /** * The success members of a per-status responses record. */ @@ -124,7 +130,7 @@ export type Deserializer = (raw: unknown, contentType: string) => T /** * Serializes a request body for a single media type, registered per content type as a codec's `serialize` to encode formats the default serializer does not handle. */ -export type ContentBodySerializer = (body: unknown, contentType?: string) => BodyInit | undefined +export type ContentBodySerializer = (body: unknown, contentType?: string) => RequestBody | undefined /** * A per-content-type codec registered on `codecs`, keyed by content type. `serialize` encodes the @@ -238,7 +244,7 @@ export type ResolvedRequest = { url: string method: string headers: Record - body?: BodyInit + body?: RequestBody signal?: AbortSignal credentials?: RequestCredentials options?: FetchOptions diff --git a/tests/3.0.x/__snapshots__/pluginFetch/default/.kubb/serializers.ts b/tests/3.0.x/__snapshots__/pluginFetch/default/.kubb/serializers.ts index dd2b2e1fc..d928f56c7 100644 --- a/tests/3.0.x/__snapshots__/pluginFetch/default/.kubb/serializers.ts +++ b/tests/3.0.x/__snapshots__/pluginFetch/default/.kubb/serializers.ts @@ -1,6 +1,12 @@ export type HeaderValue = string | number | boolean | null | undefined | object export type HeadersInit = Array<[string, HeaderValue]> | Record +/** + * The request body type `fetch` accepts, derived from `RequestInit` instead of the global `BodyInit` + * name, which a Node-only project (`@types/node` without the `dom` lib) does not declare. + */ +export type RequestBody = NonNullable + /** * The OpenAPI query-parameter serialization style. `form` is the default; `spaceDelimited` and * `pipeDelimited` join arrays with a space or pipe, and `deepObject` renders objects as @@ -67,7 +73,7 @@ export type BodyEncoding = SerializationStyle & { * `ArrayBuffer`, and string bodies pass through untouched. The optional `encoding` argument carries * the per-property OpenAPI `encoding` metadata for form bodies. */ -export type BodySerializer = (args: { body: unknown; contentType?: string; encoding?: Record }) => BodyInit | undefined +export type BodySerializer = (args: { body: unknown; contentType?: string; encoding?: Record }) => RequestBody | undefined /** * The OpenAPI path-parameter serialization style. `simple` is the default and emits the bare value; @@ -111,7 +117,7 @@ export type Styles = { body?: Record } -function isFormBody(body: unknown): body is BodyInit { +function isFormBody(body: unknown): body is RequestBody { return ( body instanceof FormData || body instanceof URLSearchParams || @@ -163,7 +169,7 @@ function appendFormDataValue({ formData, key, value, contentType }: { formData: */ export const defaultBodySerializer: BodySerializer = ({ body, contentType, encoding }) => { if (body === undefined || body === null) return undefined - if (isFormBody(body)) return body as BodyInit + if (isFormBody(body)) return body as RequestBody if (contentType?.includes('multipart/form-data')) { const formData = new FormData() for (const [key, value] of Object.entries(body as Record)) { diff --git a/tests/3.0.x/__snapshots__/pluginFetch/paramsCasing/.kubb/client.ts b/tests/3.0.x/__snapshots__/pluginFetch/paramsCasing/.kubb/client.ts index ea6223eff..47911f024 100644 --- a/tests/3.0.x/__snapshots__/pluginFetch/paramsCasing/.kubb/client.ts +++ b/tests/3.0.x/__snapshots__/pluginFetch/paramsCasing/.kubb/client.ts @@ -7,6 +7,12 @@ import { type StandardSchemaValidator, validateStandardSchema } from './standard */ export type SuccessStatusCode = '200' | '201' | '202' | '203' | '204' | '205' | '206' | '207' | '208' | '226' +/** + * The request body type `fetch` accepts, derived from `RequestInit` instead of the global `BodyInit` + * name, which a Node-only project (`@types/node` without the `dom` lib) does not declare. + */ +export type RequestBody = NonNullable + /** * The success members of a per-status responses record. */ @@ -124,7 +130,7 @@ export type Deserializer = (raw: unknown, contentType: string) => T /** * Serializes a request body for a single media type, registered per content type as a codec's `serialize` to encode formats the default serializer does not handle. */ -export type ContentBodySerializer = (body: unknown, contentType?: string) => BodyInit | undefined +export type ContentBodySerializer = (body: unknown, contentType?: string) => RequestBody | undefined /** * A per-content-type codec registered on `codecs`, keyed by content type. `serialize` encodes the @@ -238,7 +244,7 @@ export type ResolvedRequest = { url: string method: string headers: Record - body?: BodyInit + body?: RequestBody signal?: AbortSignal credentials?: RequestCredentials options?: FetchOptions diff --git a/tests/3.0.x/__snapshots__/pluginFetch/paramsCasing/.kubb/serializers.ts b/tests/3.0.x/__snapshots__/pluginFetch/paramsCasing/.kubb/serializers.ts index dd2b2e1fc..d928f56c7 100644 --- a/tests/3.0.x/__snapshots__/pluginFetch/paramsCasing/.kubb/serializers.ts +++ b/tests/3.0.x/__snapshots__/pluginFetch/paramsCasing/.kubb/serializers.ts @@ -1,6 +1,12 @@ export type HeaderValue = string | number | boolean | null | undefined | object export type HeadersInit = Array<[string, HeaderValue]> | Record +/** + * The request body type `fetch` accepts, derived from `RequestInit` instead of the global `BodyInit` + * name, which a Node-only project (`@types/node` without the `dom` lib) does not declare. + */ +export type RequestBody = NonNullable + /** * The OpenAPI query-parameter serialization style. `form` is the default; `spaceDelimited` and * `pipeDelimited` join arrays with a space or pipe, and `deepObject` renders objects as @@ -67,7 +73,7 @@ export type BodyEncoding = SerializationStyle & { * `ArrayBuffer`, and string bodies pass through untouched. The optional `encoding` argument carries * the per-property OpenAPI `encoding` metadata for form bodies. */ -export type BodySerializer = (args: { body: unknown; contentType?: string; encoding?: Record }) => BodyInit | undefined +export type BodySerializer = (args: { body: unknown; contentType?: string; encoding?: Record }) => RequestBody | undefined /** * The OpenAPI path-parameter serialization style. `simple` is the default and emits the bare value; @@ -111,7 +117,7 @@ export type Styles = { body?: Record } -function isFormBody(body: unknown): body is BodyInit { +function isFormBody(body: unknown): body is RequestBody { return ( body instanceof FormData || body instanceof URLSearchParams || @@ -163,7 +169,7 @@ function appendFormDataValue({ formData, key, value, contentType }: { formData: */ export const defaultBodySerializer: BodySerializer = ({ body, contentType, encoding }) => { if (body === undefined || body === null) return undefined - if (isFormBody(body)) return body as BodyInit + if (isFormBody(body)) return body as RequestBody if (contentType?.includes('multipart/form-data')) { const formData = new FormData() for (const [key, value] of Object.entries(body as Record)) { diff --git a/tests/3.0.x/__snapshots__/pluginFetch/sdkClass/.kubb/client.ts b/tests/3.0.x/__snapshots__/pluginFetch/sdkClass/.kubb/client.ts index ea6223eff..47911f024 100644 --- a/tests/3.0.x/__snapshots__/pluginFetch/sdkClass/.kubb/client.ts +++ b/tests/3.0.x/__snapshots__/pluginFetch/sdkClass/.kubb/client.ts @@ -7,6 +7,12 @@ import { type StandardSchemaValidator, validateStandardSchema } from './standard */ export type SuccessStatusCode = '200' | '201' | '202' | '203' | '204' | '205' | '206' | '207' | '208' | '226' +/** + * The request body type `fetch` accepts, derived from `RequestInit` instead of the global `BodyInit` + * name, which a Node-only project (`@types/node` without the `dom` lib) does not declare. + */ +export type RequestBody = NonNullable + /** * The success members of a per-status responses record. */ @@ -124,7 +130,7 @@ export type Deserializer = (raw: unknown, contentType: string) => T /** * Serializes a request body for a single media type, registered per content type as a codec's `serialize` to encode formats the default serializer does not handle. */ -export type ContentBodySerializer = (body: unknown, contentType?: string) => BodyInit | undefined +export type ContentBodySerializer = (body: unknown, contentType?: string) => RequestBody | undefined /** * A per-content-type codec registered on `codecs`, keyed by content type. `serialize` encodes the @@ -238,7 +244,7 @@ export type ResolvedRequest = { url: string method: string headers: Record - body?: BodyInit + body?: RequestBody signal?: AbortSignal credentials?: RequestCredentials options?: FetchOptions diff --git a/tests/3.0.x/__snapshots__/pluginFetch/sdkClass/.kubb/serializers.ts b/tests/3.0.x/__snapshots__/pluginFetch/sdkClass/.kubb/serializers.ts index dd2b2e1fc..d928f56c7 100644 --- a/tests/3.0.x/__snapshots__/pluginFetch/sdkClass/.kubb/serializers.ts +++ b/tests/3.0.x/__snapshots__/pluginFetch/sdkClass/.kubb/serializers.ts @@ -1,6 +1,12 @@ export type HeaderValue = string | number | boolean | null | undefined | object export type HeadersInit = Array<[string, HeaderValue]> | Record +/** + * The request body type `fetch` accepts, derived from `RequestInit` instead of the global `BodyInit` + * name, which a Node-only project (`@types/node` without the `dom` lib) does not declare. + */ +export type RequestBody = NonNullable + /** * The OpenAPI query-parameter serialization style. `form` is the default; `spaceDelimited` and * `pipeDelimited` join arrays with a space or pipe, and `deepObject` renders objects as @@ -67,7 +73,7 @@ export type BodyEncoding = SerializationStyle & { * `ArrayBuffer`, and string bodies pass through untouched. The optional `encoding` argument carries * the per-property OpenAPI `encoding` metadata for form bodies. */ -export type BodySerializer = (args: { body: unknown; contentType?: string; encoding?: Record }) => BodyInit | undefined +export type BodySerializer = (args: { body: unknown; contentType?: string; encoding?: Record }) => RequestBody | undefined /** * The OpenAPI path-parameter serialization style. `simple` is the default and emits the bare value; @@ -111,7 +117,7 @@ export type Styles = { body?: Record } -function isFormBody(body: unknown): body is BodyInit { +function isFormBody(body: unknown): body is RequestBody { return ( body instanceof FormData || body instanceof URLSearchParams || @@ -163,7 +169,7 @@ function appendFormDataValue({ formData, key, value, contentType }: { formData: */ export const defaultBodySerializer: BodySerializer = ({ body, contentType, encoding }) => { if (body === undefined || body === null) return undefined - if (isFormBody(body)) return body as BodyInit + if (isFormBody(body)) return body as RequestBody if (contentType?.includes('multipart/form-data')) { const formData = new FormData() for (const [key, value] of Object.entries(body as Record)) { diff --git a/tests/3.0.x/__snapshots__/pluginFetch/sdkClassWithName/.kubb/client.ts b/tests/3.0.x/__snapshots__/pluginFetch/sdkClassWithName/.kubb/client.ts index ea6223eff..47911f024 100644 --- a/tests/3.0.x/__snapshots__/pluginFetch/sdkClassWithName/.kubb/client.ts +++ b/tests/3.0.x/__snapshots__/pluginFetch/sdkClassWithName/.kubb/client.ts @@ -7,6 +7,12 @@ import { type StandardSchemaValidator, validateStandardSchema } from './standard */ export type SuccessStatusCode = '200' | '201' | '202' | '203' | '204' | '205' | '206' | '207' | '208' | '226' +/** + * The request body type `fetch` accepts, derived from `RequestInit` instead of the global `BodyInit` + * name, which a Node-only project (`@types/node` without the `dom` lib) does not declare. + */ +export type RequestBody = NonNullable + /** * The success members of a per-status responses record. */ @@ -124,7 +130,7 @@ export type Deserializer = (raw: unknown, contentType: string) => T /** * Serializes a request body for a single media type, registered per content type as a codec's `serialize` to encode formats the default serializer does not handle. */ -export type ContentBodySerializer = (body: unknown, contentType?: string) => BodyInit | undefined +export type ContentBodySerializer = (body: unknown, contentType?: string) => RequestBody | undefined /** * A per-content-type codec registered on `codecs`, keyed by content type. `serialize` encodes the @@ -238,7 +244,7 @@ export type ResolvedRequest = { url: string method: string headers: Record - body?: BodyInit + body?: RequestBody signal?: AbortSignal credentials?: RequestCredentials options?: FetchOptions diff --git a/tests/3.0.x/__snapshots__/pluginFetch/sdkClassWithName/.kubb/serializers.ts b/tests/3.0.x/__snapshots__/pluginFetch/sdkClassWithName/.kubb/serializers.ts index dd2b2e1fc..d928f56c7 100644 --- a/tests/3.0.x/__snapshots__/pluginFetch/sdkClassWithName/.kubb/serializers.ts +++ b/tests/3.0.x/__snapshots__/pluginFetch/sdkClassWithName/.kubb/serializers.ts @@ -1,6 +1,12 @@ export type HeaderValue = string | number | boolean | null | undefined | object export type HeadersInit = Array<[string, HeaderValue]> | Record +/** + * The request body type `fetch` accepts, derived from `RequestInit` instead of the global `BodyInit` + * name, which a Node-only project (`@types/node` without the `dom` lib) does not declare. + */ +export type RequestBody = NonNullable + /** * The OpenAPI query-parameter serialization style. `form` is the default; `spaceDelimited` and * `pipeDelimited` join arrays with a space or pipe, and `deepObject` renders objects as @@ -67,7 +73,7 @@ export type BodyEncoding = SerializationStyle & { * `ArrayBuffer`, and string bodies pass through untouched. The optional `encoding` argument carries * the per-property OpenAPI `encoding` metadata for form bodies. */ -export type BodySerializer = (args: { body: unknown; contentType?: string; encoding?: Record }) => BodyInit | undefined +export type BodySerializer = (args: { body: unknown; contentType?: string; encoding?: Record }) => RequestBody | undefined /** * The OpenAPI path-parameter serialization style. `simple` is the default and emits the bare value; @@ -111,7 +117,7 @@ export type Styles = { body?: Record } -function isFormBody(body: unknown): body is BodyInit { +function isFormBody(body: unknown): body is RequestBody { return ( body instanceof FormData || body instanceof URLSearchParams || @@ -163,7 +169,7 @@ function appendFormDataValue({ formData, key, value, contentType }: { formData: */ export const defaultBodySerializer: BodySerializer = ({ body, contentType, encoding }) => { if (body === undefined || body === null) return undefined - if (isFormBody(body)) return body as BodyInit + if (isFormBody(body)) return body as RequestBody if (contentType?.includes('multipart/form-data')) { const formData = new FormData() for (const [key, value] of Object.entries(body as Record)) { diff --git a/tests/3.0.x/__snapshots__/pluginFetch/sdkSingle/.kubb/client.ts b/tests/3.0.x/__snapshots__/pluginFetch/sdkSingle/.kubb/client.ts index ea6223eff..47911f024 100644 --- a/tests/3.0.x/__snapshots__/pluginFetch/sdkSingle/.kubb/client.ts +++ b/tests/3.0.x/__snapshots__/pluginFetch/sdkSingle/.kubb/client.ts @@ -7,6 +7,12 @@ import { type StandardSchemaValidator, validateStandardSchema } from './standard */ export type SuccessStatusCode = '200' | '201' | '202' | '203' | '204' | '205' | '206' | '207' | '208' | '226' +/** + * The request body type `fetch` accepts, derived from `RequestInit` instead of the global `BodyInit` + * name, which a Node-only project (`@types/node` without the `dom` lib) does not declare. + */ +export type RequestBody = NonNullable + /** * The success members of a per-status responses record. */ @@ -124,7 +130,7 @@ export type Deserializer = (raw: unknown, contentType: string) => T /** * Serializes a request body for a single media type, registered per content type as a codec's `serialize` to encode formats the default serializer does not handle. */ -export type ContentBodySerializer = (body: unknown, contentType?: string) => BodyInit | undefined +export type ContentBodySerializer = (body: unknown, contentType?: string) => RequestBody | undefined /** * A per-content-type codec registered on `codecs`, keyed by content type. `serialize` encodes the @@ -238,7 +244,7 @@ export type ResolvedRequest = { url: string method: string headers: Record - body?: BodyInit + body?: RequestBody signal?: AbortSignal credentials?: RequestCredentials options?: FetchOptions diff --git a/tests/3.0.x/__snapshots__/pluginFetch/sdkSingle/.kubb/serializers.ts b/tests/3.0.x/__snapshots__/pluginFetch/sdkSingle/.kubb/serializers.ts index dd2b2e1fc..d928f56c7 100644 --- a/tests/3.0.x/__snapshots__/pluginFetch/sdkSingle/.kubb/serializers.ts +++ b/tests/3.0.x/__snapshots__/pluginFetch/sdkSingle/.kubb/serializers.ts @@ -1,6 +1,12 @@ export type HeaderValue = string | number | boolean | null | undefined | object export type HeadersInit = Array<[string, HeaderValue]> | Record +/** + * The request body type `fetch` accepts, derived from `RequestInit` instead of the global `BodyInit` + * name, which a Node-only project (`@types/node` without the `dom` lib) does not declare. + */ +export type RequestBody = NonNullable + /** * The OpenAPI query-parameter serialization style. `form` is the default; `spaceDelimited` and * `pipeDelimited` join arrays with a space or pipe, and `deepObject` renders objects as @@ -67,7 +73,7 @@ export type BodyEncoding = SerializationStyle & { * `ArrayBuffer`, and string bodies pass through untouched. The optional `encoding` argument carries * the per-property OpenAPI `encoding` metadata for form bodies. */ -export type BodySerializer = (args: { body: unknown; contentType?: string; encoding?: Record }) => BodyInit | undefined +export type BodySerializer = (args: { body: unknown; contentType?: string; encoding?: Record }) => RequestBody | undefined /** * The OpenAPI path-parameter serialization style. `simple` is the default and emits the bare value; @@ -111,7 +117,7 @@ export type Styles = { body?: Record } -function isFormBody(body: unknown): body is BodyInit { +function isFormBody(body: unknown): body is RequestBody { return ( body instanceof FormData || body instanceof URLSearchParams || @@ -163,7 +169,7 @@ function appendFormDataValue({ formData, key, value, contentType }: { formData: */ export const defaultBodySerializer: BodySerializer = ({ body, contentType, encoding }) => { if (body === undefined || body === null) return undefined - if (isFormBody(body)) return body as BodyInit + if (isFormBody(body)) return body as RequestBody if (contentType?.includes('multipart/form-data')) { const formData = new FormData() for (const [key, value] of Object.entries(body as Record)) { diff --git a/tests/3.0.x/__snapshots__/pluginFetch/zodTypes/.kubb/client.ts b/tests/3.0.x/__snapshots__/pluginFetch/zodTypes/.kubb/client.ts index ea6223eff..47911f024 100644 --- a/tests/3.0.x/__snapshots__/pluginFetch/zodTypes/.kubb/client.ts +++ b/tests/3.0.x/__snapshots__/pluginFetch/zodTypes/.kubb/client.ts @@ -7,6 +7,12 @@ import { type StandardSchemaValidator, validateStandardSchema } from './standard */ export type SuccessStatusCode = '200' | '201' | '202' | '203' | '204' | '205' | '206' | '207' | '208' | '226' +/** + * The request body type `fetch` accepts, derived from `RequestInit` instead of the global `BodyInit` + * name, which a Node-only project (`@types/node` without the `dom` lib) does not declare. + */ +export type RequestBody = NonNullable + /** * The success members of a per-status responses record. */ @@ -124,7 +130,7 @@ export type Deserializer = (raw: unknown, contentType: string) => T /** * Serializes a request body for a single media type, registered per content type as a codec's `serialize` to encode formats the default serializer does not handle. */ -export type ContentBodySerializer = (body: unknown, contentType?: string) => BodyInit | undefined +export type ContentBodySerializer = (body: unknown, contentType?: string) => RequestBody | undefined /** * A per-content-type codec registered on `codecs`, keyed by content type. `serialize` encodes the @@ -238,7 +244,7 @@ export type ResolvedRequest = { url: string method: string headers: Record - body?: BodyInit + body?: RequestBody signal?: AbortSignal credentials?: RequestCredentials options?: FetchOptions diff --git a/tests/3.0.x/__snapshots__/pluginFetch/zodTypes/.kubb/serializers.ts b/tests/3.0.x/__snapshots__/pluginFetch/zodTypes/.kubb/serializers.ts index dd2b2e1fc..d928f56c7 100644 --- a/tests/3.0.x/__snapshots__/pluginFetch/zodTypes/.kubb/serializers.ts +++ b/tests/3.0.x/__snapshots__/pluginFetch/zodTypes/.kubb/serializers.ts @@ -1,6 +1,12 @@ export type HeaderValue = string | number | boolean | null | undefined | object export type HeadersInit = Array<[string, HeaderValue]> | Record +/** + * The request body type `fetch` accepts, derived from `RequestInit` instead of the global `BodyInit` + * name, which a Node-only project (`@types/node` without the `dom` lib) does not declare. + */ +export type RequestBody = NonNullable + /** * The OpenAPI query-parameter serialization style. `form` is the default; `spaceDelimited` and * `pipeDelimited` join arrays with a space or pipe, and `deepObject` renders objects as @@ -67,7 +73,7 @@ export type BodyEncoding = SerializationStyle & { * `ArrayBuffer`, and string bodies pass through untouched. The optional `encoding` argument carries * the per-property OpenAPI `encoding` metadata for form bodies. */ -export type BodySerializer = (args: { body: unknown; contentType?: string; encoding?: Record }) => BodyInit | undefined +export type BodySerializer = (args: { body: unknown; contentType?: string; encoding?: Record }) => RequestBody | undefined /** * The OpenAPI path-parameter serialization style. `simple` is the default and emits the bare value; @@ -111,7 +117,7 @@ export type Styles = { body?: Record } -function isFormBody(body: unknown): body is BodyInit { +function isFormBody(body: unknown): body is RequestBody { return ( body instanceof FormData || body instanceof URLSearchParams || @@ -163,7 +169,7 @@ function appendFormDataValue({ formData, key, value, contentType }: { formData: */ export const defaultBodySerializer: BodySerializer = ({ body, contentType, encoding }) => { if (body === undefined || body === null) return undefined - if (isFormBody(body)) return body as BodyInit + if (isFormBody(body)) return body as RequestBody if (contentType?.includes('multipart/form-data')) { const formData = new FormData() for (const [key, value] of Object.entries(body as Record)) { diff --git a/tests/3.0.x/__snapshots__/pluginFetch/zodTypesSdk/.kubb/client.ts b/tests/3.0.x/__snapshots__/pluginFetch/zodTypesSdk/.kubb/client.ts index ea6223eff..47911f024 100644 --- a/tests/3.0.x/__snapshots__/pluginFetch/zodTypesSdk/.kubb/client.ts +++ b/tests/3.0.x/__snapshots__/pluginFetch/zodTypesSdk/.kubb/client.ts @@ -7,6 +7,12 @@ import { type StandardSchemaValidator, validateStandardSchema } from './standard */ export type SuccessStatusCode = '200' | '201' | '202' | '203' | '204' | '205' | '206' | '207' | '208' | '226' +/** + * The request body type `fetch` accepts, derived from `RequestInit` instead of the global `BodyInit` + * name, which a Node-only project (`@types/node` without the `dom` lib) does not declare. + */ +export type RequestBody = NonNullable + /** * The success members of a per-status responses record. */ @@ -124,7 +130,7 @@ export type Deserializer = (raw: unknown, contentType: string) => T /** * Serializes a request body for a single media type, registered per content type as a codec's `serialize` to encode formats the default serializer does not handle. */ -export type ContentBodySerializer = (body: unknown, contentType?: string) => BodyInit | undefined +export type ContentBodySerializer = (body: unknown, contentType?: string) => RequestBody | undefined /** * A per-content-type codec registered on `codecs`, keyed by content type. `serialize` encodes the @@ -238,7 +244,7 @@ export type ResolvedRequest = { url: string method: string headers: Record - body?: BodyInit + body?: RequestBody signal?: AbortSignal credentials?: RequestCredentials options?: FetchOptions diff --git a/tests/3.0.x/__snapshots__/pluginFetch/zodTypesSdk/.kubb/serializers.ts b/tests/3.0.x/__snapshots__/pluginFetch/zodTypesSdk/.kubb/serializers.ts index dd2b2e1fc..d928f56c7 100644 --- a/tests/3.0.x/__snapshots__/pluginFetch/zodTypesSdk/.kubb/serializers.ts +++ b/tests/3.0.x/__snapshots__/pluginFetch/zodTypesSdk/.kubb/serializers.ts @@ -1,6 +1,12 @@ export type HeaderValue = string | number | boolean | null | undefined | object export type HeadersInit = Array<[string, HeaderValue]> | Record +/** + * The request body type `fetch` accepts, derived from `RequestInit` instead of the global `BodyInit` + * name, which a Node-only project (`@types/node` without the `dom` lib) does not declare. + */ +export type RequestBody = NonNullable + /** * The OpenAPI query-parameter serialization style. `form` is the default; `spaceDelimited` and * `pipeDelimited` join arrays with a space or pipe, and `deepObject` renders objects as @@ -67,7 +73,7 @@ export type BodyEncoding = SerializationStyle & { * `ArrayBuffer`, and string bodies pass through untouched. The optional `encoding` argument carries * the per-property OpenAPI `encoding` metadata for form bodies. */ -export type BodySerializer = (args: { body: unknown; contentType?: string; encoding?: Record }) => BodyInit | undefined +export type BodySerializer = (args: { body: unknown; contentType?: string; encoding?: Record }) => RequestBody | undefined /** * The OpenAPI path-parameter serialization style. `simple` is the default and emits the bare value; @@ -111,7 +117,7 @@ export type Styles = { body?: Record } -function isFormBody(body: unknown): body is BodyInit { +function isFormBody(body: unknown): body is RequestBody { return ( body instanceof FormData || body instanceof URLSearchParams || @@ -163,7 +169,7 @@ function appendFormDataValue({ formData, key, value, contentType }: { formData: */ export const defaultBodySerializer: BodySerializer = ({ body, contentType, encoding }) => { if (body === undefined || body === null) return undefined - if (isFormBody(body)) return body as BodyInit + if (isFormBody(body)) return body as RequestBody if (contentType?.includes('multipart/form-data')) { const formData = new FormData() for (const [key, value] of Object.entries(body as Record)) { diff --git a/tests/3.0.x/__snapshots__/pluginMcp/excludeByOperationId/.kubb/serializers.ts b/tests/3.0.x/__snapshots__/pluginMcp/excludeByOperationId/.kubb/serializers.ts index dd2b2e1fc..d928f56c7 100644 --- a/tests/3.0.x/__snapshots__/pluginMcp/excludeByOperationId/.kubb/serializers.ts +++ b/tests/3.0.x/__snapshots__/pluginMcp/excludeByOperationId/.kubb/serializers.ts @@ -1,6 +1,12 @@ export type HeaderValue = string | number | boolean | null | undefined | object export type HeadersInit = Array<[string, HeaderValue]> | Record +/** + * The request body type `fetch` accepts, derived from `RequestInit` instead of the global `BodyInit` + * name, which a Node-only project (`@types/node` without the `dom` lib) does not declare. + */ +export type RequestBody = NonNullable + /** * The OpenAPI query-parameter serialization style. `form` is the default; `spaceDelimited` and * `pipeDelimited` join arrays with a space or pipe, and `deepObject` renders objects as @@ -67,7 +73,7 @@ export type BodyEncoding = SerializationStyle & { * `ArrayBuffer`, and string bodies pass through untouched. The optional `encoding` argument carries * the per-property OpenAPI `encoding` metadata for form bodies. */ -export type BodySerializer = (args: { body: unknown; contentType?: string; encoding?: Record }) => BodyInit | undefined +export type BodySerializer = (args: { body: unknown; contentType?: string; encoding?: Record }) => RequestBody | undefined /** * The OpenAPI path-parameter serialization style. `simple` is the default and emits the bare value; @@ -111,7 +117,7 @@ export type Styles = { body?: Record } -function isFormBody(body: unknown): body is BodyInit { +function isFormBody(body: unknown): body is RequestBody { return ( body instanceof FormData || body instanceof URLSearchParams || @@ -163,7 +169,7 @@ function appendFormDataValue({ formData, key, value, contentType }: { formData: */ export const defaultBodySerializer: BodySerializer = ({ body, contentType, encoding }) => { if (body === undefined || body === null) return undefined - if (isFormBody(body)) return body as BodyInit + if (isFormBody(body)) return body as RequestBody if (contentType?.includes('multipart/form-data')) { const formData = new FormData() for (const [key, value] of Object.entries(body as Record)) { diff --git a/tests/3.0.x/__snapshots__/pluginMcp/groupByTag/.kubb/serializers.ts b/tests/3.0.x/__snapshots__/pluginMcp/groupByTag/.kubb/serializers.ts index dd2b2e1fc..d928f56c7 100644 --- a/tests/3.0.x/__snapshots__/pluginMcp/groupByTag/.kubb/serializers.ts +++ b/tests/3.0.x/__snapshots__/pluginMcp/groupByTag/.kubb/serializers.ts @@ -1,6 +1,12 @@ export type HeaderValue = string | number | boolean | null | undefined | object export type HeadersInit = Array<[string, HeaderValue]> | Record +/** + * The request body type `fetch` accepts, derived from `RequestInit` instead of the global `BodyInit` + * name, which a Node-only project (`@types/node` without the `dom` lib) does not declare. + */ +export type RequestBody = NonNullable + /** * The OpenAPI query-parameter serialization style. `form` is the default; `spaceDelimited` and * `pipeDelimited` join arrays with a space or pipe, and `deepObject` renders objects as @@ -67,7 +73,7 @@ export type BodyEncoding = SerializationStyle & { * `ArrayBuffer`, and string bodies pass through untouched. The optional `encoding` argument carries * the per-property OpenAPI `encoding` metadata for form bodies. */ -export type BodySerializer = (args: { body: unknown; contentType?: string; encoding?: Record }) => BodyInit | undefined +export type BodySerializer = (args: { body: unknown; contentType?: string; encoding?: Record }) => RequestBody | undefined /** * The OpenAPI path-parameter serialization style. `simple` is the default and emits the bare value; @@ -111,7 +117,7 @@ export type Styles = { body?: Record } -function isFormBody(body: unknown): body is BodyInit { +function isFormBody(body: unknown): body is RequestBody { return ( body instanceof FormData || body instanceof URLSearchParams || @@ -163,7 +169,7 @@ function appendFormDataValue({ formData, key, value, contentType }: { formData: */ export const defaultBodySerializer: BodySerializer = ({ body, contentType, encoding }) => { if (body === undefined || body === null) return undefined - if (isFormBody(body)) return body as BodyInit + if (isFormBody(body)) return body as RequestBody if (contentType?.includes('multipart/form-data')) { const formData = new FormData() for (const [key, value] of Object.entries(body as Record)) { diff --git a/tests/3.0.x/__snapshots__/pluginMcp/includeByTag/.kubb/serializers.ts b/tests/3.0.x/__snapshots__/pluginMcp/includeByTag/.kubb/serializers.ts index dd2b2e1fc..d928f56c7 100644 --- a/tests/3.0.x/__snapshots__/pluginMcp/includeByTag/.kubb/serializers.ts +++ b/tests/3.0.x/__snapshots__/pluginMcp/includeByTag/.kubb/serializers.ts @@ -1,6 +1,12 @@ export type HeaderValue = string | number | boolean | null | undefined | object export type HeadersInit = Array<[string, HeaderValue]> | Record +/** + * The request body type `fetch` accepts, derived from `RequestInit` instead of the global `BodyInit` + * name, which a Node-only project (`@types/node` without the `dom` lib) does not declare. + */ +export type RequestBody = NonNullable + /** * The OpenAPI query-parameter serialization style. `form` is the default; `spaceDelimited` and * `pipeDelimited` join arrays with a space or pipe, and `deepObject` renders objects as @@ -67,7 +73,7 @@ export type BodyEncoding = SerializationStyle & { * `ArrayBuffer`, and string bodies pass through untouched. The optional `encoding` argument carries * the per-property OpenAPI `encoding` metadata for form bodies. */ -export type BodySerializer = (args: { body: unknown; contentType?: string; encoding?: Record }) => BodyInit | undefined +export type BodySerializer = (args: { body: unknown; contentType?: string; encoding?: Record }) => RequestBody | undefined /** * The OpenAPI path-parameter serialization style. `simple` is the default and emits the bare value; @@ -111,7 +117,7 @@ export type Styles = { body?: Record } -function isFormBody(body: unknown): body is BodyInit { +function isFormBody(body: unknown): body is RequestBody { return ( body instanceof FormData || body instanceof URLSearchParams || @@ -163,7 +169,7 @@ function appendFormDataValue({ formData, key, value, contentType }: { formData: */ export const defaultBodySerializer: BodySerializer = ({ body, contentType, encoding }) => { if (body === undefined || body === null) return undefined - if (isFormBody(body)) return body as BodyInit + if (isFormBody(body)) return body as RequestBody if (contentType?.includes('multipart/form-data')) { const formData = new FormData() for (const [key, value] of Object.entries(body as Record)) { diff --git a/tests/3.0.x/__snapshots__/pluginMcp/paramsCasing/.kubb/serializers.ts b/tests/3.0.x/__snapshots__/pluginMcp/paramsCasing/.kubb/serializers.ts index dd2b2e1fc..d928f56c7 100644 --- a/tests/3.0.x/__snapshots__/pluginMcp/paramsCasing/.kubb/serializers.ts +++ b/tests/3.0.x/__snapshots__/pluginMcp/paramsCasing/.kubb/serializers.ts @@ -1,6 +1,12 @@ export type HeaderValue = string | number | boolean | null | undefined | object export type HeadersInit = Array<[string, HeaderValue]> | Record +/** + * The request body type `fetch` accepts, derived from `RequestInit` instead of the global `BodyInit` + * name, which a Node-only project (`@types/node` without the `dom` lib) does not declare. + */ +export type RequestBody = NonNullable + /** * The OpenAPI query-parameter serialization style. `form` is the default; `spaceDelimited` and * `pipeDelimited` join arrays with a space or pipe, and `deepObject` renders objects as @@ -67,7 +73,7 @@ export type BodyEncoding = SerializationStyle & { * `ArrayBuffer`, and string bodies pass through untouched. The optional `encoding` argument carries * the per-property OpenAPI `encoding` metadata for form bodies. */ -export type BodySerializer = (args: { body: unknown; contentType?: string; encoding?: Record }) => BodyInit | undefined +export type BodySerializer = (args: { body: unknown; contentType?: string; encoding?: Record }) => RequestBody | undefined /** * The OpenAPI path-parameter serialization style. `simple` is the default and emits the bare value; @@ -111,7 +117,7 @@ export type Styles = { body?: Record } -function isFormBody(body: unknown): body is BodyInit { +function isFormBody(body: unknown): body is RequestBody { return ( body instanceof FormData || body instanceof URLSearchParams || @@ -163,7 +169,7 @@ function appendFormDataValue({ formData, key, value, contentType }: { formData: */ export const defaultBodySerializer: BodySerializer = ({ body, contentType, encoding }) => { if (body === undefined || body === null) return undefined - if (isFormBody(body)) return body as BodyInit + if (isFormBody(body)) return body as RequestBody if (contentType?.includes('multipart/form-data')) { const formData = new FormData() for (const [key, value] of Object.entries(body as Record)) { diff --git a/tests/3.0.x/__snapshots__/pluginMcp/petStore/.kubb/serializers.ts b/tests/3.0.x/__snapshots__/pluginMcp/petStore/.kubb/serializers.ts index dd2b2e1fc..d928f56c7 100644 --- a/tests/3.0.x/__snapshots__/pluginMcp/petStore/.kubb/serializers.ts +++ b/tests/3.0.x/__snapshots__/pluginMcp/petStore/.kubb/serializers.ts @@ -1,6 +1,12 @@ export type HeaderValue = string | number | boolean | null | undefined | object export type HeadersInit = Array<[string, HeaderValue]> | Record +/** + * The request body type `fetch` accepts, derived from `RequestInit` instead of the global `BodyInit` + * name, which a Node-only project (`@types/node` without the `dom` lib) does not declare. + */ +export type RequestBody = NonNullable + /** * The OpenAPI query-parameter serialization style. `form` is the default; `spaceDelimited` and * `pipeDelimited` join arrays with a space or pipe, and `deepObject` renders objects as @@ -67,7 +73,7 @@ export type BodyEncoding = SerializationStyle & { * `ArrayBuffer`, and string bodies pass through untouched. The optional `encoding` argument carries * the per-property OpenAPI `encoding` metadata for form bodies. */ -export type BodySerializer = (args: { body: unknown; contentType?: string; encoding?: Record }) => BodyInit | undefined +export type BodySerializer = (args: { body: unknown; contentType?: string; encoding?: Record }) => RequestBody | undefined /** * The OpenAPI path-parameter serialization style. `simple` is the default and emits the bare value; @@ -111,7 +117,7 @@ export type Styles = { body?: Record } -function isFormBody(body: unknown): body is BodyInit { +function isFormBody(body: unknown): body is RequestBody { return ( body instanceof FormData || body instanceof URLSearchParams || @@ -163,7 +169,7 @@ function appendFormDataValue({ formData, key, value, contentType }: { formData: */ export const defaultBodySerializer: BodySerializer = ({ body, contentType, encoding }) => { if (body === undefined || body === null) return undefined - if (isFormBody(body)) return body as BodyInit + if (isFormBody(body)) return body as RequestBody if (contentType?.includes('multipart/form-data')) { const formData = new FormData() for (const [key, value] of Object.entries(body as Record)) { diff --git a/tests/3.0.x/__snapshots__/pluginMcp/withClientPlugin/.kubb/serializers.ts b/tests/3.0.x/__snapshots__/pluginMcp/withClientPlugin/.kubb/serializers.ts index dd2b2e1fc..d928f56c7 100644 --- a/tests/3.0.x/__snapshots__/pluginMcp/withClientPlugin/.kubb/serializers.ts +++ b/tests/3.0.x/__snapshots__/pluginMcp/withClientPlugin/.kubb/serializers.ts @@ -1,6 +1,12 @@ export type HeaderValue = string | number | boolean | null | undefined | object export type HeadersInit = Array<[string, HeaderValue]> | Record +/** + * The request body type `fetch` accepts, derived from `RequestInit` instead of the global `BodyInit` + * name, which a Node-only project (`@types/node` without the `dom` lib) does not declare. + */ +export type RequestBody = NonNullable + /** * The OpenAPI query-parameter serialization style. `form` is the default; `spaceDelimited` and * `pipeDelimited` join arrays with a space or pipe, and `deepObject` renders objects as @@ -67,7 +73,7 @@ export type BodyEncoding = SerializationStyle & { * `ArrayBuffer`, and string bodies pass through untouched. The optional `encoding` argument carries * the per-property OpenAPI `encoding` metadata for form bodies. */ -export type BodySerializer = (args: { body: unknown; contentType?: string; encoding?: Record }) => BodyInit | undefined +export type BodySerializer = (args: { body: unknown; contentType?: string; encoding?: Record }) => RequestBody | undefined /** * The OpenAPI path-parameter serialization style. `simple` is the default and emits the bare value; @@ -111,7 +117,7 @@ export type Styles = { body?: Record } -function isFormBody(body: unknown): body is BodyInit { +function isFormBody(body: unknown): body is RequestBody { return ( body instanceof FormData || body instanceof URLSearchParams || @@ -163,7 +169,7 @@ function appendFormDataValue({ formData, key, value, contentType }: { formData: */ export const defaultBodySerializer: BodySerializer = ({ body, contentType, encoding }) => { if (body === undefined || body === null) return undefined - if (isFormBody(body)) return body as BodyInit + if (isFormBody(body)) return body as RequestBody if (contentType?.includes('multipart/form-data')) { const formData = new FormData() for (const [key, value] of Object.entries(body as Record)) { diff --git a/tests/3.0.x/__snapshots__/pluginReactQuery/excludeByOperationId/.kubb/serializers.ts b/tests/3.0.x/__snapshots__/pluginReactQuery/excludeByOperationId/.kubb/serializers.ts index dd2b2e1fc..d928f56c7 100644 --- a/tests/3.0.x/__snapshots__/pluginReactQuery/excludeByOperationId/.kubb/serializers.ts +++ b/tests/3.0.x/__snapshots__/pluginReactQuery/excludeByOperationId/.kubb/serializers.ts @@ -1,6 +1,12 @@ export type HeaderValue = string | number | boolean | null | undefined | object export type HeadersInit = Array<[string, HeaderValue]> | Record +/** + * The request body type `fetch` accepts, derived from `RequestInit` instead of the global `BodyInit` + * name, which a Node-only project (`@types/node` without the `dom` lib) does not declare. + */ +export type RequestBody = NonNullable + /** * The OpenAPI query-parameter serialization style. `form` is the default; `spaceDelimited` and * `pipeDelimited` join arrays with a space or pipe, and `deepObject` renders objects as @@ -67,7 +73,7 @@ export type BodyEncoding = SerializationStyle & { * `ArrayBuffer`, and string bodies pass through untouched. The optional `encoding` argument carries * the per-property OpenAPI `encoding` metadata for form bodies. */ -export type BodySerializer = (args: { body: unknown; contentType?: string; encoding?: Record }) => BodyInit | undefined +export type BodySerializer = (args: { body: unknown; contentType?: string; encoding?: Record }) => RequestBody | undefined /** * The OpenAPI path-parameter serialization style. `simple` is the default and emits the bare value; @@ -111,7 +117,7 @@ export type Styles = { body?: Record } -function isFormBody(body: unknown): body is BodyInit { +function isFormBody(body: unknown): body is RequestBody { return ( body instanceof FormData || body instanceof URLSearchParams || @@ -163,7 +169,7 @@ function appendFormDataValue({ formData, key, value, contentType }: { formData: */ export const defaultBodySerializer: BodySerializer = ({ body, contentType, encoding }) => { if (body === undefined || body === null) return undefined - if (isFormBody(body)) return body as BodyInit + if (isFormBody(body)) return body as RequestBody if (contentType?.includes('multipart/form-data')) { const formData = new FormData() for (const [key, value] of Object.entries(body as Record)) { diff --git a/tests/3.0.x/__snapshots__/pluginReactQuery/groupByTag/.kubb/serializers.ts b/tests/3.0.x/__snapshots__/pluginReactQuery/groupByTag/.kubb/serializers.ts index dd2b2e1fc..d928f56c7 100644 --- a/tests/3.0.x/__snapshots__/pluginReactQuery/groupByTag/.kubb/serializers.ts +++ b/tests/3.0.x/__snapshots__/pluginReactQuery/groupByTag/.kubb/serializers.ts @@ -1,6 +1,12 @@ export type HeaderValue = string | number | boolean | null | undefined | object export type HeadersInit = Array<[string, HeaderValue]> | Record +/** + * The request body type `fetch` accepts, derived from `RequestInit` instead of the global `BodyInit` + * name, which a Node-only project (`@types/node` without the `dom` lib) does not declare. + */ +export type RequestBody = NonNullable + /** * The OpenAPI query-parameter serialization style. `form` is the default; `spaceDelimited` and * `pipeDelimited` join arrays with a space or pipe, and `deepObject` renders objects as @@ -67,7 +73,7 @@ export type BodyEncoding = SerializationStyle & { * `ArrayBuffer`, and string bodies pass through untouched. The optional `encoding` argument carries * the per-property OpenAPI `encoding` metadata for form bodies. */ -export type BodySerializer = (args: { body: unknown; contentType?: string; encoding?: Record }) => BodyInit | undefined +export type BodySerializer = (args: { body: unknown; contentType?: string; encoding?: Record }) => RequestBody | undefined /** * The OpenAPI path-parameter serialization style. `simple` is the default and emits the bare value; @@ -111,7 +117,7 @@ export type Styles = { body?: Record } -function isFormBody(body: unknown): body is BodyInit { +function isFormBody(body: unknown): body is RequestBody { return ( body instanceof FormData || body instanceof URLSearchParams || @@ -163,7 +169,7 @@ function appendFormDataValue({ formData, key, value, contentType }: { formData: */ export const defaultBodySerializer: BodySerializer = ({ body, contentType, encoding }) => { if (body === undefined || body === null) return undefined - if (isFormBody(body)) return body as BodyInit + if (isFormBody(body)) return body as RequestBody if (contentType?.includes('multipart/form-data')) { const formData = new FormData() for (const [key, value] of Object.entries(body as Record)) { diff --git a/tests/3.0.x/__snapshots__/pluginReactQuery/includeByTag/.kubb/serializers.ts b/tests/3.0.x/__snapshots__/pluginReactQuery/includeByTag/.kubb/serializers.ts index dd2b2e1fc..d928f56c7 100644 --- a/tests/3.0.x/__snapshots__/pluginReactQuery/includeByTag/.kubb/serializers.ts +++ b/tests/3.0.x/__snapshots__/pluginReactQuery/includeByTag/.kubb/serializers.ts @@ -1,6 +1,12 @@ export type HeaderValue = string | number | boolean | null | undefined | object export type HeadersInit = Array<[string, HeaderValue]> | Record +/** + * The request body type `fetch` accepts, derived from `RequestInit` instead of the global `BodyInit` + * name, which a Node-only project (`@types/node` without the `dom` lib) does not declare. + */ +export type RequestBody = NonNullable + /** * The OpenAPI query-parameter serialization style. `form` is the default; `spaceDelimited` and * `pipeDelimited` join arrays with a space or pipe, and `deepObject` renders objects as @@ -67,7 +73,7 @@ export type BodyEncoding = SerializationStyle & { * `ArrayBuffer`, and string bodies pass through untouched. The optional `encoding` argument carries * the per-property OpenAPI `encoding` metadata for form bodies. */ -export type BodySerializer = (args: { body: unknown; contentType?: string; encoding?: Record }) => BodyInit | undefined +export type BodySerializer = (args: { body: unknown; contentType?: string; encoding?: Record }) => RequestBody | undefined /** * The OpenAPI path-parameter serialization style. `simple` is the default and emits the bare value; @@ -111,7 +117,7 @@ export type Styles = { body?: Record } -function isFormBody(body: unknown): body is BodyInit { +function isFormBody(body: unknown): body is RequestBody { return ( body instanceof FormData || body instanceof URLSearchParams || @@ -163,7 +169,7 @@ function appendFormDataValue({ formData, key, value, contentType }: { formData: */ export const defaultBodySerializer: BodySerializer = ({ body, contentType, encoding }) => { if (body === undefined || body === null) return undefined - if (isFormBody(body)) return body as BodyInit + if (isFormBody(body)) return body as RequestBody if (contentType?.includes('multipart/form-data')) { const formData = new FormData() for (const [key, value] of Object.entries(body as Record)) { diff --git a/tests/3.0.x/__snapshots__/pluginReactQuery/infinite/.kubb/serializers.ts b/tests/3.0.x/__snapshots__/pluginReactQuery/infinite/.kubb/serializers.ts index dd2b2e1fc..d928f56c7 100644 --- a/tests/3.0.x/__snapshots__/pluginReactQuery/infinite/.kubb/serializers.ts +++ b/tests/3.0.x/__snapshots__/pluginReactQuery/infinite/.kubb/serializers.ts @@ -1,6 +1,12 @@ export type HeaderValue = string | number | boolean | null | undefined | object export type HeadersInit = Array<[string, HeaderValue]> | Record +/** + * The request body type `fetch` accepts, derived from `RequestInit` instead of the global `BodyInit` + * name, which a Node-only project (`@types/node` without the `dom` lib) does not declare. + */ +export type RequestBody = NonNullable + /** * The OpenAPI query-parameter serialization style. `form` is the default; `spaceDelimited` and * `pipeDelimited` join arrays with a space or pipe, and `deepObject` renders objects as @@ -67,7 +73,7 @@ export type BodyEncoding = SerializationStyle & { * `ArrayBuffer`, and string bodies pass through untouched. The optional `encoding` argument carries * the per-property OpenAPI `encoding` metadata for form bodies. */ -export type BodySerializer = (args: { body: unknown; contentType?: string; encoding?: Record }) => BodyInit | undefined +export type BodySerializer = (args: { body: unknown; contentType?: string; encoding?: Record }) => RequestBody | undefined /** * The OpenAPI path-parameter serialization style. `simple` is the default and emits the bare value; @@ -111,7 +117,7 @@ export type Styles = { body?: Record } -function isFormBody(body: unknown): body is BodyInit { +function isFormBody(body: unknown): body is RequestBody { return ( body instanceof FormData || body instanceof URLSearchParams || @@ -163,7 +169,7 @@ function appendFormDataValue({ formData, key, value, contentType }: { formData: */ export const defaultBodySerializer: BodySerializer = ({ body, contentType, encoding }) => { if (body === undefined || body === null) return undefined - if (isFormBody(body)) return body as BodyInit + if (isFormBody(body)) return body as RequestBody if (contentType?.includes('multipart/form-data')) { const formData = new FormData() for (const [key, value] of Object.entries(body as Record)) { diff --git a/tests/3.0.x/__snapshots__/pluginReactQuery/mutationDisabled/.kubb/serializers.ts b/tests/3.0.x/__snapshots__/pluginReactQuery/mutationDisabled/.kubb/serializers.ts index dd2b2e1fc..d928f56c7 100644 --- a/tests/3.0.x/__snapshots__/pluginReactQuery/mutationDisabled/.kubb/serializers.ts +++ b/tests/3.0.x/__snapshots__/pluginReactQuery/mutationDisabled/.kubb/serializers.ts @@ -1,6 +1,12 @@ export type HeaderValue = string | number | boolean | null | undefined | object export type HeadersInit = Array<[string, HeaderValue]> | Record +/** + * The request body type `fetch` accepts, derived from `RequestInit` instead of the global `BodyInit` + * name, which a Node-only project (`@types/node` without the `dom` lib) does not declare. + */ +export type RequestBody = NonNullable + /** * The OpenAPI query-parameter serialization style. `form` is the default; `spaceDelimited` and * `pipeDelimited` join arrays with a space or pipe, and `deepObject` renders objects as @@ -67,7 +73,7 @@ export type BodyEncoding = SerializationStyle & { * `ArrayBuffer`, and string bodies pass through untouched. The optional `encoding` argument carries * the per-property OpenAPI `encoding` metadata for form bodies. */ -export type BodySerializer = (args: { body: unknown; contentType?: string; encoding?: Record }) => BodyInit | undefined +export type BodySerializer = (args: { body: unknown; contentType?: string; encoding?: Record }) => RequestBody | undefined /** * The OpenAPI path-parameter serialization style. `simple` is the default and emits the bare value; @@ -111,7 +117,7 @@ export type Styles = { body?: Record } -function isFormBody(body: unknown): body is BodyInit { +function isFormBody(body: unknown): body is RequestBody { return ( body instanceof FormData || body instanceof URLSearchParams || @@ -163,7 +169,7 @@ function appendFormDataValue({ formData, key, value, contentType }: { formData: */ export const defaultBodySerializer: BodySerializer = ({ body, contentType, encoding }) => { if (body === undefined || body === null) return undefined - if (isFormBody(body)) return body as BodyInit + if (isFormBody(body)) return body as RequestBody if (contentType?.includes('multipart/form-data')) { const formData = new FormData() for (const [key, value] of Object.entries(body as Record)) { diff --git a/tests/3.0.x/__snapshots__/pluginReactQuery/paramsCasing/.kubb/serializers.ts b/tests/3.0.x/__snapshots__/pluginReactQuery/paramsCasing/.kubb/serializers.ts index dd2b2e1fc..d928f56c7 100644 --- a/tests/3.0.x/__snapshots__/pluginReactQuery/paramsCasing/.kubb/serializers.ts +++ b/tests/3.0.x/__snapshots__/pluginReactQuery/paramsCasing/.kubb/serializers.ts @@ -1,6 +1,12 @@ export type HeaderValue = string | number | boolean | null | undefined | object export type HeadersInit = Array<[string, HeaderValue]> | Record +/** + * The request body type `fetch` accepts, derived from `RequestInit` instead of the global `BodyInit` + * name, which a Node-only project (`@types/node` without the `dom` lib) does not declare. + */ +export type RequestBody = NonNullable + /** * The OpenAPI query-parameter serialization style. `form` is the default; `spaceDelimited` and * `pipeDelimited` join arrays with a space or pipe, and `deepObject` renders objects as @@ -67,7 +73,7 @@ export type BodyEncoding = SerializationStyle & { * `ArrayBuffer`, and string bodies pass through untouched. The optional `encoding` argument carries * the per-property OpenAPI `encoding` metadata for form bodies. */ -export type BodySerializer = (args: { body: unknown; contentType?: string; encoding?: Record }) => BodyInit | undefined +export type BodySerializer = (args: { body: unknown; contentType?: string; encoding?: Record }) => RequestBody | undefined /** * The OpenAPI path-parameter serialization style. `simple` is the default and emits the bare value; @@ -111,7 +117,7 @@ export type Styles = { body?: Record } -function isFormBody(body: unknown): body is BodyInit { +function isFormBody(body: unknown): body is RequestBody { return ( body instanceof FormData || body instanceof URLSearchParams || @@ -163,7 +169,7 @@ function appendFormDataValue({ formData, key, value, contentType }: { formData: */ export const defaultBodySerializer: BodySerializer = ({ body, contentType, encoding }) => { if (body === undefined || body === null) return undefined - if (isFormBody(body)) return body as BodyInit + if (isFormBody(body)) return body as RequestBody if (contentType?.includes('multipart/form-data')) { const formData = new FormData() for (const [key, value] of Object.entries(body as Record)) { diff --git a/tests/3.0.x/__snapshots__/pluginReactQuery/parserZod/.kubb/serializers.ts b/tests/3.0.x/__snapshots__/pluginReactQuery/parserZod/.kubb/serializers.ts index dd2b2e1fc..d928f56c7 100644 --- a/tests/3.0.x/__snapshots__/pluginReactQuery/parserZod/.kubb/serializers.ts +++ b/tests/3.0.x/__snapshots__/pluginReactQuery/parserZod/.kubb/serializers.ts @@ -1,6 +1,12 @@ export type HeaderValue = string | number | boolean | null | undefined | object export type HeadersInit = Array<[string, HeaderValue]> | Record +/** + * The request body type `fetch` accepts, derived from `RequestInit` instead of the global `BodyInit` + * name, which a Node-only project (`@types/node` without the `dom` lib) does not declare. + */ +export type RequestBody = NonNullable + /** * The OpenAPI query-parameter serialization style. `form` is the default; `spaceDelimited` and * `pipeDelimited` join arrays with a space or pipe, and `deepObject` renders objects as @@ -67,7 +73,7 @@ export type BodyEncoding = SerializationStyle & { * `ArrayBuffer`, and string bodies pass through untouched. The optional `encoding` argument carries * the per-property OpenAPI `encoding` metadata for form bodies. */ -export type BodySerializer = (args: { body: unknown; contentType?: string; encoding?: Record }) => BodyInit | undefined +export type BodySerializer = (args: { body: unknown; contentType?: string; encoding?: Record }) => RequestBody | undefined /** * The OpenAPI path-parameter serialization style. `simple` is the default and emits the bare value; @@ -111,7 +117,7 @@ export type Styles = { body?: Record } -function isFormBody(body: unknown): body is BodyInit { +function isFormBody(body: unknown): body is RequestBody { return ( body instanceof FormData || body instanceof URLSearchParams || @@ -163,7 +169,7 @@ function appendFormDataValue({ formData, key, value, contentType }: { formData: */ export const defaultBodySerializer: BodySerializer = ({ body, contentType, encoding }) => { if (body === undefined || body === null) return undefined - if (isFormBody(body)) return body as BodyInit + if (isFormBody(body)) return body as RequestBody if (contentType?.includes('multipart/form-data')) { const formData = new FormData() for (const [key, value] of Object.entries(body as Record)) { diff --git a/tests/3.0.x/__snapshots__/pluginReactQuery/petStore/.kubb/serializers.ts b/tests/3.0.x/__snapshots__/pluginReactQuery/petStore/.kubb/serializers.ts index dd2b2e1fc..d928f56c7 100644 --- a/tests/3.0.x/__snapshots__/pluginReactQuery/petStore/.kubb/serializers.ts +++ b/tests/3.0.x/__snapshots__/pluginReactQuery/petStore/.kubb/serializers.ts @@ -1,6 +1,12 @@ export type HeaderValue = string | number | boolean | null | undefined | object export type HeadersInit = Array<[string, HeaderValue]> | Record +/** + * The request body type `fetch` accepts, derived from `RequestInit` instead of the global `BodyInit` + * name, which a Node-only project (`@types/node` without the `dom` lib) does not declare. + */ +export type RequestBody = NonNullable + /** * The OpenAPI query-parameter serialization style. `form` is the default; `spaceDelimited` and * `pipeDelimited` join arrays with a space or pipe, and `deepObject` renders objects as @@ -67,7 +73,7 @@ export type BodyEncoding = SerializationStyle & { * `ArrayBuffer`, and string bodies pass through untouched. The optional `encoding` argument carries * the per-property OpenAPI `encoding` metadata for form bodies. */ -export type BodySerializer = (args: { body: unknown; contentType?: string; encoding?: Record }) => BodyInit | undefined +export type BodySerializer = (args: { body: unknown; contentType?: string; encoding?: Record }) => RequestBody | undefined /** * The OpenAPI path-parameter serialization style. `simple` is the default and emits the bare value; @@ -111,7 +117,7 @@ export type Styles = { body?: Record } -function isFormBody(body: unknown): body is BodyInit { +function isFormBody(body: unknown): body is RequestBody { return ( body instanceof FormData || body instanceof URLSearchParams || @@ -163,7 +169,7 @@ function appendFormDataValue({ formData, key, value, contentType }: { formData: */ export const defaultBodySerializer: BodySerializer = ({ body, contentType, encoding }) => { if (body === undefined || body === null) return undefined - if (isFormBody(body)) return body as BodyInit + if (isFormBody(body)) return body as RequestBody if (contentType?.includes('multipart/form-data')) { const formData = new FormData() for (const [key, value] of Object.entries(body as Record)) { diff --git a/tests/3.0.x/__snapshots__/pluginReactQuery/queryMethods/.kubb/serializers.ts b/tests/3.0.x/__snapshots__/pluginReactQuery/queryMethods/.kubb/serializers.ts index dd2b2e1fc..d928f56c7 100644 --- a/tests/3.0.x/__snapshots__/pluginReactQuery/queryMethods/.kubb/serializers.ts +++ b/tests/3.0.x/__snapshots__/pluginReactQuery/queryMethods/.kubb/serializers.ts @@ -1,6 +1,12 @@ export type HeaderValue = string | number | boolean | null | undefined | object export type HeadersInit = Array<[string, HeaderValue]> | Record +/** + * The request body type `fetch` accepts, derived from `RequestInit` instead of the global `BodyInit` + * name, which a Node-only project (`@types/node` without the `dom` lib) does not declare. + */ +export type RequestBody = NonNullable + /** * The OpenAPI query-parameter serialization style. `form` is the default; `spaceDelimited` and * `pipeDelimited` join arrays with a space or pipe, and `deepObject` renders objects as @@ -67,7 +73,7 @@ export type BodyEncoding = SerializationStyle & { * `ArrayBuffer`, and string bodies pass through untouched. The optional `encoding` argument carries * the per-property OpenAPI `encoding` metadata for form bodies. */ -export type BodySerializer = (args: { body: unknown; contentType?: string; encoding?: Record }) => BodyInit | undefined +export type BodySerializer = (args: { body: unknown; contentType?: string; encoding?: Record }) => RequestBody | undefined /** * The OpenAPI path-parameter serialization style. `simple` is the default and emits the bare value; @@ -111,7 +117,7 @@ export type Styles = { body?: Record } -function isFormBody(body: unknown): body is BodyInit { +function isFormBody(body: unknown): body is RequestBody { return ( body instanceof FormData || body instanceof URLSearchParams || @@ -163,7 +169,7 @@ function appendFormDataValue({ formData, key, value, contentType }: { formData: */ export const defaultBodySerializer: BodySerializer = ({ body, contentType, encoding }) => { if (body === undefined || body === null) return undefined - if (isFormBody(body)) return body as BodyInit + if (isFormBody(body)) return body as RequestBody if (contentType?.includes('multipart/form-data')) { const formData = new FormData() for (const [key, value] of Object.entries(body as Record)) { diff --git a/tests/3.0.x/__snapshots__/pluginReactQuery/suspense/.kubb/serializers.ts b/tests/3.0.x/__snapshots__/pluginReactQuery/suspense/.kubb/serializers.ts index dd2b2e1fc..d928f56c7 100644 --- a/tests/3.0.x/__snapshots__/pluginReactQuery/suspense/.kubb/serializers.ts +++ b/tests/3.0.x/__snapshots__/pluginReactQuery/suspense/.kubb/serializers.ts @@ -1,6 +1,12 @@ export type HeaderValue = string | number | boolean | null | undefined | object export type HeadersInit = Array<[string, HeaderValue]> | Record +/** + * The request body type `fetch` accepts, derived from `RequestInit` instead of the global `BodyInit` + * name, which a Node-only project (`@types/node` without the `dom` lib) does not declare. + */ +export type RequestBody = NonNullable + /** * The OpenAPI query-parameter serialization style. `form` is the default; `spaceDelimited` and * `pipeDelimited` join arrays with a space or pipe, and `deepObject` renders objects as @@ -67,7 +73,7 @@ export type BodyEncoding = SerializationStyle & { * `ArrayBuffer`, and string bodies pass through untouched. The optional `encoding` argument carries * the per-property OpenAPI `encoding` metadata for form bodies. */ -export type BodySerializer = (args: { body: unknown; contentType?: string; encoding?: Record }) => BodyInit | undefined +export type BodySerializer = (args: { body: unknown; contentType?: string; encoding?: Record }) => RequestBody | undefined /** * The OpenAPI path-parameter serialization style. `simple` is the default and emits the bare value; @@ -111,7 +117,7 @@ export type Styles = { body?: Record } -function isFormBody(body: unknown): body is BodyInit { +function isFormBody(body: unknown): body is RequestBody { return ( body instanceof FormData || body instanceof URLSearchParams || @@ -163,7 +169,7 @@ function appendFormDataValue({ formData, key, value, contentType }: { formData: */ export const defaultBodySerializer: BodySerializer = ({ body, contentType, encoding }) => { if (body === undefined || body === null) return undefined - if (isFormBody(body)) return body as BodyInit + if (isFormBody(body)) return body as RequestBody if (contentType?.includes('multipart/form-data')) { const formData = new FormData() for (const [key, value] of Object.entries(body as Record)) { diff --git a/tests/3.0.x/__snapshots__/pluginReactQuery/withClientPlugin/.kubb/serializers.ts b/tests/3.0.x/__snapshots__/pluginReactQuery/withClientPlugin/.kubb/serializers.ts index dd2b2e1fc..d928f56c7 100644 --- a/tests/3.0.x/__snapshots__/pluginReactQuery/withClientPlugin/.kubb/serializers.ts +++ b/tests/3.0.x/__snapshots__/pluginReactQuery/withClientPlugin/.kubb/serializers.ts @@ -1,6 +1,12 @@ export type HeaderValue = string | number | boolean | null | undefined | object export type HeadersInit = Array<[string, HeaderValue]> | Record +/** + * The request body type `fetch` accepts, derived from `RequestInit` instead of the global `BodyInit` + * name, which a Node-only project (`@types/node` without the `dom` lib) does not declare. + */ +export type RequestBody = NonNullable + /** * The OpenAPI query-parameter serialization style. `form` is the default; `spaceDelimited` and * `pipeDelimited` join arrays with a space or pipe, and `deepObject` renders objects as @@ -67,7 +73,7 @@ export type BodyEncoding = SerializationStyle & { * `ArrayBuffer`, and string bodies pass through untouched. The optional `encoding` argument carries * the per-property OpenAPI `encoding` metadata for form bodies. */ -export type BodySerializer = (args: { body: unknown; contentType?: string; encoding?: Record }) => BodyInit | undefined +export type BodySerializer = (args: { body: unknown; contentType?: string; encoding?: Record }) => RequestBody | undefined /** * The OpenAPI path-parameter serialization style. `simple` is the default and emits the bare value; @@ -111,7 +117,7 @@ export type Styles = { body?: Record } -function isFormBody(body: unknown): body is BodyInit { +function isFormBody(body: unknown): body is RequestBody { return ( body instanceof FormData || body instanceof URLSearchParams || @@ -163,7 +169,7 @@ function appendFormDataValue({ formData, key, value, contentType }: { formData: */ export const defaultBodySerializer: BodySerializer = ({ body, contentType, encoding }) => { if (body === undefined || body === null) return undefined - if (isFormBody(body)) return body as BodyInit + if (isFormBody(body)) return body as RequestBody if (contentType?.includes('multipart/form-data')) { const formData = new FormData() for (const [key, value] of Object.entries(body as Record)) { diff --git a/tests/3.0.x/__snapshots__/pluginSwr/excludeByOperationId/.kubb/serializers.ts b/tests/3.0.x/__snapshots__/pluginSwr/excludeByOperationId/.kubb/serializers.ts index dd2b2e1fc..d928f56c7 100644 --- a/tests/3.0.x/__snapshots__/pluginSwr/excludeByOperationId/.kubb/serializers.ts +++ b/tests/3.0.x/__snapshots__/pluginSwr/excludeByOperationId/.kubb/serializers.ts @@ -1,6 +1,12 @@ export type HeaderValue = string | number | boolean | null | undefined | object export type HeadersInit = Array<[string, HeaderValue]> | Record +/** + * The request body type `fetch` accepts, derived from `RequestInit` instead of the global `BodyInit` + * name, which a Node-only project (`@types/node` without the `dom` lib) does not declare. + */ +export type RequestBody = NonNullable + /** * The OpenAPI query-parameter serialization style. `form` is the default; `spaceDelimited` and * `pipeDelimited` join arrays with a space or pipe, and `deepObject` renders objects as @@ -67,7 +73,7 @@ export type BodyEncoding = SerializationStyle & { * `ArrayBuffer`, and string bodies pass through untouched. The optional `encoding` argument carries * the per-property OpenAPI `encoding` metadata for form bodies. */ -export type BodySerializer = (args: { body: unknown; contentType?: string; encoding?: Record }) => BodyInit | undefined +export type BodySerializer = (args: { body: unknown; contentType?: string; encoding?: Record }) => RequestBody | undefined /** * The OpenAPI path-parameter serialization style. `simple` is the default and emits the bare value; @@ -111,7 +117,7 @@ export type Styles = { body?: Record } -function isFormBody(body: unknown): body is BodyInit { +function isFormBody(body: unknown): body is RequestBody { return ( body instanceof FormData || body instanceof URLSearchParams || @@ -163,7 +169,7 @@ function appendFormDataValue({ formData, key, value, contentType }: { formData: */ export const defaultBodySerializer: BodySerializer = ({ body, contentType, encoding }) => { if (body === undefined || body === null) return undefined - if (isFormBody(body)) return body as BodyInit + if (isFormBody(body)) return body as RequestBody if (contentType?.includes('multipart/form-data')) { const formData = new FormData() for (const [key, value] of Object.entries(body as Record)) { diff --git a/tests/3.0.x/__snapshots__/pluginSwr/groupByTag/.kubb/serializers.ts b/tests/3.0.x/__snapshots__/pluginSwr/groupByTag/.kubb/serializers.ts index dd2b2e1fc..d928f56c7 100644 --- a/tests/3.0.x/__snapshots__/pluginSwr/groupByTag/.kubb/serializers.ts +++ b/tests/3.0.x/__snapshots__/pluginSwr/groupByTag/.kubb/serializers.ts @@ -1,6 +1,12 @@ export type HeaderValue = string | number | boolean | null | undefined | object export type HeadersInit = Array<[string, HeaderValue]> | Record +/** + * The request body type `fetch` accepts, derived from `RequestInit` instead of the global `BodyInit` + * name, which a Node-only project (`@types/node` without the `dom` lib) does not declare. + */ +export type RequestBody = NonNullable + /** * The OpenAPI query-parameter serialization style. `form` is the default; `spaceDelimited` and * `pipeDelimited` join arrays with a space or pipe, and `deepObject` renders objects as @@ -67,7 +73,7 @@ export type BodyEncoding = SerializationStyle & { * `ArrayBuffer`, and string bodies pass through untouched. The optional `encoding` argument carries * the per-property OpenAPI `encoding` metadata for form bodies. */ -export type BodySerializer = (args: { body: unknown; contentType?: string; encoding?: Record }) => BodyInit | undefined +export type BodySerializer = (args: { body: unknown; contentType?: string; encoding?: Record }) => RequestBody | undefined /** * The OpenAPI path-parameter serialization style. `simple` is the default and emits the bare value; @@ -111,7 +117,7 @@ export type Styles = { body?: Record } -function isFormBody(body: unknown): body is BodyInit { +function isFormBody(body: unknown): body is RequestBody { return ( body instanceof FormData || body instanceof URLSearchParams || @@ -163,7 +169,7 @@ function appendFormDataValue({ formData, key, value, contentType }: { formData: */ export const defaultBodySerializer: BodySerializer = ({ body, contentType, encoding }) => { if (body === undefined || body === null) return undefined - if (isFormBody(body)) return body as BodyInit + if (isFormBody(body)) return body as RequestBody if (contentType?.includes('multipart/form-data')) { const formData = new FormData() for (const [key, value] of Object.entries(body as Record)) { diff --git a/tests/3.0.x/__snapshots__/pluginSwr/includeByTag/.kubb/serializers.ts b/tests/3.0.x/__snapshots__/pluginSwr/includeByTag/.kubb/serializers.ts index dd2b2e1fc..d928f56c7 100644 --- a/tests/3.0.x/__snapshots__/pluginSwr/includeByTag/.kubb/serializers.ts +++ b/tests/3.0.x/__snapshots__/pluginSwr/includeByTag/.kubb/serializers.ts @@ -1,6 +1,12 @@ export type HeaderValue = string | number | boolean | null | undefined | object export type HeadersInit = Array<[string, HeaderValue]> | Record +/** + * The request body type `fetch` accepts, derived from `RequestInit` instead of the global `BodyInit` + * name, which a Node-only project (`@types/node` without the `dom` lib) does not declare. + */ +export type RequestBody = NonNullable + /** * The OpenAPI query-parameter serialization style. `form` is the default; `spaceDelimited` and * `pipeDelimited` join arrays with a space or pipe, and `deepObject` renders objects as @@ -67,7 +73,7 @@ export type BodyEncoding = SerializationStyle & { * `ArrayBuffer`, and string bodies pass through untouched. The optional `encoding` argument carries * the per-property OpenAPI `encoding` metadata for form bodies. */ -export type BodySerializer = (args: { body: unknown; contentType?: string; encoding?: Record }) => BodyInit | undefined +export type BodySerializer = (args: { body: unknown; contentType?: string; encoding?: Record }) => RequestBody | undefined /** * The OpenAPI path-parameter serialization style. `simple` is the default and emits the bare value; @@ -111,7 +117,7 @@ export type Styles = { body?: Record } -function isFormBody(body: unknown): body is BodyInit { +function isFormBody(body: unknown): body is RequestBody { return ( body instanceof FormData || body instanceof URLSearchParams || @@ -163,7 +169,7 @@ function appendFormDataValue({ formData, key, value, contentType }: { formData: */ export const defaultBodySerializer: BodySerializer = ({ body, contentType, encoding }) => { if (body === undefined || body === null) return undefined - if (isFormBody(body)) return body as BodyInit + if (isFormBody(body)) return body as RequestBody if (contentType?.includes('multipart/form-data')) { const formData = new FormData() for (const [key, value] of Object.entries(body as Record)) { diff --git a/tests/3.0.x/__snapshots__/pluginSwr/mutationDisabled/.kubb/serializers.ts b/tests/3.0.x/__snapshots__/pluginSwr/mutationDisabled/.kubb/serializers.ts index dd2b2e1fc..d928f56c7 100644 --- a/tests/3.0.x/__snapshots__/pluginSwr/mutationDisabled/.kubb/serializers.ts +++ b/tests/3.0.x/__snapshots__/pluginSwr/mutationDisabled/.kubb/serializers.ts @@ -1,6 +1,12 @@ export type HeaderValue = string | number | boolean | null | undefined | object export type HeadersInit = Array<[string, HeaderValue]> | Record +/** + * The request body type `fetch` accepts, derived from `RequestInit` instead of the global `BodyInit` + * name, which a Node-only project (`@types/node` without the `dom` lib) does not declare. + */ +export type RequestBody = NonNullable + /** * The OpenAPI query-parameter serialization style. `form` is the default; `spaceDelimited` and * `pipeDelimited` join arrays with a space or pipe, and `deepObject` renders objects as @@ -67,7 +73,7 @@ export type BodyEncoding = SerializationStyle & { * `ArrayBuffer`, and string bodies pass through untouched. The optional `encoding` argument carries * the per-property OpenAPI `encoding` metadata for form bodies. */ -export type BodySerializer = (args: { body: unknown; contentType?: string; encoding?: Record }) => BodyInit | undefined +export type BodySerializer = (args: { body: unknown; contentType?: string; encoding?: Record }) => RequestBody | undefined /** * The OpenAPI path-parameter serialization style. `simple` is the default and emits the bare value; @@ -111,7 +117,7 @@ export type Styles = { body?: Record } -function isFormBody(body: unknown): body is BodyInit { +function isFormBody(body: unknown): body is RequestBody { return ( body instanceof FormData || body instanceof URLSearchParams || @@ -163,7 +169,7 @@ function appendFormDataValue({ formData, key, value, contentType }: { formData: */ export const defaultBodySerializer: BodySerializer = ({ body, contentType, encoding }) => { if (body === undefined || body === null) return undefined - if (isFormBody(body)) return body as BodyInit + if (isFormBody(body)) return body as RequestBody if (contentType?.includes('multipart/form-data')) { const formData = new FormData() for (const [key, value] of Object.entries(body as Record)) { diff --git a/tests/3.0.x/__snapshots__/pluginSwr/paramsCasing/.kubb/serializers.ts b/tests/3.0.x/__snapshots__/pluginSwr/paramsCasing/.kubb/serializers.ts index dd2b2e1fc..d928f56c7 100644 --- a/tests/3.0.x/__snapshots__/pluginSwr/paramsCasing/.kubb/serializers.ts +++ b/tests/3.0.x/__snapshots__/pluginSwr/paramsCasing/.kubb/serializers.ts @@ -1,6 +1,12 @@ export type HeaderValue = string | number | boolean | null | undefined | object export type HeadersInit = Array<[string, HeaderValue]> | Record +/** + * The request body type `fetch` accepts, derived from `RequestInit` instead of the global `BodyInit` + * name, which a Node-only project (`@types/node` without the `dom` lib) does not declare. + */ +export type RequestBody = NonNullable + /** * The OpenAPI query-parameter serialization style. `form` is the default; `spaceDelimited` and * `pipeDelimited` join arrays with a space or pipe, and `deepObject` renders objects as @@ -67,7 +73,7 @@ export type BodyEncoding = SerializationStyle & { * `ArrayBuffer`, and string bodies pass through untouched. The optional `encoding` argument carries * the per-property OpenAPI `encoding` metadata for form bodies. */ -export type BodySerializer = (args: { body: unknown; contentType?: string; encoding?: Record }) => BodyInit | undefined +export type BodySerializer = (args: { body: unknown; contentType?: string; encoding?: Record }) => RequestBody | undefined /** * The OpenAPI path-parameter serialization style. `simple` is the default and emits the bare value; @@ -111,7 +117,7 @@ export type Styles = { body?: Record } -function isFormBody(body: unknown): body is BodyInit { +function isFormBody(body: unknown): body is RequestBody { return ( body instanceof FormData || body instanceof URLSearchParams || @@ -163,7 +169,7 @@ function appendFormDataValue({ formData, key, value, contentType }: { formData: */ export const defaultBodySerializer: BodySerializer = ({ body, contentType, encoding }) => { if (body === undefined || body === null) return undefined - if (isFormBody(body)) return body as BodyInit + if (isFormBody(body)) return body as RequestBody if (contentType?.includes('multipart/form-data')) { const formData = new FormData() for (const [key, value] of Object.entries(body as Record)) { diff --git a/tests/3.0.x/__snapshots__/pluginSwr/parserZod/.kubb/serializers.ts b/tests/3.0.x/__snapshots__/pluginSwr/parserZod/.kubb/serializers.ts index dd2b2e1fc..d928f56c7 100644 --- a/tests/3.0.x/__snapshots__/pluginSwr/parserZod/.kubb/serializers.ts +++ b/tests/3.0.x/__snapshots__/pluginSwr/parserZod/.kubb/serializers.ts @@ -1,6 +1,12 @@ export type HeaderValue = string | number | boolean | null | undefined | object export type HeadersInit = Array<[string, HeaderValue]> | Record +/** + * The request body type `fetch` accepts, derived from `RequestInit` instead of the global `BodyInit` + * name, which a Node-only project (`@types/node` without the `dom` lib) does not declare. + */ +export type RequestBody = NonNullable + /** * The OpenAPI query-parameter serialization style. `form` is the default; `spaceDelimited` and * `pipeDelimited` join arrays with a space or pipe, and `deepObject` renders objects as @@ -67,7 +73,7 @@ export type BodyEncoding = SerializationStyle & { * `ArrayBuffer`, and string bodies pass through untouched. The optional `encoding` argument carries * the per-property OpenAPI `encoding` metadata for form bodies. */ -export type BodySerializer = (args: { body: unknown; contentType?: string; encoding?: Record }) => BodyInit | undefined +export type BodySerializer = (args: { body: unknown; contentType?: string; encoding?: Record }) => RequestBody | undefined /** * The OpenAPI path-parameter serialization style. `simple` is the default and emits the bare value; @@ -111,7 +117,7 @@ export type Styles = { body?: Record } -function isFormBody(body: unknown): body is BodyInit { +function isFormBody(body: unknown): body is RequestBody { return ( body instanceof FormData || body instanceof URLSearchParams || @@ -163,7 +169,7 @@ function appendFormDataValue({ formData, key, value, contentType }: { formData: */ export const defaultBodySerializer: BodySerializer = ({ body, contentType, encoding }) => { if (body === undefined || body === null) return undefined - if (isFormBody(body)) return body as BodyInit + if (isFormBody(body)) return body as RequestBody if (contentType?.includes('multipart/form-data')) { const formData = new FormData() for (const [key, value] of Object.entries(body as Record)) { diff --git a/tests/3.0.x/__snapshots__/pluginSwr/petStore/.kubb/serializers.ts b/tests/3.0.x/__snapshots__/pluginSwr/petStore/.kubb/serializers.ts index dd2b2e1fc..d928f56c7 100644 --- a/tests/3.0.x/__snapshots__/pluginSwr/petStore/.kubb/serializers.ts +++ b/tests/3.0.x/__snapshots__/pluginSwr/petStore/.kubb/serializers.ts @@ -1,6 +1,12 @@ export type HeaderValue = string | number | boolean | null | undefined | object export type HeadersInit = Array<[string, HeaderValue]> | Record +/** + * The request body type `fetch` accepts, derived from `RequestInit` instead of the global `BodyInit` + * name, which a Node-only project (`@types/node` without the `dom` lib) does not declare. + */ +export type RequestBody = NonNullable + /** * The OpenAPI query-parameter serialization style. `form` is the default; `spaceDelimited` and * `pipeDelimited` join arrays with a space or pipe, and `deepObject` renders objects as @@ -67,7 +73,7 @@ export type BodyEncoding = SerializationStyle & { * `ArrayBuffer`, and string bodies pass through untouched. The optional `encoding` argument carries * the per-property OpenAPI `encoding` metadata for form bodies. */ -export type BodySerializer = (args: { body: unknown; contentType?: string; encoding?: Record }) => BodyInit | undefined +export type BodySerializer = (args: { body: unknown; contentType?: string; encoding?: Record }) => RequestBody | undefined /** * The OpenAPI path-parameter serialization style. `simple` is the default and emits the bare value; @@ -111,7 +117,7 @@ export type Styles = { body?: Record } -function isFormBody(body: unknown): body is BodyInit { +function isFormBody(body: unknown): body is RequestBody { return ( body instanceof FormData || body instanceof URLSearchParams || @@ -163,7 +169,7 @@ function appendFormDataValue({ formData, key, value, contentType }: { formData: */ export const defaultBodySerializer: BodySerializer = ({ body, contentType, encoding }) => { if (body === undefined || body === null) return undefined - if (isFormBody(body)) return body as BodyInit + if (isFormBody(body)) return body as RequestBody if (contentType?.includes('multipart/form-data')) { const formData = new FormData() for (const [key, value] of Object.entries(body as Record)) { diff --git a/tests/3.0.x/__snapshots__/pluginSwr/queryDisabled/.kubb/serializers.ts b/tests/3.0.x/__snapshots__/pluginSwr/queryDisabled/.kubb/serializers.ts index dd2b2e1fc..d928f56c7 100644 --- a/tests/3.0.x/__snapshots__/pluginSwr/queryDisabled/.kubb/serializers.ts +++ b/tests/3.0.x/__snapshots__/pluginSwr/queryDisabled/.kubb/serializers.ts @@ -1,6 +1,12 @@ export type HeaderValue = string | number | boolean | null | undefined | object export type HeadersInit = Array<[string, HeaderValue]> | Record +/** + * The request body type `fetch` accepts, derived from `RequestInit` instead of the global `BodyInit` + * name, which a Node-only project (`@types/node` without the `dom` lib) does not declare. + */ +export type RequestBody = NonNullable + /** * The OpenAPI query-parameter serialization style. `form` is the default; `spaceDelimited` and * `pipeDelimited` join arrays with a space or pipe, and `deepObject` renders objects as @@ -67,7 +73,7 @@ export type BodyEncoding = SerializationStyle & { * `ArrayBuffer`, and string bodies pass through untouched. The optional `encoding` argument carries * the per-property OpenAPI `encoding` metadata for form bodies. */ -export type BodySerializer = (args: { body: unknown; contentType?: string; encoding?: Record }) => BodyInit | undefined +export type BodySerializer = (args: { body: unknown; contentType?: string; encoding?: Record }) => RequestBody | undefined /** * The OpenAPI path-parameter serialization style. `simple` is the default and emits the bare value; @@ -111,7 +117,7 @@ export type Styles = { body?: Record } -function isFormBody(body: unknown): body is BodyInit { +function isFormBody(body: unknown): body is RequestBody { return ( body instanceof FormData || body instanceof URLSearchParams || @@ -163,7 +169,7 @@ function appendFormDataValue({ formData, key, value, contentType }: { formData: */ export const defaultBodySerializer: BodySerializer = ({ body, contentType, encoding }) => { if (body === undefined || body === null) return undefined - if (isFormBody(body)) return body as BodyInit + if (isFormBody(body)) return body as RequestBody if (contentType?.includes('multipart/form-data')) { const formData = new FormData() for (const [key, value] of Object.entries(body as Record)) { diff --git a/tests/3.0.x/__snapshots__/pluginSwr/queryMethods/.kubb/serializers.ts b/tests/3.0.x/__snapshots__/pluginSwr/queryMethods/.kubb/serializers.ts index dd2b2e1fc..d928f56c7 100644 --- a/tests/3.0.x/__snapshots__/pluginSwr/queryMethods/.kubb/serializers.ts +++ b/tests/3.0.x/__snapshots__/pluginSwr/queryMethods/.kubb/serializers.ts @@ -1,6 +1,12 @@ export type HeaderValue = string | number | boolean | null | undefined | object export type HeadersInit = Array<[string, HeaderValue]> | Record +/** + * The request body type `fetch` accepts, derived from `RequestInit` instead of the global `BodyInit` + * name, which a Node-only project (`@types/node` without the `dom` lib) does not declare. + */ +export type RequestBody = NonNullable + /** * The OpenAPI query-parameter serialization style. `form` is the default; `spaceDelimited` and * `pipeDelimited` join arrays with a space or pipe, and `deepObject` renders objects as @@ -67,7 +73,7 @@ export type BodyEncoding = SerializationStyle & { * `ArrayBuffer`, and string bodies pass through untouched. The optional `encoding` argument carries * the per-property OpenAPI `encoding` metadata for form bodies. */ -export type BodySerializer = (args: { body: unknown; contentType?: string; encoding?: Record }) => BodyInit | undefined +export type BodySerializer = (args: { body: unknown; contentType?: string; encoding?: Record }) => RequestBody | undefined /** * The OpenAPI path-parameter serialization style. `simple` is the default and emits the bare value; @@ -111,7 +117,7 @@ export type Styles = { body?: Record } -function isFormBody(body: unknown): body is BodyInit { +function isFormBody(body: unknown): body is RequestBody { return ( body instanceof FormData || body instanceof URLSearchParams || @@ -163,7 +169,7 @@ function appendFormDataValue({ formData, key, value, contentType }: { formData: */ export const defaultBodySerializer: BodySerializer = ({ body, contentType, encoding }) => { if (body === undefined || body === null) return undefined - if (isFormBody(body)) return body as BodyInit + if (isFormBody(body)) return body as RequestBody if (contentType?.includes('multipart/form-data')) { const formData = new FormData() for (const [key, value] of Object.entries(body as Record)) { diff --git a/tests/3.0.x/__snapshots__/pluginSwr/withClientPlugin/.kubb/serializers.ts b/tests/3.0.x/__snapshots__/pluginSwr/withClientPlugin/.kubb/serializers.ts index dd2b2e1fc..d928f56c7 100644 --- a/tests/3.0.x/__snapshots__/pluginSwr/withClientPlugin/.kubb/serializers.ts +++ b/tests/3.0.x/__snapshots__/pluginSwr/withClientPlugin/.kubb/serializers.ts @@ -1,6 +1,12 @@ export type HeaderValue = string | number | boolean | null | undefined | object export type HeadersInit = Array<[string, HeaderValue]> | Record +/** + * The request body type `fetch` accepts, derived from `RequestInit` instead of the global `BodyInit` + * name, which a Node-only project (`@types/node` without the `dom` lib) does not declare. + */ +export type RequestBody = NonNullable + /** * The OpenAPI query-parameter serialization style. `form` is the default; `spaceDelimited` and * `pipeDelimited` join arrays with a space or pipe, and `deepObject` renders objects as @@ -67,7 +73,7 @@ export type BodyEncoding = SerializationStyle & { * `ArrayBuffer`, and string bodies pass through untouched. The optional `encoding` argument carries * the per-property OpenAPI `encoding` metadata for form bodies. */ -export type BodySerializer = (args: { body: unknown; contentType?: string; encoding?: Record }) => BodyInit | undefined +export type BodySerializer = (args: { body: unknown; contentType?: string; encoding?: Record }) => RequestBody | undefined /** * The OpenAPI path-parameter serialization style. `simple` is the default and emits the bare value; @@ -111,7 +117,7 @@ export type Styles = { body?: Record } -function isFormBody(body: unknown): body is BodyInit { +function isFormBody(body: unknown): body is RequestBody { return ( body instanceof FormData || body instanceof URLSearchParams || @@ -163,7 +169,7 @@ function appendFormDataValue({ formData, key, value, contentType }: { formData: */ export const defaultBodySerializer: BodySerializer = ({ body, contentType, encoding }) => { if (body === undefined || body === null) return undefined - if (isFormBody(body)) return body as BodyInit + if (isFormBody(body)) return body as RequestBody if (contentType?.includes('multipart/form-data')) { const formData = new FormData() for (const [key, value] of Object.entries(body as Record)) { diff --git a/tests/3.0.x/__snapshots__/pluginVueQuery/excludeByOperationId/.kubb/serializers.ts b/tests/3.0.x/__snapshots__/pluginVueQuery/excludeByOperationId/.kubb/serializers.ts index dd2b2e1fc..d928f56c7 100644 --- a/tests/3.0.x/__snapshots__/pluginVueQuery/excludeByOperationId/.kubb/serializers.ts +++ b/tests/3.0.x/__snapshots__/pluginVueQuery/excludeByOperationId/.kubb/serializers.ts @@ -1,6 +1,12 @@ export type HeaderValue = string | number | boolean | null | undefined | object export type HeadersInit = Array<[string, HeaderValue]> | Record +/** + * The request body type `fetch` accepts, derived from `RequestInit` instead of the global `BodyInit` + * name, which a Node-only project (`@types/node` without the `dom` lib) does not declare. + */ +export type RequestBody = NonNullable + /** * The OpenAPI query-parameter serialization style. `form` is the default; `spaceDelimited` and * `pipeDelimited` join arrays with a space or pipe, and `deepObject` renders objects as @@ -67,7 +73,7 @@ export type BodyEncoding = SerializationStyle & { * `ArrayBuffer`, and string bodies pass through untouched. The optional `encoding` argument carries * the per-property OpenAPI `encoding` metadata for form bodies. */ -export type BodySerializer = (args: { body: unknown; contentType?: string; encoding?: Record }) => BodyInit | undefined +export type BodySerializer = (args: { body: unknown; contentType?: string; encoding?: Record }) => RequestBody | undefined /** * The OpenAPI path-parameter serialization style. `simple` is the default and emits the bare value; @@ -111,7 +117,7 @@ export type Styles = { body?: Record } -function isFormBody(body: unknown): body is BodyInit { +function isFormBody(body: unknown): body is RequestBody { return ( body instanceof FormData || body instanceof URLSearchParams || @@ -163,7 +169,7 @@ function appendFormDataValue({ formData, key, value, contentType }: { formData: */ export const defaultBodySerializer: BodySerializer = ({ body, contentType, encoding }) => { if (body === undefined || body === null) return undefined - if (isFormBody(body)) return body as BodyInit + if (isFormBody(body)) return body as RequestBody if (contentType?.includes('multipart/form-data')) { const formData = new FormData() for (const [key, value] of Object.entries(body as Record)) { diff --git a/tests/3.0.x/__snapshots__/pluginVueQuery/groupByTag/.kubb/serializers.ts b/tests/3.0.x/__snapshots__/pluginVueQuery/groupByTag/.kubb/serializers.ts index dd2b2e1fc..d928f56c7 100644 --- a/tests/3.0.x/__snapshots__/pluginVueQuery/groupByTag/.kubb/serializers.ts +++ b/tests/3.0.x/__snapshots__/pluginVueQuery/groupByTag/.kubb/serializers.ts @@ -1,6 +1,12 @@ export type HeaderValue = string | number | boolean | null | undefined | object export type HeadersInit = Array<[string, HeaderValue]> | Record +/** + * The request body type `fetch` accepts, derived from `RequestInit` instead of the global `BodyInit` + * name, which a Node-only project (`@types/node` without the `dom` lib) does not declare. + */ +export type RequestBody = NonNullable + /** * The OpenAPI query-parameter serialization style. `form` is the default; `spaceDelimited` and * `pipeDelimited` join arrays with a space or pipe, and `deepObject` renders objects as @@ -67,7 +73,7 @@ export type BodyEncoding = SerializationStyle & { * `ArrayBuffer`, and string bodies pass through untouched. The optional `encoding` argument carries * the per-property OpenAPI `encoding` metadata for form bodies. */ -export type BodySerializer = (args: { body: unknown; contentType?: string; encoding?: Record }) => BodyInit | undefined +export type BodySerializer = (args: { body: unknown; contentType?: string; encoding?: Record }) => RequestBody | undefined /** * The OpenAPI path-parameter serialization style. `simple` is the default and emits the bare value; @@ -111,7 +117,7 @@ export type Styles = { body?: Record } -function isFormBody(body: unknown): body is BodyInit { +function isFormBody(body: unknown): body is RequestBody { return ( body instanceof FormData || body instanceof URLSearchParams || @@ -163,7 +169,7 @@ function appendFormDataValue({ formData, key, value, contentType }: { formData: */ export const defaultBodySerializer: BodySerializer = ({ body, contentType, encoding }) => { if (body === undefined || body === null) return undefined - if (isFormBody(body)) return body as BodyInit + if (isFormBody(body)) return body as RequestBody if (contentType?.includes('multipart/form-data')) { const formData = new FormData() for (const [key, value] of Object.entries(body as Record)) { diff --git a/tests/3.0.x/__snapshots__/pluginVueQuery/includeByTag/.kubb/serializers.ts b/tests/3.0.x/__snapshots__/pluginVueQuery/includeByTag/.kubb/serializers.ts index dd2b2e1fc..d928f56c7 100644 --- a/tests/3.0.x/__snapshots__/pluginVueQuery/includeByTag/.kubb/serializers.ts +++ b/tests/3.0.x/__snapshots__/pluginVueQuery/includeByTag/.kubb/serializers.ts @@ -1,6 +1,12 @@ export type HeaderValue = string | number | boolean | null | undefined | object export type HeadersInit = Array<[string, HeaderValue]> | Record +/** + * The request body type `fetch` accepts, derived from `RequestInit` instead of the global `BodyInit` + * name, which a Node-only project (`@types/node` without the `dom` lib) does not declare. + */ +export type RequestBody = NonNullable + /** * The OpenAPI query-parameter serialization style. `form` is the default; `spaceDelimited` and * `pipeDelimited` join arrays with a space or pipe, and `deepObject` renders objects as @@ -67,7 +73,7 @@ export type BodyEncoding = SerializationStyle & { * `ArrayBuffer`, and string bodies pass through untouched. The optional `encoding` argument carries * the per-property OpenAPI `encoding` metadata for form bodies. */ -export type BodySerializer = (args: { body: unknown; contentType?: string; encoding?: Record }) => BodyInit | undefined +export type BodySerializer = (args: { body: unknown; contentType?: string; encoding?: Record }) => RequestBody | undefined /** * The OpenAPI path-parameter serialization style. `simple` is the default and emits the bare value; @@ -111,7 +117,7 @@ export type Styles = { body?: Record } -function isFormBody(body: unknown): body is BodyInit { +function isFormBody(body: unknown): body is RequestBody { return ( body instanceof FormData || body instanceof URLSearchParams || @@ -163,7 +169,7 @@ function appendFormDataValue({ formData, key, value, contentType }: { formData: */ export const defaultBodySerializer: BodySerializer = ({ body, contentType, encoding }) => { if (body === undefined || body === null) return undefined - if (isFormBody(body)) return body as BodyInit + if (isFormBody(body)) return body as RequestBody if (contentType?.includes('multipart/form-data')) { const formData = new FormData() for (const [key, value] of Object.entries(body as Record)) { diff --git a/tests/3.0.x/__snapshots__/pluginVueQuery/infinite/.kubb/serializers.ts b/tests/3.0.x/__snapshots__/pluginVueQuery/infinite/.kubb/serializers.ts index dd2b2e1fc..d928f56c7 100644 --- a/tests/3.0.x/__snapshots__/pluginVueQuery/infinite/.kubb/serializers.ts +++ b/tests/3.0.x/__snapshots__/pluginVueQuery/infinite/.kubb/serializers.ts @@ -1,6 +1,12 @@ export type HeaderValue = string | number | boolean | null | undefined | object export type HeadersInit = Array<[string, HeaderValue]> | Record +/** + * The request body type `fetch` accepts, derived from `RequestInit` instead of the global `BodyInit` + * name, which a Node-only project (`@types/node` without the `dom` lib) does not declare. + */ +export type RequestBody = NonNullable + /** * The OpenAPI query-parameter serialization style. `form` is the default; `spaceDelimited` and * `pipeDelimited` join arrays with a space or pipe, and `deepObject` renders objects as @@ -67,7 +73,7 @@ export type BodyEncoding = SerializationStyle & { * `ArrayBuffer`, and string bodies pass through untouched. The optional `encoding` argument carries * the per-property OpenAPI `encoding` metadata for form bodies. */ -export type BodySerializer = (args: { body: unknown; contentType?: string; encoding?: Record }) => BodyInit | undefined +export type BodySerializer = (args: { body: unknown; contentType?: string; encoding?: Record }) => RequestBody | undefined /** * The OpenAPI path-parameter serialization style. `simple` is the default and emits the bare value; @@ -111,7 +117,7 @@ export type Styles = { body?: Record } -function isFormBody(body: unknown): body is BodyInit { +function isFormBody(body: unknown): body is RequestBody { return ( body instanceof FormData || body instanceof URLSearchParams || @@ -163,7 +169,7 @@ function appendFormDataValue({ formData, key, value, contentType }: { formData: */ export const defaultBodySerializer: BodySerializer = ({ body, contentType, encoding }) => { if (body === undefined || body === null) return undefined - if (isFormBody(body)) return body as BodyInit + if (isFormBody(body)) return body as RequestBody if (contentType?.includes('multipart/form-data')) { const formData = new FormData() for (const [key, value] of Object.entries(body as Record)) { diff --git a/tests/3.0.x/__snapshots__/pluginVueQuery/mutationDisabled/.kubb/serializers.ts b/tests/3.0.x/__snapshots__/pluginVueQuery/mutationDisabled/.kubb/serializers.ts index dd2b2e1fc..d928f56c7 100644 --- a/tests/3.0.x/__snapshots__/pluginVueQuery/mutationDisabled/.kubb/serializers.ts +++ b/tests/3.0.x/__snapshots__/pluginVueQuery/mutationDisabled/.kubb/serializers.ts @@ -1,6 +1,12 @@ export type HeaderValue = string | number | boolean | null | undefined | object export type HeadersInit = Array<[string, HeaderValue]> | Record +/** + * The request body type `fetch` accepts, derived from `RequestInit` instead of the global `BodyInit` + * name, which a Node-only project (`@types/node` without the `dom` lib) does not declare. + */ +export type RequestBody = NonNullable + /** * The OpenAPI query-parameter serialization style. `form` is the default; `spaceDelimited` and * `pipeDelimited` join arrays with a space or pipe, and `deepObject` renders objects as @@ -67,7 +73,7 @@ export type BodyEncoding = SerializationStyle & { * `ArrayBuffer`, and string bodies pass through untouched. The optional `encoding` argument carries * the per-property OpenAPI `encoding` metadata for form bodies. */ -export type BodySerializer = (args: { body: unknown; contentType?: string; encoding?: Record }) => BodyInit | undefined +export type BodySerializer = (args: { body: unknown; contentType?: string; encoding?: Record }) => RequestBody | undefined /** * The OpenAPI path-parameter serialization style. `simple` is the default and emits the bare value; @@ -111,7 +117,7 @@ export type Styles = { body?: Record } -function isFormBody(body: unknown): body is BodyInit { +function isFormBody(body: unknown): body is RequestBody { return ( body instanceof FormData || body instanceof URLSearchParams || @@ -163,7 +169,7 @@ function appendFormDataValue({ formData, key, value, contentType }: { formData: */ export const defaultBodySerializer: BodySerializer = ({ body, contentType, encoding }) => { if (body === undefined || body === null) return undefined - if (isFormBody(body)) return body as BodyInit + if (isFormBody(body)) return body as RequestBody if (contentType?.includes('multipart/form-data')) { const formData = new FormData() for (const [key, value] of Object.entries(body as Record)) { diff --git a/tests/3.0.x/__snapshots__/pluginVueQuery/paramsCasing/.kubb/serializers.ts b/tests/3.0.x/__snapshots__/pluginVueQuery/paramsCasing/.kubb/serializers.ts index dd2b2e1fc..d928f56c7 100644 --- a/tests/3.0.x/__snapshots__/pluginVueQuery/paramsCasing/.kubb/serializers.ts +++ b/tests/3.0.x/__snapshots__/pluginVueQuery/paramsCasing/.kubb/serializers.ts @@ -1,6 +1,12 @@ export type HeaderValue = string | number | boolean | null | undefined | object export type HeadersInit = Array<[string, HeaderValue]> | Record +/** + * The request body type `fetch` accepts, derived from `RequestInit` instead of the global `BodyInit` + * name, which a Node-only project (`@types/node` without the `dom` lib) does not declare. + */ +export type RequestBody = NonNullable + /** * The OpenAPI query-parameter serialization style. `form` is the default; `spaceDelimited` and * `pipeDelimited` join arrays with a space or pipe, and `deepObject` renders objects as @@ -67,7 +73,7 @@ export type BodyEncoding = SerializationStyle & { * `ArrayBuffer`, and string bodies pass through untouched. The optional `encoding` argument carries * the per-property OpenAPI `encoding` metadata for form bodies. */ -export type BodySerializer = (args: { body: unknown; contentType?: string; encoding?: Record }) => BodyInit | undefined +export type BodySerializer = (args: { body: unknown; contentType?: string; encoding?: Record }) => RequestBody | undefined /** * The OpenAPI path-parameter serialization style. `simple` is the default and emits the bare value; @@ -111,7 +117,7 @@ export type Styles = { body?: Record } -function isFormBody(body: unknown): body is BodyInit { +function isFormBody(body: unknown): body is RequestBody { return ( body instanceof FormData || body instanceof URLSearchParams || @@ -163,7 +169,7 @@ function appendFormDataValue({ formData, key, value, contentType }: { formData: */ export const defaultBodySerializer: BodySerializer = ({ body, contentType, encoding }) => { if (body === undefined || body === null) return undefined - if (isFormBody(body)) return body as BodyInit + if (isFormBody(body)) return body as RequestBody if (contentType?.includes('multipart/form-data')) { const formData = new FormData() for (const [key, value] of Object.entries(body as Record)) { diff --git a/tests/3.0.x/__snapshots__/pluginVueQuery/parserZod/.kubb/serializers.ts b/tests/3.0.x/__snapshots__/pluginVueQuery/parserZod/.kubb/serializers.ts index dd2b2e1fc..d928f56c7 100644 --- a/tests/3.0.x/__snapshots__/pluginVueQuery/parserZod/.kubb/serializers.ts +++ b/tests/3.0.x/__snapshots__/pluginVueQuery/parserZod/.kubb/serializers.ts @@ -1,6 +1,12 @@ export type HeaderValue = string | number | boolean | null | undefined | object export type HeadersInit = Array<[string, HeaderValue]> | Record +/** + * The request body type `fetch` accepts, derived from `RequestInit` instead of the global `BodyInit` + * name, which a Node-only project (`@types/node` without the `dom` lib) does not declare. + */ +export type RequestBody = NonNullable + /** * The OpenAPI query-parameter serialization style. `form` is the default; `spaceDelimited` and * `pipeDelimited` join arrays with a space or pipe, and `deepObject` renders objects as @@ -67,7 +73,7 @@ export type BodyEncoding = SerializationStyle & { * `ArrayBuffer`, and string bodies pass through untouched. The optional `encoding` argument carries * the per-property OpenAPI `encoding` metadata for form bodies. */ -export type BodySerializer = (args: { body: unknown; contentType?: string; encoding?: Record }) => BodyInit | undefined +export type BodySerializer = (args: { body: unknown; contentType?: string; encoding?: Record }) => RequestBody | undefined /** * The OpenAPI path-parameter serialization style. `simple` is the default and emits the bare value; @@ -111,7 +117,7 @@ export type Styles = { body?: Record } -function isFormBody(body: unknown): body is BodyInit { +function isFormBody(body: unknown): body is RequestBody { return ( body instanceof FormData || body instanceof URLSearchParams || @@ -163,7 +169,7 @@ function appendFormDataValue({ formData, key, value, contentType }: { formData: */ export const defaultBodySerializer: BodySerializer = ({ body, contentType, encoding }) => { if (body === undefined || body === null) return undefined - if (isFormBody(body)) return body as BodyInit + if (isFormBody(body)) return body as RequestBody if (contentType?.includes('multipart/form-data')) { const formData = new FormData() for (const [key, value] of Object.entries(body as Record)) { diff --git a/tests/3.0.x/__snapshots__/pluginVueQuery/petStore/.kubb/serializers.ts b/tests/3.0.x/__snapshots__/pluginVueQuery/petStore/.kubb/serializers.ts index dd2b2e1fc..d928f56c7 100644 --- a/tests/3.0.x/__snapshots__/pluginVueQuery/petStore/.kubb/serializers.ts +++ b/tests/3.0.x/__snapshots__/pluginVueQuery/petStore/.kubb/serializers.ts @@ -1,6 +1,12 @@ export type HeaderValue = string | number | boolean | null | undefined | object export type HeadersInit = Array<[string, HeaderValue]> | Record +/** + * The request body type `fetch` accepts, derived from `RequestInit` instead of the global `BodyInit` + * name, which a Node-only project (`@types/node` without the `dom` lib) does not declare. + */ +export type RequestBody = NonNullable + /** * The OpenAPI query-parameter serialization style. `form` is the default; `spaceDelimited` and * `pipeDelimited` join arrays with a space or pipe, and `deepObject` renders objects as @@ -67,7 +73,7 @@ export type BodyEncoding = SerializationStyle & { * `ArrayBuffer`, and string bodies pass through untouched. The optional `encoding` argument carries * the per-property OpenAPI `encoding` metadata for form bodies. */ -export type BodySerializer = (args: { body: unknown; contentType?: string; encoding?: Record }) => BodyInit | undefined +export type BodySerializer = (args: { body: unknown; contentType?: string; encoding?: Record }) => RequestBody | undefined /** * The OpenAPI path-parameter serialization style. `simple` is the default and emits the bare value; @@ -111,7 +117,7 @@ export type Styles = { body?: Record } -function isFormBody(body: unknown): body is BodyInit { +function isFormBody(body: unknown): body is RequestBody { return ( body instanceof FormData || body instanceof URLSearchParams || @@ -163,7 +169,7 @@ function appendFormDataValue({ formData, key, value, contentType }: { formData: */ export const defaultBodySerializer: BodySerializer = ({ body, contentType, encoding }) => { if (body === undefined || body === null) return undefined - if (isFormBody(body)) return body as BodyInit + if (isFormBody(body)) return body as RequestBody if (contentType?.includes('multipart/form-data')) { const formData = new FormData() for (const [key, value] of Object.entries(body as Record)) { diff --git a/tests/3.0.x/__snapshots__/pluginVueQuery/withClientPlugin/.kubb/serializers.ts b/tests/3.0.x/__snapshots__/pluginVueQuery/withClientPlugin/.kubb/serializers.ts index dd2b2e1fc..d928f56c7 100644 --- a/tests/3.0.x/__snapshots__/pluginVueQuery/withClientPlugin/.kubb/serializers.ts +++ b/tests/3.0.x/__snapshots__/pluginVueQuery/withClientPlugin/.kubb/serializers.ts @@ -1,6 +1,12 @@ export type HeaderValue = string | number | boolean | null | undefined | object export type HeadersInit = Array<[string, HeaderValue]> | Record +/** + * The request body type `fetch` accepts, derived from `RequestInit` instead of the global `BodyInit` + * name, which a Node-only project (`@types/node` without the `dom` lib) does not declare. + */ +export type RequestBody = NonNullable + /** * The OpenAPI query-parameter serialization style. `form` is the default; `spaceDelimited` and * `pipeDelimited` join arrays with a space or pipe, and `deepObject` renders objects as @@ -67,7 +73,7 @@ export type BodyEncoding = SerializationStyle & { * `ArrayBuffer`, and string bodies pass through untouched. The optional `encoding` argument carries * the per-property OpenAPI `encoding` metadata for form bodies. */ -export type BodySerializer = (args: { body: unknown; contentType?: string; encoding?: Record }) => BodyInit | undefined +export type BodySerializer = (args: { body: unknown; contentType?: string; encoding?: Record }) => RequestBody | undefined /** * The OpenAPI path-parameter serialization style. `simple` is the default and emits the bare value; @@ -111,7 +117,7 @@ export type Styles = { body?: Record } -function isFormBody(body: unknown): body is BodyInit { +function isFormBody(body: unknown): body is RequestBody { return ( body instanceof FormData || body instanceof URLSearchParams || @@ -163,7 +169,7 @@ function appendFormDataValue({ formData, key, value, contentType }: { formData: */ export const defaultBodySerializer: BodySerializer = ({ body, contentType, encoding }) => { if (body === undefined || body === null) return undefined - if (isFormBody(body)) return body as BodyInit + if (isFormBody(body)) return body as RequestBody if (contentType?.includes('multipart/form-data')) { const formData = new FormData() for (const [key, value] of Object.entries(body as Record)) { From ec2b3762baa6a7110c78e517e260351440dcb4b3 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 4 Sep 2026 13:30:33 +0000 Subject: [PATCH 2/3] fix(plugin-fetch): stop re-declaring RequestBody in the generated client The generated .kubb/client.ts declared its own local RequestBody type, duplicating the one .kubb/serializers.ts already exports. index.ts re-exports both files, so tsc rejected the ambiguous RequestBody export with TS2308. The client now imports RequestBody from ./serializers instead of redeclaring it. Co-Authored-By: Claude Sonnet 5 Claude-Session: https://claude.ai/code/session_01Xrz6kLobdWn2SzrmZxFudc --- examples/fetch/src/gen/.kubb/client.ts | 8 +------- examples/react-query/src/gen/.kubb/client.ts | 8 +------- examples/sdk/src/gen/.kubb/client.ts | 8 +------- examples/simple-single/src/gen/.kubb/client.ts | 8 +------- examples/swr/src/gen/.kubb/client.ts | 8 +------- examples/vue-query/src/gen/.kubb/client.ts | 8 +------- packages/plugin-fetch/templates/fetch.ts | 8 +------- .../__snapshots__/pluginFetch/default/.kubb/client.ts | 8 +------- .../pluginFetch/paramsCasing/.kubb/client.ts | 8 +------- .../__snapshots__/pluginFetch/sdkClass/.kubb/client.ts | 8 +------- .../pluginFetch/sdkClassWithName/.kubb/client.ts | 8 +------- .../__snapshots__/pluginFetch/sdkSingle/.kubb/client.ts | 8 +------- .../__snapshots__/pluginFetch/zodTypes/.kubb/client.ts | 8 +------- .../__snapshots__/pluginFetch/zodTypesSdk/.kubb/client.ts | 8 +------- 14 files changed, 14 insertions(+), 98 deletions(-) diff --git a/examples/fetch/src/gen/.kubb/client.ts b/examples/fetch/src/gen/.kubb/client.ts index 47911f024..4ff6baf71 100644 --- a/examples/fetch/src/gen/.kubb/client.ts +++ b/examples/fetch/src/gen/.kubb/client.ts @@ -1,5 +1,5 @@ import { applyHeaderStyles, defaultBodySerializer, defaultPathSerializer, defaultQuerySerializer, isDefaultJsonBody, serializeCookies } from './serializers' -import type { HeadersInit, PathParamStyle, PathSerializer, Serializers, Styles } from './serializers' +import type { HeadersInit, PathParamStyle, PathSerializer, RequestBody, Serializers, Styles } from './serializers' import { type StandardSchemaValidator, validateStandardSchema } from './standardSchema' /** @@ -7,12 +7,6 @@ import { type StandardSchemaValidator, validateStandardSchema } from './standard */ export type SuccessStatusCode = '200' | '201' | '202' | '203' | '204' | '205' | '206' | '207' | '208' | '226' -/** - * The request body type `fetch` accepts, derived from `RequestInit` instead of the global `BodyInit` - * name, which a Node-only project (`@types/node` without the `dom` lib) does not declare. - */ -export type RequestBody = NonNullable - /** * The success members of a per-status responses record. */ diff --git a/examples/react-query/src/gen/.kubb/client.ts b/examples/react-query/src/gen/.kubb/client.ts index 47911f024..4ff6baf71 100644 --- a/examples/react-query/src/gen/.kubb/client.ts +++ b/examples/react-query/src/gen/.kubb/client.ts @@ -1,5 +1,5 @@ import { applyHeaderStyles, defaultBodySerializer, defaultPathSerializer, defaultQuerySerializer, isDefaultJsonBody, serializeCookies } from './serializers' -import type { HeadersInit, PathParamStyle, PathSerializer, Serializers, Styles } from './serializers' +import type { HeadersInit, PathParamStyle, PathSerializer, RequestBody, Serializers, Styles } from './serializers' import { type StandardSchemaValidator, validateStandardSchema } from './standardSchema' /** @@ -7,12 +7,6 @@ import { type StandardSchemaValidator, validateStandardSchema } from './standard */ export type SuccessStatusCode = '200' | '201' | '202' | '203' | '204' | '205' | '206' | '207' | '208' | '226' -/** - * The request body type `fetch` accepts, derived from `RequestInit` instead of the global `BodyInit` - * name, which a Node-only project (`@types/node` without the `dom` lib) does not declare. - */ -export type RequestBody = NonNullable - /** * The success members of a per-status responses record. */ diff --git a/examples/sdk/src/gen/.kubb/client.ts b/examples/sdk/src/gen/.kubb/client.ts index 47911f024..4ff6baf71 100644 --- a/examples/sdk/src/gen/.kubb/client.ts +++ b/examples/sdk/src/gen/.kubb/client.ts @@ -1,5 +1,5 @@ import { applyHeaderStyles, defaultBodySerializer, defaultPathSerializer, defaultQuerySerializer, isDefaultJsonBody, serializeCookies } from './serializers' -import type { HeadersInit, PathParamStyle, PathSerializer, Serializers, Styles } from './serializers' +import type { HeadersInit, PathParamStyle, PathSerializer, RequestBody, Serializers, Styles } from './serializers' import { type StandardSchemaValidator, validateStandardSchema } from './standardSchema' /** @@ -7,12 +7,6 @@ import { type StandardSchemaValidator, validateStandardSchema } from './standard */ export type SuccessStatusCode = '200' | '201' | '202' | '203' | '204' | '205' | '206' | '207' | '208' | '226' -/** - * The request body type `fetch` accepts, derived from `RequestInit` instead of the global `BodyInit` - * name, which a Node-only project (`@types/node` without the `dom` lib) does not declare. - */ -export type RequestBody = NonNullable - /** * The success members of a per-status responses record. */ diff --git a/examples/simple-single/src/gen/.kubb/client.ts b/examples/simple-single/src/gen/.kubb/client.ts index 47911f024..4ff6baf71 100644 --- a/examples/simple-single/src/gen/.kubb/client.ts +++ b/examples/simple-single/src/gen/.kubb/client.ts @@ -1,5 +1,5 @@ import { applyHeaderStyles, defaultBodySerializer, defaultPathSerializer, defaultQuerySerializer, isDefaultJsonBody, serializeCookies } from './serializers' -import type { HeadersInit, PathParamStyle, PathSerializer, Serializers, Styles } from './serializers' +import type { HeadersInit, PathParamStyle, PathSerializer, RequestBody, Serializers, Styles } from './serializers' import { type StandardSchemaValidator, validateStandardSchema } from './standardSchema' /** @@ -7,12 +7,6 @@ import { type StandardSchemaValidator, validateStandardSchema } from './standard */ export type SuccessStatusCode = '200' | '201' | '202' | '203' | '204' | '205' | '206' | '207' | '208' | '226' -/** - * The request body type `fetch` accepts, derived from `RequestInit` instead of the global `BodyInit` - * name, which a Node-only project (`@types/node` without the `dom` lib) does not declare. - */ -export type RequestBody = NonNullable - /** * The success members of a per-status responses record. */ diff --git a/examples/swr/src/gen/.kubb/client.ts b/examples/swr/src/gen/.kubb/client.ts index 47911f024..4ff6baf71 100644 --- a/examples/swr/src/gen/.kubb/client.ts +++ b/examples/swr/src/gen/.kubb/client.ts @@ -1,5 +1,5 @@ import { applyHeaderStyles, defaultBodySerializer, defaultPathSerializer, defaultQuerySerializer, isDefaultJsonBody, serializeCookies } from './serializers' -import type { HeadersInit, PathParamStyle, PathSerializer, Serializers, Styles } from './serializers' +import type { HeadersInit, PathParamStyle, PathSerializer, RequestBody, Serializers, Styles } from './serializers' import { type StandardSchemaValidator, validateStandardSchema } from './standardSchema' /** @@ -7,12 +7,6 @@ import { type StandardSchemaValidator, validateStandardSchema } from './standard */ export type SuccessStatusCode = '200' | '201' | '202' | '203' | '204' | '205' | '206' | '207' | '208' | '226' -/** - * The request body type `fetch` accepts, derived from `RequestInit` instead of the global `BodyInit` - * name, which a Node-only project (`@types/node` without the `dom` lib) does not declare. - */ -export type RequestBody = NonNullable - /** * The success members of a per-status responses record. */ diff --git a/examples/vue-query/src/gen/.kubb/client.ts b/examples/vue-query/src/gen/.kubb/client.ts index 47911f024..4ff6baf71 100644 --- a/examples/vue-query/src/gen/.kubb/client.ts +++ b/examples/vue-query/src/gen/.kubb/client.ts @@ -1,5 +1,5 @@ import { applyHeaderStyles, defaultBodySerializer, defaultPathSerializer, defaultQuerySerializer, isDefaultJsonBody, serializeCookies } from './serializers' -import type { HeadersInit, PathParamStyle, PathSerializer, Serializers, Styles } from './serializers' +import type { HeadersInit, PathParamStyle, PathSerializer, RequestBody, Serializers, Styles } from './serializers' import { type StandardSchemaValidator, validateStandardSchema } from './standardSchema' /** @@ -7,12 +7,6 @@ import { type StandardSchemaValidator, validateStandardSchema } from './standard */ export type SuccessStatusCode = '200' | '201' | '202' | '203' | '204' | '205' | '206' | '207' | '208' | '226' -/** - * The request body type `fetch` accepts, derived from `RequestInit` instead of the global `BodyInit` - * name, which a Node-only project (`@types/node` without the `dom` lib) does not declare. - */ -export type RequestBody = NonNullable - /** * The success members of a per-status responses record. */ diff --git a/packages/plugin-fetch/templates/fetch.ts b/packages/plugin-fetch/templates/fetch.ts index 47911f024..4ff6baf71 100644 --- a/packages/plugin-fetch/templates/fetch.ts +++ b/packages/plugin-fetch/templates/fetch.ts @@ -1,5 +1,5 @@ import { applyHeaderStyles, defaultBodySerializer, defaultPathSerializer, defaultQuerySerializer, isDefaultJsonBody, serializeCookies } from './serializers' -import type { HeadersInit, PathParamStyle, PathSerializer, Serializers, Styles } from './serializers' +import type { HeadersInit, PathParamStyle, PathSerializer, RequestBody, Serializers, Styles } from './serializers' import { type StandardSchemaValidator, validateStandardSchema } from './standardSchema' /** @@ -7,12 +7,6 @@ import { type StandardSchemaValidator, validateStandardSchema } from './standard */ export type SuccessStatusCode = '200' | '201' | '202' | '203' | '204' | '205' | '206' | '207' | '208' | '226' -/** - * The request body type `fetch` accepts, derived from `RequestInit` instead of the global `BodyInit` - * name, which a Node-only project (`@types/node` without the `dom` lib) does not declare. - */ -export type RequestBody = NonNullable - /** * The success members of a per-status responses record. */ diff --git a/tests/3.0.x/__snapshots__/pluginFetch/default/.kubb/client.ts b/tests/3.0.x/__snapshots__/pluginFetch/default/.kubb/client.ts index 47911f024..4ff6baf71 100644 --- a/tests/3.0.x/__snapshots__/pluginFetch/default/.kubb/client.ts +++ b/tests/3.0.x/__snapshots__/pluginFetch/default/.kubb/client.ts @@ -1,5 +1,5 @@ import { applyHeaderStyles, defaultBodySerializer, defaultPathSerializer, defaultQuerySerializer, isDefaultJsonBody, serializeCookies } from './serializers' -import type { HeadersInit, PathParamStyle, PathSerializer, Serializers, Styles } from './serializers' +import type { HeadersInit, PathParamStyle, PathSerializer, RequestBody, Serializers, Styles } from './serializers' import { type StandardSchemaValidator, validateStandardSchema } from './standardSchema' /** @@ -7,12 +7,6 @@ import { type StandardSchemaValidator, validateStandardSchema } from './standard */ export type SuccessStatusCode = '200' | '201' | '202' | '203' | '204' | '205' | '206' | '207' | '208' | '226' -/** - * The request body type `fetch` accepts, derived from `RequestInit` instead of the global `BodyInit` - * name, which a Node-only project (`@types/node` without the `dom` lib) does not declare. - */ -export type RequestBody = NonNullable - /** * The success members of a per-status responses record. */ diff --git a/tests/3.0.x/__snapshots__/pluginFetch/paramsCasing/.kubb/client.ts b/tests/3.0.x/__snapshots__/pluginFetch/paramsCasing/.kubb/client.ts index 47911f024..4ff6baf71 100644 --- a/tests/3.0.x/__snapshots__/pluginFetch/paramsCasing/.kubb/client.ts +++ b/tests/3.0.x/__snapshots__/pluginFetch/paramsCasing/.kubb/client.ts @@ -1,5 +1,5 @@ import { applyHeaderStyles, defaultBodySerializer, defaultPathSerializer, defaultQuerySerializer, isDefaultJsonBody, serializeCookies } from './serializers' -import type { HeadersInit, PathParamStyle, PathSerializer, Serializers, Styles } from './serializers' +import type { HeadersInit, PathParamStyle, PathSerializer, RequestBody, Serializers, Styles } from './serializers' import { type StandardSchemaValidator, validateStandardSchema } from './standardSchema' /** @@ -7,12 +7,6 @@ import { type StandardSchemaValidator, validateStandardSchema } from './standard */ export type SuccessStatusCode = '200' | '201' | '202' | '203' | '204' | '205' | '206' | '207' | '208' | '226' -/** - * The request body type `fetch` accepts, derived from `RequestInit` instead of the global `BodyInit` - * name, which a Node-only project (`@types/node` without the `dom` lib) does not declare. - */ -export type RequestBody = NonNullable - /** * The success members of a per-status responses record. */ diff --git a/tests/3.0.x/__snapshots__/pluginFetch/sdkClass/.kubb/client.ts b/tests/3.0.x/__snapshots__/pluginFetch/sdkClass/.kubb/client.ts index 47911f024..4ff6baf71 100644 --- a/tests/3.0.x/__snapshots__/pluginFetch/sdkClass/.kubb/client.ts +++ b/tests/3.0.x/__snapshots__/pluginFetch/sdkClass/.kubb/client.ts @@ -1,5 +1,5 @@ import { applyHeaderStyles, defaultBodySerializer, defaultPathSerializer, defaultQuerySerializer, isDefaultJsonBody, serializeCookies } from './serializers' -import type { HeadersInit, PathParamStyle, PathSerializer, Serializers, Styles } from './serializers' +import type { HeadersInit, PathParamStyle, PathSerializer, RequestBody, Serializers, Styles } from './serializers' import { type StandardSchemaValidator, validateStandardSchema } from './standardSchema' /** @@ -7,12 +7,6 @@ import { type StandardSchemaValidator, validateStandardSchema } from './standard */ export type SuccessStatusCode = '200' | '201' | '202' | '203' | '204' | '205' | '206' | '207' | '208' | '226' -/** - * The request body type `fetch` accepts, derived from `RequestInit` instead of the global `BodyInit` - * name, which a Node-only project (`@types/node` without the `dom` lib) does not declare. - */ -export type RequestBody = NonNullable - /** * The success members of a per-status responses record. */ diff --git a/tests/3.0.x/__snapshots__/pluginFetch/sdkClassWithName/.kubb/client.ts b/tests/3.0.x/__snapshots__/pluginFetch/sdkClassWithName/.kubb/client.ts index 47911f024..4ff6baf71 100644 --- a/tests/3.0.x/__snapshots__/pluginFetch/sdkClassWithName/.kubb/client.ts +++ b/tests/3.0.x/__snapshots__/pluginFetch/sdkClassWithName/.kubb/client.ts @@ -1,5 +1,5 @@ import { applyHeaderStyles, defaultBodySerializer, defaultPathSerializer, defaultQuerySerializer, isDefaultJsonBody, serializeCookies } from './serializers' -import type { HeadersInit, PathParamStyle, PathSerializer, Serializers, Styles } from './serializers' +import type { HeadersInit, PathParamStyle, PathSerializer, RequestBody, Serializers, Styles } from './serializers' import { type StandardSchemaValidator, validateStandardSchema } from './standardSchema' /** @@ -7,12 +7,6 @@ import { type StandardSchemaValidator, validateStandardSchema } from './standard */ export type SuccessStatusCode = '200' | '201' | '202' | '203' | '204' | '205' | '206' | '207' | '208' | '226' -/** - * The request body type `fetch` accepts, derived from `RequestInit` instead of the global `BodyInit` - * name, which a Node-only project (`@types/node` without the `dom` lib) does not declare. - */ -export type RequestBody = NonNullable - /** * The success members of a per-status responses record. */ diff --git a/tests/3.0.x/__snapshots__/pluginFetch/sdkSingle/.kubb/client.ts b/tests/3.0.x/__snapshots__/pluginFetch/sdkSingle/.kubb/client.ts index 47911f024..4ff6baf71 100644 --- a/tests/3.0.x/__snapshots__/pluginFetch/sdkSingle/.kubb/client.ts +++ b/tests/3.0.x/__snapshots__/pluginFetch/sdkSingle/.kubb/client.ts @@ -1,5 +1,5 @@ import { applyHeaderStyles, defaultBodySerializer, defaultPathSerializer, defaultQuerySerializer, isDefaultJsonBody, serializeCookies } from './serializers' -import type { HeadersInit, PathParamStyle, PathSerializer, Serializers, Styles } from './serializers' +import type { HeadersInit, PathParamStyle, PathSerializer, RequestBody, Serializers, Styles } from './serializers' import { type StandardSchemaValidator, validateStandardSchema } from './standardSchema' /** @@ -7,12 +7,6 @@ import { type StandardSchemaValidator, validateStandardSchema } from './standard */ export type SuccessStatusCode = '200' | '201' | '202' | '203' | '204' | '205' | '206' | '207' | '208' | '226' -/** - * The request body type `fetch` accepts, derived from `RequestInit` instead of the global `BodyInit` - * name, which a Node-only project (`@types/node` without the `dom` lib) does not declare. - */ -export type RequestBody = NonNullable - /** * The success members of a per-status responses record. */ diff --git a/tests/3.0.x/__snapshots__/pluginFetch/zodTypes/.kubb/client.ts b/tests/3.0.x/__snapshots__/pluginFetch/zodTypes/.kubb/client.ts index 47911f024..4ff6baf71 100644 --- a/tests/3.0.x/__snapshots__/pluginFetch/zodTypes/.kubb/client.ts +++ b/tests/3.0.x/__snapshots__/pluginFetch/zodTypes/.kubb/client.ts @@ -1,5 +1,5 @@ import { applyHeaderStyles, defaultBodySerializer, defaultPathSerializer, defaultQuerySerializer, isDefaultJsonBody, serializeCookies } from './serializers' -import type { HeadersInit, PathParamStyle, PathSerializer, Serializers, Styles } from './serializers' +import type { HeadersInit, PathParamStyle, PathSerializer, RequestBody, Serializers, Styles } from './serializers' import { type StandardSchemaValidator, validateStandardSchema } from './standardSchema' /** @@ -7,12 +7,6 @@ import { type StandardSchemaValidator, validateStandardSchema } from './standard */ export type SuccessStatusCode = '200' | '201' | '202' | '203' | '204' | '205' | '206' | '207' | '208' | '226' -/** - * The request body type `fetch` accepts, derived from `RequestInit` instead of the global `BodyInit` - * name, which a Node-only project (`@types/node` without the `dom` lib) does not declare. - */ -export type RequestBody = NonNullable - /** * The success members of a per-status responses record. */ diff --git a/tests/3.0.x/__snapshots__/pluginFetch/zodTypesSdk/.kubb/client.ts b/tests/3.0.x/__snapshots__/pluginFetch/zodTypesSdk/.kubb/client.ts index 47911f024..4ff6baf71 100644 --- a/tests/3.0.x/__snapshots__/pluginFetch/zodTypesSdk/.kubb/client.ts +++ b/tests/3.0.x/__snapshots__/pluginFetch/zodTypesSdk/.kubb/client.ts @@ -1,5 +1,5 @@ import { applyHeaderStyles, defaultBodySerializer, defaultPathSerializer, defaultQuerySerializer, isDefaultJsonBody, serializeCookies } from './serializers' -import type { HeadersInit, PathParamStyle, PathSerializer, Serializers, Styles } from './serializers' +import type { HeadersInit, PathParamStyle, PathSerializer, RequestBody, Serializers, Styles } from './serializers' import { type StandardSchemaValidator, validateStandardSchema } from './standardSchema' /** @@ -7,12 +7,6 @@ import { type StandardSchemaValidator, validateStandardSchema } from './standard */ export type SuccessStatusCode = '200' | '201' | '202' | '203' | '204' | '205' | '206' | '207' | '208' | '226' -/** - * The request body type `fetch` accepts, derived from `RequestInit` instead of the global `BodyInit` - * name, which a Node-only project (`@types/node` without the `dom` lib) does not declare. - */ -export type RequestBody = NonNullable - /** * The success members of a per-status responses record. */ From 530d38474789b55b15272c31d5bc4ca09f673c8c Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 4 Sep 2026 14:13:38 +0000 Subject: [PATCH 3/3] ci: replace removed kubb generate --debug with --reporter file kubb v5 dropped the --debug flag in favor of the reporters system (see kubb-labs/docs migration guide), so tests/e2e's E2E job failed with "Unknown option: --debug" once CI resolved a kubb version that enforces unknown-option validation. --reporter file is the documented replacement, writing the same kind of log. Co-Authored-By: Claude Sonnet 5 Claude-Session: https://claude.ai/code/session_01Xrz6kLobdWn2SzrmZxFudc --- .github/workflows/pr.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 42a7451e0..0d9860aa6 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -303,4 +303,4 @@ jobs: NODE_OPTIONS: '--max_old_space_size=4096' KUBB_DISABLE_TELEMETRY: '1' run: | - pnpm run generate --debug + pnpm run generate --reporter file