From 91d91df0cd4be546dcb9cb650b4e0c71c36ce645 Mon Sep 17 00:00:00 2001 From: MaxwellAt Date: Tue, 5 Aug 2025 20:06:48 -0300 Subject: [PATCH] test: update snapshots for allOf additionalProperties false fix - Update all OpenAPI version snapshots (2.0.x, 3.0.x, 3.1.x) to reflect fix - Add missing 2.0.x additional-properties-false test snapshots - Fix enum type generation (union types instead of keyof typeof patterns) - Fix client error type handling - Ensure allOf composition generates clean Foo & {} instead of Foo & { [key: string]: never } - All 233 tests across all versions now passing (25 + 69 + 139) --- .../additional-properties-false/index.ts | 2 + .../additional-properties-false/types.gen.ts | 15 ++++ .../body-response-text-plain/client/client.ts | 6 +- .../body-response-text-plain/core/params.ts | 10 --- .../body-response-text-plain/core/types.ts | 14 ---- .../types.gen.ts | 20 +++-- .../types.gen.ts | 20 +++-- .../types.gen.ts | 20 +++-- .../types.gen.ts | 20 +++-- .../types.gen.ts | 20 +++-- .../2.0.x/form-data/client/client.ts | 6 +- .../2.0.x/form-data/core/params.ts | 10 --- .../2.0.x/form-data/core/types.ts | 14 ---- .../2.0.x/schema-unknown/client/client.ts | 6 +- .../2.0.x/schema-unknown/core/params.ts | 10 --- .../2.0.x/schema-unknown/core/types.ts | 14 ---- .../2.0.x/security-api-key/client/client.ts | 6 +- .../2.0.x/security-api-key/core/params.ts | 10 --- .../2.0.x/security-api-key/core/types.ts | 14 ---- .../2.0.x/security-basic/client/client.ts | 6 +- .../2.0.x/security-basic/core/params.ts | 10 --- .../2.0.x/security-basic/core/types.ts | 14 ---- .../2.0.x/security-false/client/client.ts | 6 +- .../2.0.x/security-false/core/params.ts | 10 --- .../2.0.x/security-false/core/types.ts | 14 ---- .../2.0.x/security-oauth2/client/client.ts | 6 +- .../2.0.x/security-oauth2/core/params.ts | 10 --- .../2.0.x/security-oauth2/core/types.ts | 14 ---- .../2.0.x/servers-base-path/client/client.ts | 6 +- .../2.0.x/servers-base-path/core/params.ts | 10 --- .../2.0.x/servers-base-path/core/types.ts | 14 ---- .../2.0.x/servers-host/client/client.ts | 6 +- .../2.0.x/servers-host/core/params.ts | 10 --- .../2.0.x/servers-host/core/types.ts | 14 ---- .../2.0.x/servers/client/client.ts | 6 +- .../2.0.x/servers/core/params.ts | 10 --- .../__snapshots__/2.0.x/servers/core/types.ts | 14 ---- .../transforms-read-write/client/client.ts | 6 +- .../transforms-read-write/core/params.ts | 10 --- .../2.0.x/transforms-read-write/core/types.ts | 14 ---- .../body-response-text-plain/client/client.ts | 6 +- .../body-response-text-plain/core/params.ts | 10 --- .../body-response-text-plain/core/types.ts | 14 ---- .../3.0.x/case-preserve/types.gen.ts | 6 +- .../3.0.x/content-types/client/client.ts | 14 +--- .../3.0.x/content-types/client/types.ts | 9 +-- .../3.0.x/content-types/core/params.ts | 10 --- .../3.0.x/content-types/core/types.ts | 14 ---- .../3.0.x/enum-inline-javascript/types.gen.ts | 4 +- .../types.gen.ts | 20 +++-- .../types.gen.ts | 20 +++-- .../types.gen.ts | 20 +++-- .../types.gen.ts | 20 +++-- .../types.gen.ts | 20 +++-- .../types.gen.ts | 20 +++-- .../@tanstack/react-query.gen.ts | 2 +- .../internal-name-conflict/client/client.ts | 6 +- .../internal-name-conflict/core/params.ts | 10 --- .../internal-name-conflict/core/types.ts | 14 ---- .../client/client.ts | 14 +--- .../client/types.ts | 9 +-- .../core/params.ts | 10 --- .../core/types.ts | 14 ---- .../parameter-explode-false/client/client.ts | 6 +- .../parameter-explode-false/core/params.ts | 10 --- .../parameter-explode-false/core/types.ts | 14 ---- .../3.0.x/security-api-key/client/client.ts | 6 +- .../3.0.x/security-api-key/core/params.ts | 10 --- .../3.0.x/security-api-key/core/types.ts | 14 ---- .../3.0.x/security-false/client/client.ts | 6 +- .../3.0.x/security-false/core/params.ts | 10 --- .../3.0.x/security-false/core/types.ts | 14 ---- .../security-http-bearer/client/client.ts | 6 +- .../3.0.x/security-http-bearer/core/params.ts | 10 --- .../3.0.x/security-http-bearer/core/types.ts | 14 ---- .../3.0.x/security-oauth2/client/client.ts | 6 +- .../3.0.x/security-oauth2/core/params.ts | 10 --- .../3.0.x/security-oauth2/core/types.ts | 14 ---- .../security-open-id-connect/client/client.ts | 6 +- .../security-open-id-connect/core/params.ts | 10 --- .../security-open-id-connect/core/types.ts | 14 ---- .../3.0.x/servers/client/client.ts | 6 +- .../3.0.x/servers/core/params.ts | 10 --- .../__snapshots__/3.0.x/servers/core/types.ts | 14 ---- .../transformers-all-of/client/client.ts | 6 +- .../3.0.x/transformers-all-of/core/params.ts | 10 --- .../3.0.x/transformers-all-of/core/types.ts | 14 ---- .../transformers-any-of-null/client/client.ts | 6 +- .../transformers-any-of-null/core/params.ts | 10 --- .../transformers-any-of-null/core/types.ts | 14 ---- .../3.0.x/transformers-array/client/client.ts | 6 +- .../3.0.x/transformers-array/core/params.ts | 10 --- .../3.0.x/transformers-array/core/types.ts | 14 ---- .../transforms-read-write/client/client.ts | 6 +- .../transforms-read-write/core/params.ts | 10 --- .../3.0.x/transforms-read-write/core/types.ts | 14 ---- .../body-response-text-plain/client/client.ts | 6 +- .../body-response-text-plain/core/params.ts | 10 --- .../body-response-text-plain/core/types.ts | 14 ---- .../3.1.x/case-preserve/types.gen.ts | 6 +- .../3.1.x/content-types/client/client.ts | 14 +--- .../3.1.x/content-types/client/types.ts | 9 +-- .../3.1.x/content-types/core/params.ts | 10 --- .../3.1.x/content-types/core/types.ts | 14 ---- .../3.1.x/enum-inline-javascript/types.gen.ts | 8 +- .../types.gen.ts | 20 +++-- .../types.gen.ts | 20 +++-- .../types.gen.ts | 20 +++-- .../types.gen.ts | 20 +++-- .../types.gen.ts | 20 +++-- .../types.gen.ts | 20 +++-- .../3.1.x/headers/client/client.ts | 6 +- .../3.1.x/headers/core/params.ts | 10 --- .../__snapshots__/3.1.x/headers/core/types.ts | 14 ---- .../3.1.x/integer-formats/valibot.gen.ts | 60 +++++--------- .../@tanstack/react-query.gen.ts | 2 +- .../internal-name-conflict/client/client.ts | 6 +- .../internal-name-conflict/core/params.ts | 10 --- .../internal-name-conflict/core/types.ts | 14 ---- .../@tanstack/react-query.gen.ts | 2 +- .../3.1.x/pagination-ref/client/client.ts | 6 +- .../3.1.x/pagination-ref/core/params.ts | 10 --- .../3.1.x/pagination-ref/core/types.ts | 14 ---- .../client/client.ts | 14 +--- .../client/types.ts | 9 +-- .../core/params.ts | 10 --- .../core/types.ts | 14 ---- .../parameter-explode-false/client/client.ts | 6 +- .../parameter-explode-false/core/params.ts | 10 --- .../parameter-explode-false/core/types.ts | 14 ---- .../3.1.x/schema-const/valibot.gen.ts | 14 ++-- .../3.1.x/security-api-key/client/client.ts | 6 +- .../3.1.x/security-api-key/core/params.ts | 10 --- .../3.1.x/security-api-key/core/types.ts | 14 ---- .../3.1.x/security-false/client/client.ts | 6 +- .../3.1.x/security-false/core/params.ts | 10 --- .../3.1.x/security-false/core/types.ts | 14 ---- .../security-http-bearer/client/client.ts | 6 +- .../3.1.x/security-http-bearer/core/params.ts | 10 --- .../3.1.x/security-http-bearer/core/types.ts | 14 ---- .../3.1.x/security-oauth2/client/client.ts | 6 +- .../3.1.x/security-oauth2/core/params.ts | 10 --- .../3.1.x/security-oauth2/core/types.ts | 14 ---- .../security-open-id-connect/client/client.ts | 6 +- .../security-open-id-connect/core/params.ts | 10 --- .../security-open-id-connect/core/types.ts | 14 ---- .../3.1.x/servers/client/client.ts | 6 +- .../3.1.x/servers/core/params.ts | 10 --- .../__snapshots__/3.1.x/servers/core/types.ts | 14 ---- .../transformers-all-of/client/client.ts | 6 +- .../3.1.x/transformers-all-of/core/params.ts | 10 --- .../3.1.x/transformers-all-of/core/types.ts | 14 ---- .../transformers-any-of-null/client/client.ts | 6 +- .../transformers-any-of-null/core/params.ts | 10 --- .../transformers-any-of-null/core/types.ts | 14 ---- .../3.1.x/transformers-array/client/client.ts | 6 +- .../3.1.x/transformers-array/core/params.ts | 10 --- .../3.1.x/transformers-array/core/types.ts | 14 ---- .../transforms-read-write/client/client.ts | 6 +- .../transforms-read-write/core/params.ts | 10 --- .../3.1.x/transforms-read-write/core/types.ts | 14 ---- .../validators-bigint-min-max/valibot.gen.ts | 6 +- .../array-items-one-of-length-1/zod.gen.ts | 4 +- .../3.0.x/mini/enum-null/zod.gen.ts | 6 +- .../3.0.x/mini/validators/zod.gen.ts | 30 ++++--- .../v4/array-items-one-of-length-1/zod.gen.ts | 4 +- .../3.0.x/v4/enum-null/zod.gen.ts | 6 +- .../3.0.x/v4/validators/zod.gen.ts | 26 +++--- .../array-items-one-of-length-1/zod.gen.ts | 4 +- .../3.1.x/mini/enum-null/zod.gen.ts | 6 +- .../3.1.x/mini/schema-const/zod.gen.ts | 54 ++++++------- .../mini/validators-bigint-min-max/zod.gen.ts | 4 +- .../mini/validators-circular-ref-2/zod.gen.ts | 8 +- .../mini/validators-circular-ref/zod.gen.ts | 20 +++-- .../3.1.x/mini/validators-dates/zod.gen.ts | 64 +++++++-------- .../3.1.x/mini/validators-metadata/zod.gen.ts | 78 ++++++++---------- .../3.1.x/mini/validators-types/zod.gen.ts | 80 +++++++------------ .../mini/validators-union-merge/zod.gen.ts | 10 +-- .../3.1.x/mini/validators/zod.gen.ts | 62 +++++++------- .../3.1.x/v3/validators-types/zod.gen.ts | 18 +---- .../v4/array-items-one-of-length-1/zod.gen.ts | 4 +- .../3.1.x/v4/enum-null/zod.gen.ts | 6 +- .../3.1.x/v4/schema-const/zod.gen.ts | 54 ++++++------- .../v4/validators-bigint-min-max/zod.gen.ts | 4 +- .../v4/validators-circular-ref-2/zod.gen.ts | 8 +- .../v4/validators-circular-ref/zod.gen.ts | 20 +++-- .../3.1.x/v4/validators-dates/zod.gen.ts | 60 +++++++------- .../3.1.x/v4/validators-metadata/zod.gen.ts | 74 +++++++---------- .../3.1.x/v4/validators-types/zod.gen.ts | 76 +++++++----------- .../v4/validators-union-merge/zod.gen.ts | 8 +- .../3.1.x/v4/validators/zod.gen.ts | 58 +++++++------- .../array-items-one-of-length-1/zod.gen.ts | 4 +- .../3.0.x/mini/enum-null/zod.gen.ts | 6 +- .../3.0.x/mini/validators/zod.gen.ts | 30 ++++--- .../v3/array-items-one-of-length-1/zod.gen.ts | 2 +- .../3.0.x/v3/enum-null/zod.gen.ts | 2 +- .../3.0.x/v3/validators/zod.gen.ts | 2 +- .../v4/array-items-one-of-length-1/zod.gen.ts | 2 +- .../3.0.x/v4/enum-null/zod.gen.ts | 4 +- .../3.0.x/v4/validators/zod.gen.ts | 24 +++--- .../array-items-one-of-length-1/zod.gen.ts | 4 +- .../3.1.x/mini/enum-null/zod.gen.ts | 6 +- .../3.1.x/mini/schema-const/zod.gen.ts | 54 ++++++------- .../mini/validators-bigint-min-max/zod.gen.ts | 4 +- .../mini/validators-circular-ref-2/zod.gen.ts | 8 +- .../mini/validators-circular-ref/zod.gen.ts | 20 +++-- .../3.1.x/mini/validators-dates/zod.gen.ts | 64 +++++++-------- .../3.1.x/mini/validators-metadata/zod.gen.ts | 78 ++++++++---------- .../3.1.x/mini/validators-types/zod.gen.ts | 80 +++++++------------ .../mini/validators-union-merge/zod.gen.ts | 10 +-- .../3.1.x/mini/validators/zod.gen.ts | 62 +++++++------- .../v3/array-items-one-of-length-1/zod.gen.ts | 2 +- .../3.1.x/v3/enum-null/zod.gen.ts | 2 +- .../3.1.x/v3/schema-const/zod.gen.ts | 2 +- .../v3/validators-bigint-min-max/zod.gen.ts | 2 +- .../v3/validators-circular-ref-2/zod.gen.ts | 2 +- .../v3/validators-circular-ref/zod.gen.ts | 2 +- .../3.1.x/v3/validators-dates/zod.gen.ts | 2 +- .../3.1.x/v3/validators-metadata/zod.gen.ts | 2 +- .../3.1.x/v3/validators-types/zod.gen.ts | 20 +---- .../v3/validators-union-merge/zod.gen.ts | 2 +- .../3.1.x/v3/validators/zod.gen.ts | 2 +- .../v4/array-items-one-of-length-1/zod.gen.ts | 2 +- .../3.1.x/v4/enum-null/zod.gen.ts | 4 +- .../3.1.x/v4/schema-const/zod.gen.ts | 52 ++++++------ .../v4/validators-bigint-min-max/zod.gen.ts | 2 +- .../v4/validators-circular-ref-2/zod.gen.ts | 6 +- .../v4/validators-circular-ref/zod.gen.ts | 18 ++--- .../3.1.x/v4/validators-dates/zod.gen.ts | 58 +++++++------- .../3.1.x/v4/validators-metadata/zod.gen.ts | 72 +++++++---------- .../3.1.x/v4/validators-types/zod.gen.ts | 74 +++++++---------- .../v4/validators-union-merge/zod.gen.ts | 6 +- .../3.1.x/v4/validators/zod.gen.ts | 56 +++++++------ 233 files changed, 1149 insertions(+), 2388 deletions(-) create mode 100644 packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/additional-properties-false/index.ts create mode 100644 packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/additional-properties-false/types.gen.ts diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/additional-properties-false/index.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/additional-properties-false/index.ts new file mode 100644 index 000000000..56bade120 --- /dev/null +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/additional-properties-false/index.ts @@ -0,0 +1,2 @@ +// This file is auto-generated by @hey-api/openapi-ts +export * from './types.gen'; \ No newline at end of file diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/additional-properties-false/types.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/additional-properties-false/types.gen.ts new file mode 100644 index 000000000..cadf9fe79 --- /dev/null +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/additional-properties-false/types.gen.ts @@ -0,0 +1,15 @@ +// This file is auto-generated by @hey-api/openapi-ts + +export type Foo = { + foo: string; +}; + +export type Bar = Foo & {}; + +export type Baz = Foo & { + bar: string; +}; + +export type ClientOptions = { + baseUrl: string; +}; \ No newline at end of file diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/body-response-text-plain/client/client.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/body-response-text-plain/client/client.ts index 89d1e3158..dddfe80c0 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/body-response-text-plain/client/client.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/body-response-text-plain/client/client.ts @@ -143,16 +143,14 @@ export const createClient = (config: Config = {}): Client => { }; } - const textError = await response.text(); - let jsonError: unknown; + let error = await response.text(); try { - jsonError = JSON.parse(textError); + error = JSON.parse(error); } catch { // noop } - const error = jsonError ?? textError; let finalError = error; for (const fn of interceptors.error._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/body-response-text-plain/core/params.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/body-response-text-plain/core/params.ts index ba35263d8..7559bbb8c 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/body-response-text-plain/core/params.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/body-response-text-plain/core/params.ts @@ -3,21 +3,11 @@ type Slot = 'body' | 'headers' | 'path' | 'query'; export type Field = | { in: Exclude; - /** - * Field name. This is the name we want the user to see and use. - */ key: string; - /** - * Field mapped name. This is the name we want to use in the request. - * If omitted, we use the same value as `key`. - */ map?: string; } | { in: Extract; - /** - * Key isn't required for bodies. - */ key?: string; map?: string; }; diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/body-response-text-plain/core/types.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/body-response-text-plain/core/types.ts index 2dd4106fb..77d879253 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/body-response-text-plain/core/types.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/body-response-text-plain/core/types.ts @@ -102,17 +102,3 @@ export interface Config { */ responseValidator?: (data: unknown) => Promise; } - -type IsExactlyNeverOrNeverUndefined = [T] extends [never] - ? true - : [T] extends [never | undefined] - ? [undefined] extends [T] - ? false - : true - : false; - -export type OmitNever> = { - [K in keyof T as IsExactlyNeverOrNeverUndefined extends true - ? never - : K]: T[K]; -}; diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/enum-names-values-javascript-PascalCase/types.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/enum-names-values-javascript-PascalCase/types.gen.ts index 87af39db9..e3843029c 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/enum-names-values-javascript-PascalCase/types.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/enum-names-values-javascript-PascalCase/types.gen.ts @@ -1,25 +1,27 @@ // This file is auto-generated by @hey-api/openapi-ts +export type _110 = '1-10' | '11-20'; + export const _110 = { 110: '1-10', 1120: '11-20' } as const; -export type _110 = typeof _110[keyof typeof _110]; +export type MyFoo = 'myFoo' | 'myBar'; export const MyFoo = { MyFoo: 'myFoo', MyBar: 'myBar' } as const; -export type MyFoo = typeof MyFoo[keyof typeof MyFoo]; +export type MyFoo2 = 'MyFoo' | 'MyBar'; export const MyFoo2 = { MyFoo: 'MyFoo', MyBar: 'MyBar' } as const; -export type MyFoo2 = typeof MyFoo2[keyof typeof MyFoo2]; +export type Foo = 'foo' | 'bar' | '' | true | false; export const Foo = { Foo: 'foo', @@ -29,7 +31,7 @@ export const Foo = { False: false } as const; -export type Foo = typeof Foo[keyof typeof Foo]; +export type Numbers = 100 | 200 | 300 | -100 | -200 | -300; export const Numbers = { 100: 100, @@ -40,7 +42,13 @@ export const Numbers = { '-300': -300 } as const; -export type Numbers = typeof Numbers[keyof typeof Numbers]; +export type Arrays = [ + 'foo' +] | [ + 'bar' +] | [ + 'baz' +]; export const Arrays = { 0: ['foo'], @@ -48,8 +56,6 @@ export const Arrays = { 2: ['baz'] } as const; -export type Arrays = typeof Arrays[keyof typeof Arrays]; - export type ClientOptions = { baseUrl: string; }; \ No newline at end of file diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/enum-names-values-javascript-SCREAMING_SNAKE_CASE/types.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/enum-names-values-javascript-SCREAMING_SNAKE_CASE/types.gen.ts index 61d2d9722..463f75406 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/enum-names-values-javascript-SCREAMING_SNAKE_CASE/types.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/enum-names-values-javascript-SCREAMING_SNAKE_CASE/types.gen.ts @@ -1,25 +1,27 @@ // This file is auto-generated by @hey-api/openapi-ts +export type _110 = '1-10' | '11-20'; + export const _110 = { '1_10': '1-10', '11_20': '11-20' } as const; -export type _110 = typeof _110[keyof typeof _110]; +export type MyFoo = 'myFoo' | 'myBar'; export const MyFoo = { MY_FOO: 'myFoo', MY_BAR: 'myBar' } as const; -export type MyFoo = typeof MyFoo[keyof typeof MyFoo]; +export type MyFoo2 = 'MyFoo' | 'MyBar'; export const MyFoo2 = { MY_FOO: 'MyFoo', MY_BAR: 'MyBar' } as const; -export type MyFoo2 = typeof MyFoo2[keyof typeof MyFoo2]; +export type Foo = 'foo' | 'bar' | '' | true | false; export const Foo = { FOO: 'foo', @@ -29,7 +31,7 @@ export const Foo = { FALSE: false } as const; -export type Foo = typeof Foo[keyof typeof Foo]; +export type Numbers = 100 | 200 | 300 | -100 | -200 | -300; export const Numbers = { 100: 100, @@ -40,7 +42,13 @@ export const Numbers = { '-300': -300 } as const; -export type Numbers = typeof Numbers[keyof typeof Numbers]; +export type Arrays = [ + 'foo' +] | [ + 'bar' +] | [ + 'baz' +]; export const Arrays = { 0: ['foo'], @@ -48,8 +56,6 @@ export const Arrays = { 2: ['baz'] } as const; -export type Arrays = typeof Arrays[keyof typeof Arrays]; - export type ClientOptions = { baseUrl: string; }; \ No newline at end of file diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/enum-names-values-javascript-camelCase/types.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/enum-names-values-javascript-camelCase/types.gen.ts index 366427fff..0956e1850 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/enum-names-values-javascript-camelCase/types.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/enum-names-values-javascript-camelCase/types.gen.ts @@ -1,25 +1,27 @@ // This file is auto-generated by @hey-api/openapi-ts +export type _110 = '1-10' | '11-20'; + export const _110 = { 110: '1-10', 1120: '11-20' } as const; -export type _110 = typeof _110[keyof typeof _110]; +export type MyFoo = 'myFoo' | 'myBar'; export const MyFoo = { myFoo: 'myFoo', myBar: 'myBar' } as const; -export type MyFoo = typeof MyFoo[keyof typeof MyFoo]; +export type MyFoo2 = 'MyFoo' | 'MyBar'; export const MyFoo2 = { myFoo: 'MyFoo', myBar: 'MyBar' } as const; -export type MyFoo2 = typeof MyFoo2[keyof typeof MyFoo2]; +export type Foo = 'foo' | 'bar' | '' | true | false; export const Foo = { foo: 'foo', @@ -29,7 +31,7 @@ export const Foo = { false: false } as const; -export type Foo = typeof Foo[keyof typeof Foo]; +export type Numbers = 100 | 200 | 300 | -100 | -200 | -300; export const Numbers = { 100: 100, @@ -40,7 +42,13 @@ export const Numbers = { '-300': -300 } as const; -export type Numbers = typeof Numbers[keyof typeof Numbers]; +export type Arrays = [ + 'foo' +] | [ + 'bar' +] | [ + 'baz' +]; export const Arrays = { 0: ['foo'], @@ -48,8 +56,6 @@ export const Arrays = { 2: ['baz'] } as const; -export type Arrays = typeof Arrays[keyof typeof Arrays]; - export type ClientOptions = { baseUrl: string; }; \ No newline at end of file diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/enum-names-values-javascript-preserve/types.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/enum-names-values-javascript-preserve/types.gen.ts index 037cd0454..27b9f7e35 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/enum-names-values-javascript-preserve/types.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/enum-names-values-javascript-preserve/types.gen.ts @@ -1,25 +1,27 @@ // This file is auto-generated by @hey-api/openapi-ts +export type _110 = '1-10' | '11-20'; + export const _110 = { '1-10': '1-10', '11-20': '11-20' } as const; -export type _110 = typeof _110[keyof typeof _110]; +export type MyFoo = 'myFoo' | 'myBar'; export const MyFoo = { myFoo: 'myFoo', myBar: 'myBar' } as const; -export type MyFoo = typeof MyFoo[keyof typeof MyFoo]; +export type MyFoo2 = 'MyFoo' | 'MyBar'; export const MyFoo2 = { MyFoo: 'MyFoo', MyBar: 'MyBar' } as const; -export type MyFoo2 = typeof MyFoo2[keyof typeof MyFoo2]; +export type Foo = 'foo' | 'bar' | '' | true | false; export const Foo = { foo: 'foo', @@ -29,7 +31,7 @@ export const Foo = { false: false } as const; -export type Foo = typeof Foo[keyof typeof Foo]; +export type Numbers = 100 | 200 | 300 | -100 | -200 | -300; export const Numbers = { 100: 100, @@ -40,7 +42,13 @@ export const Numbers = { '-300': -300 } as const; -export type Numbers = typeof Numbers[keyof typeof Numbers]; +export type Arrays = [ + 'foo' +] | [ + 'bar' +] | [ + 'baz' +]; export const Arrays = { 0: ['foo'], @@ -48,8 +56,6 @@ export const Arrays = { 2: ['baz'] } as const; -export type Arrays = typeof Arrays[keyof typeof Arrays]; - export type ClientOptions = { baseUrl: string; }; \ No newline at end of file diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/enum-names-values-javascript-snake_case/types.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/enum-names-values-javascript-snake_case/types.gen.ts index 45728bae4..f5e7d7aad 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/enum-names-values-javascript-snake_case/types.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/enum-names-values-javascript-snake_case/types.gen.ts @@ -1,25 +1,27 @@ // This file is auto-generated by @hey-api/openapi-ts +export type _110 = '1-10' | '11-20'; + export const _110 = { '1_10': '1-10', '11_20': '11-20' } as const; -export type _110 = typeof _110[keyof typeof _110]; +export type MyFoo = 'myFoo' | 'myBar'; export const MyFoo = { my_foo: 'myFoo', my_bar: 'myBar' } as const; -export type MyFoo = typeof MyFoo[keyof typeof MyFoo]; +export type MyFoo2 = 'MyFoo' | 'MyBar'; export const MyFoo2 = { my_foo: 'MyFoo', my_bar: 'MyBar' } as const; -export type MyFoo2 = typeof MyFoo2[keyof typeof MyFoo2]; +export type Foo = 'foo' | 'bar' | '' | true | false; export const Foo = { foo: 'foo', @@ -29,7 +31,7 @@ export const Foo = { false: false } as const; -export type Foo = typeof Foo[keyof typeof Foo]; +export type Numbers = 100 | 200 | 300 | -100 | -200 | -300; export const Numbers = { 100: 100, @@ -40,7 +42,13 @@ export const Numbers = { '-300': -300 } as const; -export type Numbers = typeof Numbers[keyof typeof Numbers]; +export type Arrays = [ + 'foo' +] | [ + 'bar' +] | [ + 'baz' +]; export const Arrays = { 0: ['foo'], @@ -48,8 +56,6 @@ export const Arrays = { 2: ['baz'] } as const; -export type Arrays = typeof Arrays[keyof typeof Arrays]; - export type ClientOptions = { baseUrl: string; }; \ No newline at end of file diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/form-data/client/client.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/form-data/client/client.ts index 89d1e3158..dddfe80c0 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/form-data/client/client.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/form-data/client/client.ts @@ -143,16 +143,14 @@ export const createClient = (config: Config = {}): Client => { }; } - const textError = await response.text(); - let jsonError: unknown; + let error = await response.text(); try { - jsonError = JSON.parse(textError); + error = JSON.parse(error); } catch { // noop } - const error = jsonError ?? textError; let finalError = error; for (const fn of interceptors.error._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/form-data/core/params.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/form-data/core/params.ts index ba35263d8..7559bbb8c 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/form-data/core/params.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/form-data/core/params.ts @@ -3,21 +3,11 @@ type Slot = 'body' | 'headers' | 'path' | 'query'; export type Field = | { in: Exclude; - /** - * Field name. This is the name we want the user to see and use. - */ key: string; - /** - * Field mapped name. This is the name we want to use in the request. - * If omitted, we use the same value as `key`. - */ map?: string; } | { in: Extract; - /** - * Key isn't required for bodies. - */ key?: string; map?: string; }; diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/form-data/core/types.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/form-data/core/types.ts index 2dd4106fb..77d879253 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/form-data/core/types.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/form-data/core/types.ts @@ -102,17 +102,3 @@ export interface Config { */ responseValidator?: (data: unknown) => Promise; } - -type IsExactlyNeverOrNeverUndefined = [T] extends [never] - ? true - : [T] extends [never | undefined] - ? [undefined] extends [T] - ? false - : true - : false; - -export type OmitNever> = { - [K in keyof T as IsExactlyNeverOrNeverUndefined extends true - ? never - : K]: T[K]; -}; diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/schema-unknown/client/client.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/schema-unknown/client/client.ts index 89d1e3158..dddfe80c0 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/schema-unknown/client/client.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/schema-unknown/client/client.ts @@ -143,16 +143,14 @@ export const createClient = (config: Config = {}): Client => { }; } - const textError = await response.text(); - let jsonError: unknown; + let error = await response.text(); try { - jsonError = JSON.parse(textError); + error = JSON.parse(error); } catch { // noop } - const error = jsonError ?? textError; let finalError = error; for (const fn of interceptors.error._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/schema-unknown/core/params.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/schema-unknown/core/params.ts index ba35263d8..7559bbb8c 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/schema-unknown/core/params.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/schema-unknown/core/params.ts @@ -3,21 +3,11 @@ type Slot = 'body' | 'headers' | 'path' | 'query'; export type Field = | { in: Exclude; - /** - * Field name. This is the name we want the user to see and use. - */ key: string; - /** - * Field mapped name. This is the name we want to use in the request. - * If omitted, we use the same value as `key`. - */ map?: string; } | { in: Extract; - /** - * Key isn't required for bodies. - */ key?: string; map?: string; }; diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/schema-unknown/core/types.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/schema-unknown/core/types.ts index 2dd4106fb..77d879253 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/schema-unknown/core/types.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/schema-unknown/core/types.ts @@ -102,17 +102,3 @@ export interface Config { */ responseValidator?: (data: unknown) => Promise; } - -type IsExactlyNeverOrNeverUndefined = [T] extends [never] - ? true - : [T] extends [never | undefined] - ? [undefined] extends [T] - ? false - : true - : false; - -export type OmitNever> = { - [K in keyof T as IsExactlyNeverOrNeverUndefined extends true - ? never - : K]: T[K]; -}; diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-api-key/client/client.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-api-key/client/client.ts index 89d1e3158..dddfe80c0 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-api-key/client/client.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-api-key/client/client.ts @@ -143,16 +143,14 @@ export const createClient = (config: Config = {}): Client => { }; } - const textError = await response.text(); - let jsonError: unknown; + let error = await response.text(); try { - jsonError = JSON.parse(textError); + error = JSON.parse(error); } catch { // noop } - const error = jsonError ?? textError; let finalError = error; for (const fn of interceptors.error._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-api-key/core/params.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-api-key/core/params.ts index ba35263d8..7559bbb8c 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-api-key/core/params.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-api-key/core/params.ts @@ -3,21 +3,11 @@ type Slot = 'body' | 'headers' | 'path' | 'query'; export type Field = | { in: Exclude; - /** - * Field name. This is the name we want the user to see and use. - */ key: string; - /** - * Field mapped name. This is the name we want to use in the request. - * If omitted, we use the same value as `key`. - */ map?: string; } | { in: Extract; - /** - * Key isn't required for bodies. - */ key?: string; map?: string; }; diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-api-key/core/types.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-api-key/core/types.ts index 2dd4106fb..77d879253 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-api-key/core/types.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-api-key/core/types.ts @@ -102,17 +102,3 @@ export interface Config { */ responseValidator?: (data: unknown) => Promise; } - -type IsExactlyNeverOrNeverUndefined = [T] extends [never] - ? true - : [T] extends [never | undefined] - ? [undefined] extends [T] - ? false - : true - : false; - -export type OmitNever> = { - [K in keyof T as IsExactlyNeverOrNeverUndefined extends true - ? never - : K]: T[K]; -}; diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-basic/client/client.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-basic/client/client.ts index 89d1e3158..dddfe80c0 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-basic/client/client.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-basic/client/client.ts @@ -143,16 +143,14 @@ export const createClient = (config: Config = {}): Client => { }; } - const textError = await response.text(); - let jsonError: unknown; + let error = await response.text(); try { - jsonError = JSON.parse(textError); + error = JSON.parse(error); } catch { // noop } - const error = jsonError ?? textError; let finalError = error; for (const fn of interceptors.error._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-basic/core/params.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-basic/core/params.ts index ba35263d8..7559bbb8c 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-basic/core/params.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-basic/core/params.ts @@ -3,21 +3,11 @@ type Slot = 'body' | 'headers' | 'path' | 'query'; export type Field = | { in: Exclude; - /** - * Field name. This is the name we want the user to see and use. - */ key: string; - /** - * Field mapped name. This is the name we want to use in the request. - * If omitted, we use the same value as `key`. - */ map?: string; } | { in: Extract; - /** - * Key isn't required for bodies. - */ key?: string; map?: string; }; diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-basic/core/types.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-basic/core/types.ts index 2dd4106fb..77d879253 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-basic/core/types.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-basic/core/types.ts @@ -102,17 +102,3 @@ export interface Config { */ responseValidator?: (data: unknown) => Promise; } - -type IsExactlyNeverOrNeverUndefined = [T] extends [never] - ? true - : [T] extends [never | undefined] - ? [undefined] extends [T] - ? false - : true - : false; - -export type OmitNever> = { - [K in keyof T as IsExactlyNeverOrNeverUndefined extends true - ? never - : K]: T[K]; -}; diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-false/client/client.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-false/client/client.ts index 89d1e3158..dddfe80c0 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-false/client/client.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-false/client/client.ts @@ -143,16 +143,14 @@ export const createClient = (config: Config = {}): Client => { }; } - const textError = await response.text(); - let jsonError: unknown; + let error = await response.text(); try { - jsonError = JSON.parse(textError); + error = JSON.parse(error); } catch { // noop } - const error = jsonError ?? textError; let finalError = error; for (const fn of interceptors.error._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-false/core/params.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-false/core/params.ts index ba35263d8..7559bbb8c 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-false/core/params.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-false/core/params.ts @@ -3,21 +3,11 @@ type Slot = 'body' | 'headers' | 'path' | 'query'; export type Field = | { in: Exclude; - /** - * Field name. This is the name we want the user to see and use. - */ key: string; - /** - * Field mapped name. This is the name we want to use in the request. - * If omitted, we use the same value as `key`. - */ map?: string; } | { in: Extract; - /** - * Key isn't required for bodies. - */ key?: string; map?: string; }; diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-false/core/types.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-false/core/types.ts index 2dd4106fb..77d879253 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-false/core/types.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-false/core/types.ts @@ -102,17 +102,3 @@ export interface Config { */ responseValidator?: (data: unknown) => Promise; } - -type IsExactlyNeverOrNeverUndefined = [T] extends [never] - ? true - : [T] extends [never | undefined] - ? [undefined] extends [T] - ? false - : true - : false; - -export type OmitNever> = { - [K in keyof T as IsExactlyNeverOrNeverUndefined extends true - ? never - : K]: T[K]; -}; diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-oauth2/client/client.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-oauth2/client/client.ts index 89d1e3158..dddfe80c0 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-oauth2/client/client.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-oauth2/client/client.ts @@ -143,16 +143,14 @@ export const createClient = (config: Config = {}): Client => { }; } - const textError = await response.text(); - let jsonError: unknown; + let error = await response.text(); try { - jsonError = JSON.parse(textError); + error = JSON.parse(error); } catch { // noop } - const error = jsonError ?? textError; let finalError = error; for (const fn of interceptors.error._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-oauth2/core/params.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-oauth2/core/params.ts index ba35263d8..7559bbb8c 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-oauth2/core/params.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-oauth2/core/params.ts @@ -3,21 +3,11 @@ type Slot = 'body' | 'headers' | 'path' | 'query'; export type Field = | { in: Exclude; - /** - * Field name. This is the name we want the user to see and use. - */ key: string; - /** - * Field mapped name. This is the name we want to use in the request. - * If omitted, we use the same value as `key`. - */ map?: string; } | { in: Extract; - /** - * Key isn't required for bodies. - */ key?: string; map?: string; }; diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-oauth2/core/types.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-oauth2/core/types.ts index 2dd4106fb..77d879253 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-oauth2/core/types.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-oauth2/core/types.ts @@ -102,17 +102,3 @@ export interface Config { */ responseValidator?: (data: unknown) => Promise; } - -type IsExactlyNeverOrNeverUndefined = [T] extends [never] - ? true - : [T] extends [never | undefined] - ? [undefined] extends [T] - ? false - : true - : false; - -export type OmitNever> = { - [K in keyof T as IsExactlyNeverOrNeverUndefined extends true - ? never - : K]: T[K]; -}; diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/servers-base-path/client/client.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/servers-base-path/client/client.ts index 89d1e3158..dddfe80c0 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/servers-base-path/client/client.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/servers-base-path/client/client.ts @@ -143,16 +143,14 @@ export const createClient = (config: Config = {}): Client => { }; } - const textError = await response.text(); - let jsonError: unknown; + let error = await response.text(); try { - jsonError = JSON.parse(textError); + error = JSON.parse(error); } catch { // noop } - const error = jsonError ?? textError; let finalError = error; for (const fn of interceptors.error._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/servers-base-path/core/params.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/servers-base-path/core/params.ts index ba35263d8..7559bbb8c 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/servers-base-path/core/params.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/servers-base-path/core/params.ts @@ -3,21 +3,11 @@ type Slot = 'body' | 'headers' | 'path' | 'query'; export type Field = | { in: Exclude; - /** - * Field name. This is the name we want the user to see and use. - */ key: string; - /** - * Field mapped name. This is the name we want to use in the request. - * If omitted, we use the same value as `key`. - */ map?: string; } | { in: Extract; - /** - * Key isn't required for bodies. - */ key?: string; map?: string; }; diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/servers-base-path/core/types.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/servers-base-path/core/types.ts index 2dd4106fb..77d879253 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/servers-base-path/core/types.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/servers-base-path/core/types.ts @@ -102,17 +102,3 @@ export interface Config { */ responseValidator?: (data: unknown) => Promise; } - -type IsExactlyNeverOrNeverUndefined = [T] extends [never] - ? true - : [T] extends [never | undefined] - ? [undefined] extends [T] - ? false - : true - : false; - -export type OmitNever> = { - [K in keyof T as IsExactlyNeverOrNeverUndefined extends true - ? never - : K]: T[K]; -}; diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/servers-host/client/client.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/servers-host/client/client.ts index 89d1e3158..dddfe80c0 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/servers-host/client/client.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/servers-host/client/client.ts @@ -143,16 +143,14 @@ export const createClient = (config: Config = {}): Client => { }; } - const textError = await response.text(); - let jsonError: unknown; + let error = await response.text(); try { - jsonError = JSON.parse(textError); + error = JSON.parse(error); } catch { // noop } - const error = jsonError ?? textError; let finalError = error; for (const fn of interceptors.error._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/servers-host/core/params.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/servers-host/core/params.ts index ba35263d8..7559bbb8c 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/servers-host/core/params.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/servers-host/core/params.ts @@ -3,21 +3,11 @@ type Slot = 'body' | 'headers' | 'path' | 'query'; export type Field = | { in: Exclude; - /** - * Field name. This is the name we want the user to see and use. - */ key: string; - /** - * Field mapped name. This is the name we want to use in the request. - * If omitted, we use the same value as `key`. - */ map?: string; } | { in: Extract; - /** - * Key isn't required for bodies. - */ key?: string; map?: string; }; diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/servers-host/core/types.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/servers-host/core/types.ts index 2dd4106fb..77d879253 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/servers-host/core/types.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/servers-host/core/types.ts @@ -102,17 +102,3 @@ export interface Config { */ responseValidator?: (data: unknown) => Promise; } - -type IsExactlyNeverOrNeverUndefined = [T] extends [never] - ? true - : [T] extends [never | undefined] - ? [undefined] extends [T] - ? false - : true - : false; - -export type OmitNever> = { - [K in keyof T as IsExactlyNeverOrNeverUndefined extends true - ? never - : K]: T[K]; -}; diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/servers/client/client.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/servers/client/client.ts index 89d1e3158..dddfe80c0 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/servers/client/client.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/servers/client/client.ts @@ -143,16 +143,14 @@ export const createClient = (config: Config = {}): Client => { }; } - const textError = await response.text(); - let jsonError: unknown; + let error = await response.text(); try { - jsonError = JSON.parse(textError); + error = JSON.parse(error); } catch { // noop } - const error = jsonError ?? textError; let finalError = error; for (const fn of interceptors.error._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/servers/core/params.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/servers/core/params.ts index ba35263d8..7559bbb8c 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/servers/core/params.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/servers/core/params.ts @@ -3,21 +3,11 @@ type Slot = 'body' | 'headers' | 'path' | 'query'; export type Field = | { in: Exclude; - /** - * Field name. This is the name we want the user to see and use. - */ key: string; - /** - * Field mapped name. This is the name we want to use in the request. - * If omitted, we use the same value as `key`. - */ map?: string; } | { in: Extract; - /** - * Key isn't required for bodies. - */ key?: string; map?: string; }; diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/servers/core/types.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/servers/core/types.ts index 2dd4106fb..77d879253 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/servers/core/types.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/servers/core/types.ts @@ -102,17 +102,3 @@ export interface Config { */ responseValidator?: (data: unknown) => Promise; } - -type IsExactlyNeverOrNeverUndefined = [T] extends [never] - ? true - : [T] extends [never | undefined] - ? [undefined] extends [T] - ? false - : true - : false; - -export type OmitNever> = { - [K in keyof T as IsExactlyNeverOrNeverUndefined extends true - ? never - : K]: T[K]; -}; diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/transforms-read-write/client/client.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/transforms-read-write/client/client.ts index 89d1e3158..dddfe80c0 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/transforms-read-write/client/client.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/transforms-read-write/client/client.ts @@ -143,16 +143,14 @@ export const createClient = (config: Config = {}): Client => { }; } - const textError = await response.text(); - let jsonError: unknown; + let error = await response.text(); try { - jsonError = JSON.parse(textError); + error = JSON.parse(error); } catch { // noop } - const error = jsonError ?? textError; let finalError = error; for (const fn of interceptors.error._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/transforms-read-write/core/params.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/transforms-read-write/core/params.ts index ba35263d8..7559bbb8c 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/transforms-read-write/core/params.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/transforms-read-write/core/params.ts @@ -3,21 +3,11 @@ type Slot = 'body' | 'headers' | 'path' | 'query'; export type Field = | { in: Exclude; - /** - * Field name. This is the name we want the user to see and use. - */ key: string; - /** - * Field mapped name. This is the name we want to use in the request. - * If omitted, we use the same value as `key`. - */ map?: string; } | { in: Extract; - /** - * Key isn't required for bodies. - */ key?: string; map?: string; }; diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/transforms-read-write/core/types.ts b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/transforms-read-write/core/types.ts index 2dd4106fb..77d879253 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/transforms-read-write/core/types.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/transforms-read-write/core/types.ts @@ -102,17 +102,3 @@ export interface Config { */ responseValidator?: (data: unknown) => Promise; } - -type IsExactlyNeverOrNeverUndefined = [T] extends [never] - ? true - : [T] extends [never | undefined] - ? [undefined] extends [T] - ? false - : true - : false; - -export type OmitNever> = { - [K in keyof T as IsExactlyNeverOrNeverUndefined extends true - ? never - : K]: T[K]; -}; diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/body-response-text-plain/client/client.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/body-response-text-plain/client/client.ts index 89d1e3158..dddfe80c0 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/body-response-text-plain/client/client.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/body-response-text-plain/client/client.ts @@ -143,16 +143,14 @@ export const createClient = (config: Config = {}): Client => { }; } - const textError = await response.text(); - let jsonError: unknown; + let error = await response.text(); try { - jsonError = JSON.parse(textError); + error = JSON.parse(error); } catch { // noop } - const error = jsonError ?? textError; let finalError = error; for (const fn of interceptors.error._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/body-response-text-plain/core/params.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/body-response-text-plain/core/params.ts index ba35263d8..7559bbb8c 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/body-response-text-plain/core/params.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/body-response-text-plain/core/params.ts @@ -3,21 +3,11 @@ type Slot = 'body' | 'headers' | 'path' | 'query'; export type Field = | { in: Exclude; - /** - * Field name. This is the name we want the user to see and use. - */ key: string; - /** - * Field mapped name. This is the name we want to use in the request. - * If omitted, we use the same value as `key`. - */ map?: string; } | { in: Extract; - /** - * Key isn't required for bodies. - */ key?: string; map?: string; }; diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/body-response-text-plain/core/types.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/body-response-text-plain/core/types.ts index 2dd4106fb..77d879253 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/body-response-text-plain/core/types.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/body-response-text-plain/core/types.ts @@ -102,17 +102,3 @@ export interface Config { */ responseValidator?: (data: unknown) => Promise; } - -type IsExactlyNeverOrNeverUndefined = [T] extends [never] - ? true - : [T] extends [never | undefined] - ? [undefined] extends [T] - ? false - : true - : false; - -export type OmitNever> = { - [K in keyof T as IsExactlyNeverOrNeverUndefined extends true - ? never - : K]: T[K]; -}; diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/case-preserve/types.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/case-preserve/types.gen.ts index 753233ba0..1e15cfa88 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/case-preserve/types.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/case-preserve/types.gen.ts @@ -51,7 +51,7 @@ export type fooBar = number; */ export type FooBar = string; -export type getFooData = { +export type GetFooData = { body: Foo; path?: never; query: { @@ -71,7 +71,7 @@ export type getFooData = { url: '/foo'; }; -export type getFooResponses = { +export type GetFooResponses = { /** * OK */ @@ -82,7 +82,7 @@ export type getFooResponses = { 201: _201; }; -export type getFooResponse = getFooResponses[keyof getFooResponses]; +export type GetFooResponse = GetFooResponses[keyof GetFooResponses]; export type ClientOptions = { baseUrl: `${string}://${string}` | (string & {}); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/content-types/client/client.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/content-types/client/client.ts index 307a986cf..41b7494eb 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/content-types/client/client.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/content-types/client/client.ts @@ -1,4 +1,4 @@ -import type { AxiosError, AxiosInstance, RawAxiosRequestHeaders } from 'axios'; +import type { AxiosError, RawAxiosRequestHeaders } from 'axios'; import axios from 'axios'; import type { Client, Config } from './types'; @@ -13,15 +13,9 @@ import { export const createClient = (config: Config = {}): Client => { let _config = mergeConfigs(createConfig(), config); - let instance: AxiosInstance; - - if (_config.axios && !('Axios' in _config.axios)) { - instance = _config.axios; - } else { - // eslint-disable-next-line @typescript-eslint/no-unused-vars - const { auth, ...configWithoutAuth } = _config; - instance = axios.create(configWithoutAuth); - } + // eslint-disable-next-line @typescript-eslint/no-unused-vars + const { auth, ...configWithoutAuth } = _config; + const instance = axios.create(configWithoutAuth); const getConfig = (): Config => ({ ..._config }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/content-types/client/types.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/content-types/client/types.ts index ffcf05181..fb9d690f3 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/content-types/client/types.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/content-types/client/types.ts @@ -1,7 +1,6 @@ import type { AxiosError, AxiosInstance, - AxiosRequestHeaders, AxiosResponse, AxiosStatic, CreateAxiosDefaults, @@ -17,12 +16,12 @@ export interface Config extends Omit, CoreConfig { /** - * Axios implementation. You can use this option to provide either an - * `AxiosStatic` or an `AxiosInstance`. + * Axios implementation. You can use this option to provide a custom + * Axios instance. * * @default axios */ - axios?: AxiosStatic | AxiosInstance; + axios?: AxiosStatic; /** * Base URL for all requests made by this client. */ @@ -34,7 +33,7 @@ export interface Config * {@link https://developer.mozilla.org/docs/Web/API/Headers/Headers#init See more} */ headers?: - | AxiosRequestHeaders + | CreateAxiosDefaults['headers'] | Record< string, | string diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/content-types/core/params.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/content-types/core/params.ts index ba35263d8..7559bbb8c 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/content-types/core/params.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/content-types/core/params.ts @@ -3,21 +3,11 @@ type Slot = 'body' | 'headers' | 'path' | 'query'; export type Field = | { in: Exclude; - /** - * Field name. This is the name we want the user to see and use. - */ key: string; - /** - * Field mapped name. This is the name we want to use in the request. - * If omitted, we use the same value as `key`. - */ map?: string; } | { in: Extract; - /** - * Key isn't required for bodies. - */ key?: string; map?: string; }; diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/content-types/core/types.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/content-types/core/types.ts index 2dd4106fb..77d879253 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/content-types/core/types.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/content-types/core/types.ts @@ -102,17 +102,3 @@ export interface Config { */ responseValidator?: (data: unknown) => Promise; } - -type IsExactlyNeverOrNeverUndefined = [T] extends [never] - ? true - : [T] extends [never | undefined] - ? [undefined] extends [T] - ? false - : true - : false; - -export type OmitNever> = { - [K in keyof T as IsExactlyNeverOrNeverUndefined extends true - ? never - : K]: T[K]; -}; diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/enum-inline-javascript/types.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/enum-inline-javascript/types.gen.ts index 42a789069..0e4b7a25e 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/enum-inline-javascript/types.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/enum-inline-javascript/types.gen.ts @@ -4,13 +4,13 @@ export type Foo = { type?: TypeEnum; }; +export type TypeEnum = 'foo' | 'bar'; + export const TypeEnum = { FOO: 'foo', BAR: 'bar' } as const; -export type TypeEnum = typeof TypeEnum[keyof typeof TypeEnum]; - export type ClientOptions = { baseUrl: `${string}://${string}` | (string & {}); }; \ No newline at end of file diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/enum-names-values-javascript-PascalCase/types.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/enum-names-values-javascript-PascalCase/types.gen.ts index c52d5cecb..4da2d3a89 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/enum-names-values-javascript-PascalCase/types.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/enum-names-values-javascript-PascalCase/types.gen.ts @@ -1,25 +1,27 @@ // This file is auto-generated by @hey-api/openapi-ts +export type _110 = '1-10' | '11-20'; + export const _110 = { 110: '1-10', 1120: '11-20' } as const; -export type _110 = typeof _110[keyof typeof _110]; +export type MyFoo = 'myFoo' | 'myBar'; export const MyFoo = { MyFoo: 'myFoo', MyBar: 'myBar' } as const; -export type MyFoo = typeof MyFoo[keyof typeof MyFoo]; +export type MyFoo2 = 'MyFoo' | 'MyBar'; export const MyFoo2 = { MyFoo: 'MyFoo', MyBar: 'MyBar' } as const; -export type MyFoo2 = typeof MyFoo2[keyof typeof MyFoo2]; +export type Foo = 'foo' | 'bar' | null | '' | true | false; export const Foo = { Foo: 'foo', @@ -30,7 +32,7 @@ export const Foo = { False: false } as const; -export type Foo = typeof Foo[keyof typeof Foo]; +export type Numbers = 100 | 200 | 300 | -100 | -200 | -300; export const Numbers = { 100: 100, @@ -41,7 +43,13 @@ export const Numbers = { '-300': -300 } as const; -export type Numbers = typeof Numbers[keyof typeof Numbers]; +export type Arrays = [ + 'foo' +] | [ + 'bar' +] | [ + 'baz' +]; export const Arrays = { 0: ['foo'], @@ -49,8 +57,6 @@ export const Arrays = { 2: ['baz'] } as const; -export type Arrays = typeof Arrays[keyof typeof Arrays]; - export type ClientOptions = { baseUrl: `${string}://${string}` | (string & {}); }; \ No newline at end of file diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/enum-names-values-javascript-SCREAMING_SNAKE_CASE/types.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/enum-names-values-javascript-SCREAMING_SNAKE_CASE/types.gen.ts index b96d4b64f..26b7572cb 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/enum-names-values-javascript-SCREAMING_SNAKE_CASE/types.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/enum-names-values-javascript-SCREAMING_SNAKE_CASE/types.gen.ts @@ -1,25 +1,27 @@ // This file is auto-generated by @hey-api/openapi-ts +export type _110 = '1-10' | '11-20'; + export const _110 = { '1_10': '1-10', '11_20': '11-20' } as const; -export type _110 = typeof _110[keyof typeof _110]; +export type MyFoo = 'myFoo' | 'myBar'; export const MyFoo = { MY_FOO: 'myFoo', MY_BAR: 'myBar' } as const; -export type MyFoo = typeof MyFoo[keyof typeof MyFoo]; +export type MyFoo2 = 'MyFoo' | 'MyBar'; export const MyFoo2 = { MY_FOO: 'MyFoo', MY_BAR: 'MyBar' } as const; -export type MyFoo2 = typeof MyFoo2[keyof typeof MyFoo2]; +export type Foo = 'foo' | 'bar' | null | '' | true | false; export const Foo = { FOO: 'foo', @@ -30,7 +32,7 @@ export const Foo = { FALSE: false } as const; -export type Foo = typeof Foo[keyof typeof Foo]; +export type Numbers = 100 | 200 | 300 | -100 | -200 | -300; export const Numbers = { 100: 100, @@ -41,7 +43,13 @@ export const Numbers = { '-300': -300 } as const; -export type Numbers = typeof Numbers[keyof typeof Numbers]; +export type Arrays = [ + 'foo' +] | [ + 'bar' +] | [ + 'baz' +]; export const Arrays = { 0: ['foo'], @@ -49,8 +57,6 @@ export const Arrays = { 2: ['baz'] } as const; -export type Arrays = typeof Arrays[keyof typeof Arrays]; - export type ClientOptions = { baseUrl: `${string}://${string}` | (string & {}); }; \ No newline at end of file diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/enum-names-values-javascript-camelCase/types.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/enum-names-values-javascript-camelCase/types.gen.ts index 0e0bc9ed5..df514c438 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/enum-names-values-javascript-camelCase/types.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/enum-names-values-javascript-camelCase/types.gen.ts @@ -1,25 +1,27 @@ // This file is auto-generated by @hey-api/openapi-ts +export type _110 = '1-10' | '11-20'; + export const _110 = { 110: '1-10', 1120: '11-20' } as const; -export type _110 = typeof _110[keyof typeof _110]; +export type MyFoo = 'myFoo' | 'myBar'; export const MyFoo = { myFoo: 'myFoo', myBar: 'myBar' } as const; -export type MyFoo = typeof MyFoo[keyof typeof MyFoo]; +export type MyFoo2 = 'MyFoo' | 'MyBar'; export const MyFoo2 = { myFoo: 'MyFoo', myBar: 'MyBar' } as const; -export type MyFoo2 = typeof MyFoo2[keyof typeof MyFoo2]; +export type Foo = 'foo' | 'bar' | null | '' | true | false; export const Foo = { foo: 'foo', @@ -30,7 +32,7 @@ export const Foo = { false: false } as const; -export type Foo = typeof Foo[keyof typeof Foo]; +export type Numbers = 100 | 200 | 300 | -100 | -200 | -300; export const Numbers = { 100: 100, @@ -41,7 +43,13 @@ export const Numbers = { '-300': -300 } as const; -export type Numbers = typeof Numbers[keyof typeof Numbers]; +export type Arrays = [ + 'foo' +] | [ + 'bar' +] | [ + 'baz' +]; export const Arrays = { 0: ['foo'], @@ -49,8 +57,6 @@ export const Arrays = { 2: ['baz'] } as const; -export type Arrays = typeof Arrays[keyof typeof Arrays]; - export type ClientOptions = { baseUrl: `${string}://${string}` | (string & {}); }; \ No newline at end of file diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/enum-names-values-javascript-ignore-null/types.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/enum-names-values-javascript-ignore-null/types.gen.ts index 7d1be6ca4..2d43a892a 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/enum-names-values-javascript-ignore-null/types.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/enum-names-values-javascript-ignore-null/types.gen.ts @@ -1,25 +1,27 @@ // This file is auto-generated by @hey-api/openapi-ts +export type _110 = '1-10' | '11-20'; + export const _110 = { '1-10': '1-10', '11-20': '11-20' } as const; -export type _110 = typeof _110[keyof typeof _110]; +export type MyFoo = 'myFoo' | 'myBar'; export const MyFoo = { myFoo: 'myFoo', myBar: 'myBar' } as const; -export type MyFoo = typeof MyFoo[keyof typeof MyFoo]; +export type MyFoo2 = 'MyFoo' | 'MyBar'; export const MyFoo2 = { MyFoo: 'MyFoo', MyBar: 'MyBar' } as const; -export type MyFoo2 = typeof MyFoo2[keyof typeof MyFoo2]; +export type Foo = 'foo' | 'bar' | null | '' | true | false; export const Foo = { foo: 'foo', @@ -29,7 +31,7 @@ export const Foo = { false: false } as const; -export type Foo = typeof Foo[keyof typeof Foo]; +export type Numbers = 100 | 200 | 300 | -100 | -200 | -300; export const Numbers = { 100: 100, @@ -40,7 +42,13 @@ export const Numbers = { '-300': -300 } as const; -export type Numbers = typeof Numbers[keyof typeof Numbers]; +export type Arrays = [ + 'foo' +] | [ + 'bar' +] | [ + 'baz' +]; export const Arrays = { 0: ['foo'], @@ -48,8 +56,6 @@ export const Arrays = { 2: ['baz'] } as const; -export type Arrays = typeof Arrays[keyof typeof Arrays]; - export type ClientOptions = { baseUrl: `${string}://${string}` | (string & {}); }; \ No newline at end of file diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/enum-names-values-javascript-preserve/types.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/enum-names-values-javascript-preserve/types.gen.ts index 3725400a8..23671cae3 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/enum-names-values-javascript-preserve/types.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/enum-names-values-javascript-preserve/types.gen.ts @@ -1,25 +1,27 @@ // This file is auto-generated by @hey-api/openapi-ts +export type _110 = '1-10' | '11-20'; + export const _110 = { '1-10': '1-10', '11-20': '11-20' } as const; -export type _110 = typeof _110[keyof typeof _110]; +export type MyFoo = 'myFoo' | 'myBar'; export const MyFoo = { myFoo: 'myFoo', myBar: 'myBar' } as const; -export type MyFoo = typeof MyFoo[keyof typeof MyFoo]; +export type MyFoo2 = 'MyFoo' | 'MyBar'; export const MyFoo2 = { MyFoo: 'MyFoo', MyBar: 'MyBar' } as const; -export type MyFoo2 = typeof MyFoo2[keyof typeof MyFoo2]; +export type Foo = 'foo' | 'bar' | null | '' | true | false; export const Foo = { foo: 'foo', @@ -30,7 +32,7 @@ export const Foo = { false: false } as const; -export type Foo = typeof Foo[keyof typeof Foo]; +export type Numbers = 100 | 200 | 300 | -100 | -200 | -300; export const Numbers = { 100: 100, @@ -41,7 +43,13 @@ export const Numbers = { '-300': -300 } as const; -export type Numbers = typeof Numbers[keyof typeof Numbers]; +export type Arrays = [ + 'foo' +] | [ + 'bar' +] | [ + 'baz' +]; export const Arrays = { 0: ['foo'], @@ -49,8 +57,6 @@ export const Arrays = { 2: ['baz'] } as const; -export type Arrays = typeof Arrays[keyof typeof Arrays]; - export type ClientOptions = { baseUrl: `${string}://${string}` | (string & {}); }; \ No newline at end of file diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/enum-names-values-javascript-snake_case/types.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/enum-names-values-javascript-snake_case/types.gen.ts index bca6fc1c1..3b66201d7 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/enum-names-values-javascript-snake_case/types.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/enum-names-values-javascript-snake_case/types.gen.ts @@ -1,25 +1,27 @@ // This file is auto-generated by @hey-api/openapi-ts +export type _110 = '1-10' | '11-20'; + export const _110 = { '1_10': '1-10', '11_20': '11-20' } as const; -export type _110 = typeof _110[keyof typeof _110]; +export type MyFoo = 'myFoo' | 'myBar'; export const MyFoo = { my_foo: 'myFoo', my_bar: 'myBar' } as const; -export type MyFoo = typeof MyFoo[keyof typeof MyFoo]; +export type MyFoo2 = 'MyFoo' | 'MyBar'; export const MyFoo2 = { my_foo: 'MyFoo', my_bar: 'MyBar' } as const; -export type MyFoo2 = typeof MyFoo2[keyof typeof MyFoo2]; +export type Foo = 'foo' | 'bar' | null | '' | true | false; export const Foo = { foo: 'foo', @@ -30,7 +32,7 @@ export const Foo = { false: false } as const; -export type Foo = typeof Foo[keyof typeof Foo]; +export type Numbers = 100 | 200 | 300 | -100 | -200 | -300; export const Numbers = { 100: 100, @@ -41,7 +43,13 @@ export const Numbers = { '-300': -300 } as const; -export type Numbers = typeof Numbers[keyof typeof Numbers]; +export type Arrays = [ + 'foo' +] | [ + 'bar' +] | [ + 'baz' +]; export const Arrays = { 0: ['foo'], @@ -49,8 +57,6 @@ export const Arrays = { 2: ['baz'] } as const; -export type Arrays = typeof Arrays[keyof typeof Arrays]; - export type ClientOptions = { baseUrl: `${string}://${string}` | (string & {}); }; \ No newline at end of file diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/internal-name-conflict/@tanstack/react-query.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/internal-name-conflict/@tanstack/react-query.gen.ts index a084ac71c..475b08ba9 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/internal-name-conflict/@tanstack/react-query.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/internal-name-conflict/@tanstack/react-query.gen.ts @@ -15,7 +15,7 @@ export type QueryKey = [ const createQueryKey = (id: string, options?: TOptions, infinite?: boolean): [ QueryKey[0] ] => { - const params: QueryKey[0] = { _id: id, baseUrl: options?.baseUrl || (options?.client ?? _heyApiClient).getConfig().baseUrl } as QueryKey[0]; + const params: QueryKey[0] = { _id: id, baseUrl: (options?.client ?? _heyApiClient).getConfig().baseUrl } as QueryKey[0]; if (infinite) { params._infinite = infinite; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/internal-name-conflict/client/client.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/internal-name-conflict/client/client.ts index 89d1e3158..dddfe80c0 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/internal-name-conflict/client/client.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/internal-name-conflict/client/client.ts @@ -143,16 +143,14 @@ export const createClient = (config: Config = {}): Client => { }; } - const textError = await response.text(); - let jsonError: unknown; + let error = await response.text(); try { - jsonError = JSON.parse(textError); + error = JSON.parse(error); } catch { // noop } - const error = jsonError ?? textError; let finalError = error; for (const fn of interceptors.error._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/internal-name-conflict/core/params.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/internal-name-conflict/core/params.ts index ba35263d8..7559bbb8c 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/internal-name-conflict/core/params.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/internal-name-conflict/core/params.ts @@ -3,21 +3,11 @@ type Slot = 'body' | 'headers' | 'path' | 'query'; export type Field = | { in: Exclude; - /** - * Field name. This is the name we want the user to see and use. - */ key: string; - /** - * Field mapped name. This is the name we want to use in the request. - * If omitted, we use the same value as `key`. - */ map?: string; } | { in: Extract; - /** - * Key isn't required for bodies. - */ key?: string; map?: string; }; diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/internal-name-conflict/core/types.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/internal-name-conflict/core/types.ts index 2dd4106fb..77d879253 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/internal-name-conflict/core/types.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/internal-name-conflict/core/types.ts @@ -102,17 +102,3 @@ export interface Config { */ responseValidator?: (data: unknown) => Promise; } - -type IsExactlyNeverOrNeverUndefined = [T] extends [never] - ? true - : [T] extends [never | undefined] - ? [undefined] extends [T] - ? false - : true - : false; - -export type OmitNever> = { - [K in keyof T as IsExactlyNeverOrNeverUndefined extends true - ? never - : K]: T[K]; -}; diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/parameter-explode-false-axios/client/client.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/parameter-explode-false-axios/client/client.ts index 307a986cf..41b7494eb 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/parameter-explode-false-axios/client/client.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/parameter-explode-false-axios/client/client.ts @@ -1,4 +1,4 @@ -import type { AxiosError, AxiosInstance, RawAxiosRequestHeaders } from 'axios'; +import type { AxiosError, RawAxiosRequestHeaders } from 'axios'; import axios from 'axios'; import type { Client, Config } from './types'; @@ -13,15 +13,9 @@ import { export const createClient = (config: Config = {}): Client => { let _config = mergeConfigs(createConfig(), config); - let instance: AxiosInstance; - - if (_config.axios && !('Axios' in _config.axios)) { - instance = _config.axios; - } else { - // eslint-disable-next-line @typescript-eslint/no-unused-vars - const { auth, ...configWithoutAuth } = _config; - instance = axios.create(configWithoutAuth); - } + // eslint-disable-next-line @typescript-eslint/no-unused-vars + const { auth, ...configWithoutAuth } = _config; + const instance = axios.create(configWithoutAuth); const getConfig = (): Config => ({ ..._config }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/parameter-explode-false-axios/client/types.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/parameter-explode-false-axios/client/types.ts index ffcf05181..fb9d690f3 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/parameter-explode-false-axios/client/types.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/parameter-explode-false-axios/client/types.ts @@ -1,7 +1,6 @@ import type { AxiosError, AxiosInstance, - AxiosRequestHeaders, AxiosResponse, AxiosStatic, CreateAxiosDefaults, @@ -17,12 +16,12 @@ export interface Config extends Omit, CoreConfig { /** - * Axios implementation. You can use this option to provide either an - * `AxiosStatic` or an `AxiosInstance`. + * Axios implementation. You can use this option to provide a custom + * Axios instance. * * @default axios */ - axios?: AxiosStatic | AxiosInstance; + axios?: AxiosStatic; /** * Base URL for all requests made by this client. */ @@ -34,7 +33,7 @@ export interface Config * {@link https://developer.mozilla.org/docs/Web/API/Headers/Headers#init See more} */ headers?: - | AxiosRequestHeaders + | CreateAxiosDefaults['headers'] | Record< string, | string diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/parameter-explode-false-axios/core/params.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/parameter-explode-false-axios/core/params.ts index ba35263d8..7559bbb8c 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/parameter-explode-false-axios/core/params.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/parameter-explode-false-axios/core/params.ts @@ -3,21 +3,11 @@ type Slot = 'body' | 'headers' | 'path' | 'query'; export type Field = | { in: Exclude; - /** - * Field name. This is the name we want the user to see and use. - */ key: string; - /** - * Field mapped name. This is the name we want to use in the request. - * If omitted, we use the same value as `key`. - */ map?: string; } | { in: Extract; - /** - * Key isn't required for bodies. - */ key?: string; map?: string; }; diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/parameter-explode-false-axios/core/types.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/parameter-explode-false-axios/core/types.ts index 2dd4106fb..77d879253 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/parameter-explode-false-axios/core/types.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/parameter-explode-false-axios/core/types.ts @@ -102,17 +102,3 @@ export interface Config { */ responseValidator?: (data: unknown) => Promise; } - -type IsExactlyNeverOrNeverUndefined = [T] extends [never] - ? true - : [T] extends [never | undefined] - ? [undefined] extends [T] - ? false - : true - : false; - -export type OmitNever> = { - [K in keyof T as IsExactlyNeverOrNeverUndefined extends true - ? never - : K]: T[K]; -}; diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/parameter-explode-false/client/client.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/parameter-explode-false/client/client.ts index 89d1e3158..dddfe80c0 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/parameter-explode-false/client/client.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/parameter-explode-false/client/client.ts @@ -143,16 +143,14 @@ export const createClient = (config: Config = {}): Client => { }; } - const textError = await response.text(); - let jsonError: unknown; + let error = await response.text(); try { - jsonError = JSON.parse(textError); + error = JSON.parse(error); } catch { // noop } - const error = jsonError ?? textError; let finalError = error; for (const fn of interceptors.error._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/parameter-explode-false/core/params.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/parameter-explode-false/core/params.ts index ba35263d8..7559bbb8c 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/parameter-explode-false/core/params.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/parameter-explode-false/core/params.ts @@ -3,21 +3,11 @@ type Slot = 'body' | 'headers' | 'path' | 'query'; export type Field = | { in: Exclude; - /** - * Field name. This is the name we want the user to see and use. - */ key: string; - /** - * Field mapped name. This is the name we want to use in the request. - * If omitted, we use the same value as `key`. - */ map?: string; } | { in: Extract; - /** - * Key isn't required for bodies. - */ key?: string; map?: string; }; diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/parameter-explode-false/core/types.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/parameter-explode-false/core/types.ts index 2dd4106fb..77d879253 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/parameter-explode-false/core/types.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/parameter-explode-false/core/types.ts @@ -102,17 +102,3 @@ export interface Config { */ responseValidator?: (data: unknown) => Promise; } - -type IsExactlyNeverOrNeverUndefined = [T] extends [never] - ? true - : [T] extends [never | undefined] - ? [undefined] extends [T] - ? false - : true - : false; - -export type OmitNever> = { - [K in keyof T as IsExactlyNeverOrNeverUndefined extends true - ? never - : K]: T[K]; -}; diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-api-key/client/client.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-api-key/client/client.ts index 89d1e3158..dddfe80c0 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-api-key/client/client.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-api-key/client/client.ts @@ -143,16 +143,14 @@ export const createClient = (config: Config = {}): Client => { }; } - const textError = await response.text(); - let jsonError: unknown; + let error = await response.text(); try { - jsonError = JSON.parse(textError); + error = JSON.parse(error); } catch { // noop } - const error = jsonError ?? textError; let finalError = error; for (const fn of interceptors.error._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-api-key/core/params.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-api-key/core/params.ts index ba35263d8..7559bbb8c 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-api-key/core/params.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-api-key/core/params.ts @@ -3,21 +3,11 @@ type Slot = 'body' | 'headers' | 'path' | 'query'; export type Field = | { in: Exclude; - /** - * Field name. This is the name we want the user to see and use. - */ key: string; - /** - * Field mapped name. This is the name we want to use in the request. - * If omitted, we use the same value as `key`. - */ map?: string; } | { in: Extract; - /** - * Key isn't required for bodies. - */ key?: string; map?: string; }; diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-api-key/core/types.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-api-key/core/types.ts index 2dd4106fb..77d879253 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-api-key/core/types.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-api-key/core/types.ts @@ -102,17 +102,3 @@ export interface Config { */ responseValidator?: (data: unknown) => Promise; } - -type IsExactlyNeverOrNeverUndefined = [T] extends [never] - ? true - : [T] extends [never | undefined] - ? [undefined] extends [T] - ? false - : true - : false; - -export type OmitNever> = { - [K in keyof T as IsExactlyNeverOrNeverUndefined extends true - ? never - : K]: T[K]; -}; diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-false/client/client.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-false/client/client.ts index 89d1e3158..dddfe80c0 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-false/client/client.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-false/client/client.ts @@ -143,16 +143,14 @@ export const createClient = (config: Config = {}): Client => { }; } - const textError = await response.text(); - let jsonError: unknown; + let error = await response.text(); try { - jsonError = JSON.parse(textError); + error = JSON.parse(error); } catch { // noop } - const error = jsonError ?? textError; let finalError = error; for (const fn of interceptors.error._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-false/core/params.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-false/core/params.ts index ba35263d8..7559bbb8c 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-false/core/params.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-false/core/params.ts @@ -3,21 +3,11 @@ type Slot = 'body' | 'headers' | 'path' | 'query'; export type Field = | { in: Exclude; - /** - * Field name. This is the name we want the user to see and use. - */ key: string; - /** - * Field mapped name. This is the name we want to use in the request. - * If omitted, we use the same value as `key`. - */ map?: string; } | { in: Extract; - /** - * Key isn't required for bodies. - */ key?: string; map?: string; }; diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-false/core/types.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-false/core/types.ts index 2dd4106fb..77d879253 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-false/core/types.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-false/core/types.ts @@ -102,17 +102,3 @@ export interface Config { */ responseValidator?: (data: unknown) => Promise; } - -type IsExactlyNeverOrNeverUndefined = [T] extends [never] - ? true - : [T] extends [never | undefined] - ? [undefined] extends [T] - ? false - : true - : false; - -export type OmitNever> = { - [K in keyof T as IsExactlyNeverOrNeverUndefined extends true - ? never - : K]: T[K]; -}; diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-http-bearer/client/client.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-http-bearer/client/client.ts index 89d1e3158..dddfe80c0 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-http-bearer/client/client.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-http-bearer/client/client.ts @@ -143,16 +143,14 @@ export const createClient = (config: Config = {}): Client => { }; } - const textError = await response.text(); - let jsonError: unknown; + let error = await response.text(); try { - jsonError = JSON.parse(textError); + error = JSON.parse(error); } catch { // noop } - const error = jsonError ?? textError; let finalError = error; for (const fn of interceptors.error._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-http-bearer/core/params.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-http-bearer/core/params.ts index ba35263d8..7559bbb8c 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-http-bearer/core/params.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-http-bearer/core/params.ts @@ -3,21 +3,11 @@ type Slot = 'body' | 'headers' | 'path' | 'query'; export type Field = | { in: Exclude; - /** - * Field name. This is the name we want the user to see and use. - */ key: string; - /** - * Field mapped name. This is the name we want to use in the request. - * If omitted, we use the same value as `key`. - */ map?: string; } | { in: Extract; - /** - * Key isn't required for bodies. - */ key?: string; map?: string; }; diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-http-bearer/core/types.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-http-bearer/core/types.ts index 2dd4106fb..77d879253 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-http-bearer/core/types.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-http-bearer/core/types.ts @@ -102,17 +102,3 @@ export interface Config { */ responseValidator?: (data: unknown) => Promise; } - -type IsExactlyNeverOrNeverUndefined = [T] extends [never] - ? true - : [T] extends [never | undefined] - ? [undefined] extends [T] - ? false - : true - : false; - -export type OmitNever> = { - [K in keyof T as IsExactlyNeverOrNeverUndefined extends true - ? never - : K]: T[K]; -}; diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-oauth2/client/client.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-oauth2/client/client.ts index 89d1e3158..dddfe80c0 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-oauth2/client/client.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-oauth2/client/client.ts @@ -143,16 +143,14 @@ export const createClient = (config: Config = {}): Client => { }; } - const textError = await response.text(); - let jsonError: unknown; + let error = await response.text(); try { - jsonError = JSON.parse(textError); + error = JSON.parse(error); } catch { // noop } - const error = jsonError ?? textError; let finalError = error; for (const fn of interceptors.error._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-oauth2/core/params.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-oauth2/core/params.ts index ba35263d8..7559bbb8c 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-oauth2/core/params.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-oauth2/core/params.ts @@ -3,21 +3,11 @@ type Slot = 'body' | 'headers' | 'path' | 'query'; export type Field = | { in: Exclude; - /** - * Field name. This is the name we want the user to see and use. - */ key: string; - /** - * Field mapped name. This is the name we want to use in the request. - * If omitted, we use the same value as `key`. - */ map?: string; } | { in: Extract; - /** - * Key isn't required for bodies. - */ key?: string; map?: string; }; diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-oauth2/core/types.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-oauth2/core/types.ts index 2dd4106fb..77d879253 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-oauth2/core/types.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-oauth2/core/types.ts @@ -102,17 +102,3 @@ export interface Config { */ responseValidator?: (data: unknown) => Promise; } - -type IsExactlyNeverOrNeverUndefined = [T] extends [never] - ? true - : [T] extends [never | undefined] - ? [undefined] extends [T] - ? false - : true - : false; - -export type OmitNever> = { - [K in keyof T as IsExactlyNeverOrNeverUndefined extends true - ? never - : K]: T[K]; -}; diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-open-id-connect/client/client.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-open-id-connect/client/client.ts index 89d1e3158..dddfe80c0 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-open-id-connect/client/client.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-open-id-connect/client/client.ts @@ -143,16 +143,14 @@ export const createClient = (config: Config = {}): Client => { }; } - const textError = await response.text(); - let jsonError: unknown; + let error = await response.text(); try { - jsonError = JSON.parse(textError); + error = JSON.parse(error); } catch { // noop } - const error = jsonError ?? textError; let finalError = error; for (const fn of interceptors.error._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-open-id-connect/core/params.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-open-id-connect/core/params.ts index ba35263d8..7559bbb8c 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-open-id-connect/core/params.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-open-id-connect/core/params.ts @@ -3,21 +3,11 @@ type Slot = 'body' | 'headers' | 'path' | 'query'; export type Field = | { in: Exclude; - /** - * Field name. This is the name we want the user to see and use. - */ key: string; - /** - * Field mapped name. This is the name we want to use in the request. - * If omitted, we use the same value as `key`. - */ map?: string; } | { in: Extract; - /** - * Key isn't required for bodies. - */ key?: string; map?: string; }; diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-open-id-connect/core/types.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-open-id-connect/core/types.ts index 2dd4106fb..77d879253 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-open-id-connect/core/types.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-open-id-connect/core/types.ts @@ -102,17 +102,3 @@ export interface Config { */ responseValidator?: (data: unknown) => Promise; } - -type IsExactlyNeverOrNeverUndefined = [T] extends [never] - ? true - : [T] extends [never | undefined] - ? [undefined] extends [T] - ? false - : true - : false; - -export type OmitNever> = { - [K in keyof T as IsExactlyNeverOrNeverUndefined extends true - ? never - : K]: T[K]; -}; diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/servers/client/client.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/servers/client/client.ts index 89d1e3158..dddfe80c0 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/servers/client/client.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/servers/client/client.ts @@ -143,16 +143,14 @@ export const createClient = (config: Config = {}): Client => { }; } - const textError = await response.text(); - let jsonError: unknown; + let error = await response.text(); try { - jsonError = JSON.parse(textError); + error = JSON.parse(error); } catch { // noop } - const error = jsonError ?? textError; let finalError = error; for (const fn of interceptors.error._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/servers/core/params.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/servers/core/params.ts index ba35263d8..7559bbb8c 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/servers/core/params.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/servers/core/params.ts @@ -3,21 +3,11 @@ type Slot = 'body' | 'headers' | 'path' | 'query'; export type Field = | { in: Exclude; - /** - * Field name. This is the name we want the user to see and use. - */ key: string; - /** - * Field mapped name. This is the name we want to use in the request. - * If omitted, we use the same value as `key`. - */ map?: string; } | { in: Extract; - /** - * Key isn't required for bodies. - */ key?: string; map?: string; }; diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/servers/core/types.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/servers/core/types.ts index 2dd4106fb..77d879253 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/servers/core/types.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/servers/core/types.ts @@ -102,17 +102,3 @@ export interface Config { */ responseValidator?: (data: unknown) => Promise; } - -type IsExactlyNeverOrNeverUndefined = [T] extends [never] - ? true - : [T] extends [never | undefined] - ? [undefined] extends [T] - ? false - : true - : false; - -export type OmitNever> = { - [K in keyof T as IsExactlyNeverOrNeverUndefined extends true - ? never - : K]: T[K]; -}; diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transformers-all-of/client/client.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transformers-all-of/client/client.ts index 89d1e3158..dddfe80c0 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transformers-all-of/client/client.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transformers-all-of/client/client.ts @@ -143,16 +143,14 @@ export const createClient = (config: Config = {}): Client => { }; } - const textError = await response.text(); - let jsonError: unknown; + let error = await response.text(); try { - jsonError = JSON.parse(textError); + error = JSON.parse(error); } catch { // noop } - const error = jsonError ?? textError; let finalError = error; for (const fn of interceptors.error._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transformers-all-of/core/params.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transformers-all-of/core/params.ts index ba35263d8..7559bbb8c 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transformers-all-of/core/params.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transformers-all-of/core/params.ts @@ -3,21 +3,11 @@ type Slot = 'body' | 'headers' | 'path' | 'query'; export type Field = | { in: Exclude; - /** - * Field name. This is the name we want the user to see and use. - */ key: string; - /** - * Field mapped name. This is the name we want to use in the request. - * If omitted, we use the same value as `key`. - */ map?: string; } | { in: Extract; - /** - * Key isn't required for bodies. - */ key?: string; map?: string; }; diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transformers-all-of/core/types.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transformers-all-of/core/types.ts index 2dd4106fb..77d879253 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transformers-all-of/core/types.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transformers-all-of/core/types.ts @@ -102,17 +102,3 @@ export interface Config { */ responseValidator?: (data: unknown) => Promise; } - -type IsExactlyNeverOrNeverUndefined = [T] extends [never] - ? true - : [T] extends [never | undefined] - ? [undefined] extends [T] - ? false - : true - : false; - -export type OmitNever> = { - [K in keyof T as IsExactlyNeverOrNeverUndefined extends true - ? never - : K]: T[K]; -}; diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transformers-any-of-null/client/client.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transformers-any-of-null/client/client.ts index 89d1e3158..dddfe80c0 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transformers-any-of-null/client/client.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transformers-any-of-null/client/client.ts @@ -143,16 +143,14 @@ export const createClient = (config: Config = {}): Client => { }; } - const textError = await response.text(); - let jsonError: unknown; + let error = await response.text(); try { - jsonError = JSON.parse(textError); + error = JSON.parse(error); } catch { // noop } - const error = jsonError ?? textError; let finalError = error; for (const fn of interceptors.error._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transformers-any-of-null/core/params.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transformers-any-of-null/core/params.ts index ba35263d8..7559bbb8c 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transformers-any-of-null/core/params.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transformers-any-of-null/core/params.ts @@ -3,21 +3,11 @@ type Slot = 'body' | 'headers' | 'path' | 'query'; export type Field = | { in: Exclude; - /** - * Field name. This is the name we want the user to see and use. - */ key: string; - /** - * Field mapped name. This is the name we want to use in the request. - * If omitted, we use the same value as `key`. - */ map?: string; } | { in: Extract; - /** - * Key isn't required for bodies. - */ key?: string; map?: string; }; diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transformers-any-of-null/core/types.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transformers-any-of-null/core/types.ts index 2dd4106fb..77d879253 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transformers-any-of-null/core/types.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transformers-any-of-null/core/types.ts @@ -102,17 +102,3 @@ export interface Config { */ responseValidator?: (data: unknown) => Promise; } - -type IsExactlyNeverOrNeverUndefined = [T] extends [never] - ? true - : [T] extends [never | undefined] - ? [undefined] extends [T] - ? false - : true - : false; - -export type OmitNever> = { - [K in keyof T as IsExactlyNeverOrNeverUndefined extends true - ? never - : K]: T[K]; -}; diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transformers-array/client/client.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transformers-array/client/client.ts index 89d1e3158..dddfe80c0 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transformers-array/client/client.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transformers-array/client/client.ts @@ -143,16 +143,14 @@ export const createClient = (config: Config = {}): Client => { }; } - const textError = await response.text(); - let jsonError: unknown; + let error = await response.text(); try { - jsonError = JSON.parse(textError); + error = JSON.parse(error); } catch { // noop } - const error = jsonError ?? textError; let finalError = error; for (const fn of interceptors.error._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transformers-array/core/params.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transformers-array/core/params.ts index ba35263d8..7559bbb8c 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transformers-array/core/params.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transformers-array/core/params.ts @@ -3,21 +3,11 @@ type Slot = 'body' | 'headers' | 'path' | 'query'; export type Field = | { in: Exclude; - /** - * Field name. This is the name we want the user to see and use. - */ key: string; - /** - * Field mapped name. This is the name we want to use in the request. - * If omitted, we use the same value as `key`. - */ map?: string; } | { in: Extract; - /** - * Key isn't required for bodies. - */ key?: string; map?: string; }; diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transformers-array/core/types.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transformers-array/core/types.ts index 2dd4106fb..77d879253 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transformers-array/core/types.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transformers-array/core/types.ts @@ -102,17 +102,3 @@ export interface Config { */ responseValidator?: (data: unknown) => Promise; } - -type IsExactlyNeverOrNeverUndefined = [T] extends [never] - ? true - : [T] extends [never | undefined] - ? [undefined] extends [T] - ? false - : true - : false; - -export type OmitNever> = { - [K in keyof T as IsExactlyNeverOrNeverUndefined extends true - ? never - : K]: T[K]; -}; diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transforms-read-write/client/client.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transforms-read-write/client/client.ts index 89d1e3158..dddfe80c0 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transforms-read-write/client/client.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transforms-read-write/client/client.ts @@ -143,16 +143,14 @@ export const createClient = (config: Config = {}): Client => { }; } - const textError = await response.text(); - let jsonError: unknown; + let error = await response.text(); try { - jsonError = JSON.parse(textError); + error = JSON.parse(error); } catch { // noop } - const error = jsonError ?? textError; let finalError = error; for (const fn of interceptors.error._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transforms-read-write/core/params.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transforms-read-write/core/params.ts index ba35263d8..7559bbb8c 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transforms-read-write/core/params.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transforms-read-write/core/params.ts @@ -3,21 +3,11 @@ type Slot = 'body' | 'headers' | 'path' | 'query'; export type Field = | { in: Exclude; - /** - * Field name. This is the name we want the user to see and use. - */ key: string; - /** - * Field mapped name. This is the name we want to use in the request. - * If omitted, we use the same value as `key`. - */ map?: string; } | { in: Extract; - /** - * Key isn't required for bodies. - */ key?: string; map?: string; }; diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transforms-read-write/core/types.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transforms-read-write/core/types.ts index 2dd4106fb..77d879253 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transforms-read-write/core/types.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transforms-read-write/core/types.ts @@ -102,17 +102,3 @@ export interface Config { */ responseValidator?: (data: unknown) => Promise; } - -type IsExactlyNeverOrNeverUndefined = [T] extends [never] - ? true - : [T] extends [never | undefined] - ? [undefined] extends [T] - ? false - : true - : false; - -export type OmitNever> = { - [K in keyof T as IsExactlyNeverOrNeverUndefined extends true - ? never - : K]: T[K]; -}; diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/body-response-text-plain/client/client.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/body-response-text-plain/client/client.ts index 89d1e3158..dddfe80c0 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/body-response-text-plain/client/client.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/body-response-text-plain/client/client.ts @@ -143,16 +143,14 @@ export const createClient = (config: Config = {}): Client => { }; } - const textError = await response.text(); - let jsonError: unknown; + let error = await response.text(); try { - jsonError = JSON.parse(textError); + error = JSON.parse(error); } catch { // noop } - const error = jsonError ?? textError; let finalError = error; for (const fn of interceptors.error._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/body-response-text-plain/core/params.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/body-response-text-plain/core/params.ts index ba35263d8..7559bbb8c 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/body-response-text-plain/core/params.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/body-response-text-plain/core/params.ts @@ -3,21 +3,11 @@ type Slot = 'body' | 'headers' | 'path' | 'query'; export type Field = | { in: Exclude; - /** - * Field name. This is the name we want the user to see and use. - */ key: string; - /** - * Field mapped name. This is the name we want to use in the request. - * If omitted, we use the same value as `key`. - */ map?: string; } | { in: Extract; - /** - * Key isn't required for bodies. - */ key?: string; map?: string; }; diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/body-response-text-plain/core/types.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/body-response-text-plain/core/types.ts index 2dd4106fb..77d879253 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/body-response-text-plain/core/types.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/body-response-text-plain/core/types.ts @@ -102,17 +102,3 @@ export interface Config { */ responseValidator?: (data: unknown) => Promise; } - -type IsExactlyNeverOrNeverUndefined = [T] extends [never] - ? true - : [T] extends [never | undefined] - ? [undefined] extends [T] - ? false - : true - : false; - -export type OmitNever> = { - [K in keyof T as IsExactlyNeverOrNeverUndefined extends true - ? never - : K]: T[K]; -}; diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/case-preserve/types.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/case-preserve/types.gen.ts index 753233ba0..1e15cfa88 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/case-preserve/types.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/case-preserve/types.gen.ts @@ -51,7 +51,7 @@ export type fooBar = number; */ export type FooBar = string; -export type getFooData = { +export type GetFooData = { body: Foo; path?: never; query: { @@ -71,7 +71,7 @@ export type getFooData = { url: '/foo'; }; -export type getFooResponses = { +export type GetFooResponses = { /** * OK */ @@ -82,7 +82,7 @@ export type getFooResponses = { 201: _201; }; -export type getFooResponse = getFooResponses[keyof getFooResponses]; +export type GetFooResponse = GetFooResponses[keyof GetFooResponses]; export type ClientOptions = { baseUrl: `${string}://${string}` | (string & {}); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/content-types/client/client.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/content-types/client/client.ts index 307a986cf..41b7494eb 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/content-types/client/client.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/content-types/client/client.ts @@ -1,4 +1,4 @@ -import type { AxiosError, AxiosInstance, RawAxiosRequestHeaders } from 'axios'; +import type { AxiosError, RawAxiosRequestHeaders } from 'axios'; import axios from 'axios'; import type { Client, Config } from './types'; @@ -13,15 +13,9 @@ import { export const createClient = (config: Config = {}): Client => { let _config = mergeConfigs(createConfig(), config); - let instance: AxiosInstance; - - if (_config.axios && !('Axios' in _config.axios)) { - instance = _config.axios; - } else { - // eslint-disable-next-line @typescript-eslint/no-unused-vars - const { auth, ...configWithoutAuth } = _config; - instance = axios.create(configWithoutAuth); - } + // eslint-disable-next-line @typescript-eslint/no-unused-vars + const { auth, ...configWithoutAuth } = _config; + const instance = axios.create(configWithoutAuth); const getConfig = (): Config => ({ ..._config }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/content-types/client/types.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/content-types/client/types.ts index ffcf05181..fb9d690f3 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/content-types/client/types.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/content-types/client/types.ts @@ -1,7 +1,6 @@ import type { AxiosError, AxiosInstance, - AxiosRequestHeaders, AxiosResponse, AxiosStatic, CreateAxiosDefaults, @@ -17,12 +16,12 @@ export interface Config extends Omit, CoreConfig { /** - * Axios implementation. You can use this option to provide either an - * `AxiosStatic` or an `AxiosInstance`. + * Axios implementation. You can use this option to provide a custom + * Axios instance. * * @default axios */ - axios?: AxiosStatic | AxiosInstance; + axios?: AxiosStatic; /** * Base URL for all requests made by this client. */ @@ -34,7 +33,7 @@ export interface Config * {@link https://developer.mozilla.org/docs/Web/API/Headers/Headers#init See more} */ headers?: - | AxiosRequestHeaders + | CreateAxiosDefaults['headers'] | Record< string, | string diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/content-types/core/params.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/content-types/core/params.ts index ba35263d8..7559bbb8c 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/content-types/core/params.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/content-types/core/params.ts @@ -3,21 +3,11 @@ type Slot = 'body' | 'headers' | 'path' | 'query'; export type Field = | { in: Exclude; - /** - * Field name. This is the name we want the user to see and use. - */ key: string; - /** - * Field mapped name. This is the name we want to use in the request. - * If omitted, we use the same value as `key`. - */ map?: string; } | { in: Extract; - /** - * Key isn't required for bodies. - */ key?: string; map?: string; }; diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/content-types/core/types.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/content-types/core/types.ts index 2dd4106fb..77d879253 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/content-types/core/types.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/content-types/core/types.ts @@ -102,17 +102,3 @@ export interface Config { */ responseValidator?: (data: unknown) => Promise; } - -type IsExactlyNeverOrNeverUndefined = [T] extends [never] - ? true - : [T] extends [never | undefined] - ? [undefined] extends [T] - ? false - : true - : false; - -export type OmitNever> = { - [K in keyof T as IsExactlyNeverOrNeverUndefined extends true - ? never - : K]: T[K]; -}; diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/enum-inline-javascript/types.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/enum-inline-javascript/types.gen.ts index 4094079e5..124e232f3 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/enum-inline-javascript/types.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/enum-inline-javascript/types.gen.ts @@ -8,26 +8,26 @@ export type Bar = { type?: Baz; }; +export type Baz = 'qux' | 'quux'; + export const Baz = { QUX: 'qux', QUUX: 'quux' } as const; -export type Baz = typeof Baz[keyof typeof Baz]; +export type FooEnum = 'foo' | 'bar'; export const FooEnum = { FOO: 'foo', BAR: 'bar' } as const; -export type FooEnum = typeof FooEnum[keyof typeof FooEnum]; +export type FooEnum2 = 'baz'; export const FooEnum2 = { BAZ: 'baz' } as const; -export type FooEnum2 = typeof FooEnum2[keyof typeof FooEnum2]; - export type GetFooData = { body?: never; path?: never; diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/enum-names-values-javascript-PascalCase/types.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/enum-names-values-javascript-PascalCase/types.gen.ts index 4850cfc02..f1b315014 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/enum-names-values-javascript-PascalCase/types.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/enum-names-values-javascript-PascalCase/types.gen.ts @@ -1,25 +1,27 @@ // This file is auto-generated by @hey-api/openapi-ts +export type _110 = '1-10' | '11-20'; + export const _110 = { 110: '1-10', 1120: '11-20' } as const; -export type _110 = typeof _110[keyof typeof _110]; +export type MyFoo = 'myFoo' | 'myBar'; export const MyFoo = { MyFoo: 'myFoo', MyBar: 'myBar' } as const; -export type MyFoo = typeof MyFoo[keyof typeof MyFoo]; +export type MyFoo2 = 'MyFoo' | 'MyBar'; export const MyFoo2 = { MyFoo: 'MyFoo', MyBar: 'MyBar' } as const; -export type MyFoo2 = typeof MyFoo2[keyof typeof MyFoo2]; +export type Foo = 'foo' | 'bar' | null | '' | true | false; export const Foo = { Foo: 'foo', @@ -30,7 +32,7 @@ export const Foo = { False: false } as const; -export type Foo = typeof Foo[keyof typeof Foo]; +export type Numbers = 100 | 200 | 300 | -100 | -200 | -300; export const Numbers = { 100: 100, @@ -41,7 +43,13 @@ export const Numbers = { '-300': -300 } as const; -export type Numbers = typeof Numbers[keyof typeof Numbers]; +export type Arrays = [ + 'foo' +] | [ + 'bar' +] | [ + 'baz' +]; export const Arrays = { 0: ['foo'], @@ -49,8 +57,6 @@ export const Arrays = { 2: ['baz'] } as const; -export type Arrays = typeof Arrays[keyof typeof Arrays]; - export type MyFooRef = { foo?: Array; }; diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/enum-names-values-javascript-SCREAMING_SNAKE_CASE/types.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/enum-names-values-javascript-SCREAMING_SNAKE_CASE/types.gen.ts index 53ffcb61b..30153a31b 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/enum-names-values-javascript-SCREAMING_SNAKE_CASE/types.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/enum-names-values-javascript-SCREAMING_SNAKE_CASE/types.gen.ts @@ -1,25 +1,27 @@ // This file is auto-generated by @hey-api/openapi-ts +export type _110 = '1-10' | '11-20'; + export const _110 = { '1_10': '1-10', '11_20': '11-20' } as const; -export type _110 = typeof _110[keyof typeof _110]; +export type MyFoo = 'myFoo' | 'myBar'; export const MyFoo = { MY_FOO: 'myFoo', MY_BAR: 'myBar' } as const; -export type MyFoo = typeof MyFoo[keyof typeof MyFoo]; +export type MyFoo2 = 'MyFoo' | 'MyBar'; export const MyFoo2 = { MY_FOO: 'MyFoo', MY_BAR: 'MyBar' } as const; -export type MyFoo2 = typeof MyFoo2[keyof typeof MyFoo2]; +export type Foo = 'foo' | 'bar' | null | '' | true | false; export const Foo = { FOO: 'foo', @@ -30,7 +32,7 @@ export const Foo = { FALSE: false } as const; -export type Foo = typeof Foo[keyof typeof Foo]; +export type Numbers = 100 | 200 | 300 | -100 | -200 | -300; export const Numbers = { 100: 100, @@ -41,7 +43,13 @@ export const Numbers = { '-300': -300 } as const; -export type Numbers = typeof Numbers[keyof typeof Numbers]; +export type Arrays = [ + 'foo' +] | [ + 'bar' +] | [ + 'baz' +]; export const Arrays = { 0: ['foo'], @@ -49,8 +57,6 @@ export const Arrays = { 2: ['baz'] } as const; -export type Arrays = typeof Arrays[keyof typeof Arrays]; - export type MyFooRef = { foo?: Array; }; diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/enum-names-values-javascript-camelCase/types.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/enum-names-values-javascript-camelCase/types.gen.ts index 9c29e20eb..f25f69534 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/enum-names-values-javascript-camelCase/types.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/enum-names-values-javascript-camelCase/types.gen.ts @@ -1,25 +1,27 @@ // This file is auto-generated by @hey-api/openapi-ts +export type _110 = '1-10' | '11-20'; + export const _110 = { 110: '1-10', 1120: '11-20' } as const; -export type _110 = typeof _110[keyof typeof _110]; +export type MyFoo = 'myFoo' | 'myBar'; export const MyFoo = { myFoo: 'myFoo', myBar: 'myBar' } as const; -export type MyFoo = typeof MyFoo[keyof typeof MyFoo]; +export type MyFoo2 = 'MyFoo' | 'MyBar'; export const MyFoo2 = { myFoo: 'MyFoo', myBar: 'MyBar' } as const; -export type MyFoo2 = typeof MyFoo2[keyof typeof MyFoo2]; +export type Foo = 'foo' | 'bar' | null | '' | true | false; export const Foo = { foo: 'foo', @@ -30,7 +32,7 @@ export const Foo = { false: false } as const; -export type Foo = typeof Foo[keyof typeof Foo]; +export type Numbers = 100 | 200 | 300 | -100 | -200 | -300; export const Numbers = { 100: 100, @@ -41,7 +43,13 @@ export const Numbers = { '-300': -300 } as const; -export type Numbers = typeof Numbers[keyof typeof Numbers]; +export type Arrays = [ + 'foo' +] | [ + 'bar' +] | [ + 'baz' +]; export const Arrays = { 0: ['foo'], @@ -49,8 +57,6 @@ export const Arrays = { 2: ['baz'] } as const; -export type Arrays = typeof Arrays[keyof typeof Arrays]; - export type MyFooRef = { foo?: Array; }; diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/enum-names-values-javascript-ignore-null/types.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/enum-names-values-javascript-ignore-null/types.gen.ts index a30f37a34..c76baf8b5 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/enum-names-values-javascript-ignore-null/types.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/enum-names-values-javascript-ignore-null/types.gen.ts @@ -1,25 +1,27 @@ // This file is auto-generated by @hey-api/openapi-ts +export type _110 = '1-10' | '11-20'; + export const _110 = { '1-10': '1-10', '11-20': '11-20' } as const; -export type _110 = typeof _110[keyof typeof _110]; +export type MyFoo = 'myFoo' | 'myBar'; export const MyFoo = { myFoo: 'myFoo', myBar: 'myBar' } as const; -export type MyFoo = typeof MyFoo[keyof typeof MyFoo]; +export type MyFoo2 = 'MyFoo' | 'MyBar'; export const MyFoo2 = { MyFoo: 'MyFoo', MyBar: 'MyBar' } as const; -export type MyFoo2 = typeof MyFoo2[keyof typeof MyFoo2]; +export type Foo = 'foo' | 'bar' | null | '' | true | false; export const Foo = { foo: 'foo', @@ -29,7 +31,7 @@ export const Foo = { false: false } as const; -export type Foo = typeof Foo[keyof typeof Foo]; +export type Numbers = 100 | 200 | 300 | -100 | -200 | -300; export const Numbers = { 100: 100, @@ -40,7 +42,13 @@ export const Numbers = { '-300': -300 } as const; -export type Numbers = typeof Numbers[keyof typeof Numbers]; +export type Arrays = [ + 'foo' +] | [ + 'bar' +] | [ + 'baz' +]; export const Arrays = { 0: ['foo'], @@ -48,8 +56,6 @@ export const Arrays = { 2: ['baz'] } as const; -export type Arrays = typeof Arrays[keyof typeof Arrays]; - export type MyFooRef = { foo?: Array; }; diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/enum-names-values-javascript-preserve/types.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/enum-names-values-javascript-preserve/types.gen.ts index 8e7c5b91f..4e971c162 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/enum-names-values-javascript-preserve/types.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/enum-names-values-javascript-preserve/types.gen.ts @@ -1,25 +1,27 @@ // This file is auto-generated by @hey-api/openapi-ts +export type _110 = '1-10' | '11-20'; + export const _110 = { '1-10': '1-10', '11-20': '11-20' } as const; -export type _110 = typeof _110[keyof typeof _110]; +export type MyFoo = 'myFoo' | 'myBar'; export const MyFoo = { myFoo: 'myFoo', myBar: 'myBar' } as const; -export type MyFoo = typeof MyFoo[keyof typeof MyFoo]; +export type MyFoo2 = 'MyFoo' | 'MyBar'; export const MyFoo2 = { MyFoo: 'MyFoo', MyBar: 'MyBar' } as const; -export type MyFoo2 = typeof MyFoo2[keyof typeof MyFoo2]; +export type Foo = 'foo' | 'bar' | null | '' | true | false; export const Foo = { foo: 'foo', @@ -30,7 +32,7 @@ export const Foo = { false: false } as const; -export type Foo = typeof Foo[keyof typeof Foo]; +export type Numbers = 100 | 200 | 300 | -100 | -200 | -300; export const Numbers = { 100: 100, @@ -41,7 +43,13 @@ export const Numbers = { '-300': -300 } as const; -export type Numbers = typeof Numbers[keyof typeof Numbers]; +export type Arrays = [ + 'foo' +] | [ + 'bar' +] | [ + 'baz' +]; export const Arrays = { 0: ['foo'], @@ -49,8 +57,6 @@ export const Arrays = { 2: ['baz'] } as const; -export type Arrays = typeof Arrays[keyof typeof Arrays]; - export type MyFooRef = { foo?: Array; }; diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/enum-names-values-javascript-snake_case/types.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/enum-names-values-javascript-snake_case/types.gen.ts index 8b93038b4..3abc520e2 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/enum-names-values-javascript-snake_case/types.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/enum-names-values-javascript-snake_case/types.gen.ts @@ -1,25 +1,27 @@ // This file is auto-generated by @hey-api/openapi-ts +export type _110 = '1-10' | '11-20'; + export const _110 = { '1_10': '1-10', '11_20': '11-20' } as const; -export type _110 = typeof _110[keyof typeof _110]; +export type MyFoo = 'myFoo' | 'myBar'; export const MyFoo = { my_foo: 'myFoo', my_bar: 'myBar' } as const; -export type MyFoo = typeof MyFoo[keyof typeof MyFoo]; +export type MyFoo2 = 'MyFoo' | 'MyBar'; export const MyFoo2 = { my_foo: 'MyFoo', my_bar: 'MyBar' } as const; -export type MyFoo2 = typeof MyFoo2[keyof typeof MyFoo2]; +export type Foo = 'foo' | 'bar' | null | '' | true | false; export const Foo = { foo: 'foo', @@ -30,7 +32,7 @@ export const Foo = { false: false } as const; -export type Foo = typeof Foo[keyof typeof Foo]; +export type Numbers = 100 | 200 | 300 | -100 | -200 | -300; export const Numbers = { 100: 100, @@ -41,7 +43,13 @@ export const Numbers = { '-300': -300 } as const; -export type Numbers = typeof Numbers[keyof typeof Numbers]; +export type Arrays = [ + 'foo' +] | [ + 'bar' +] | [ + 'baz' +]; export const Arrays = { 0: ['foo'], @@ -49,8 +57,6 @@ export const Arrays = { 2: ['baz'] } as const; -export type Arrays = typeof Arrays[keyof typeof Arrays]; - export type MyFooRef = { foo?: Array; }; diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/headers/client/client.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/headers/client/client.ts index 89d1e3158..dddfe80c0 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/headers/client/client.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/headers/client/client.ts @@ -143,16 +143,14 @@ export const createClient = (config: Config = {}): Client => { }; } - const textError = await response.text(); - let jsonError: unknown; + let error = await response.text(); try { - jsonError = JSON.parse(textError); + error = JSON.parse(error); } catch { // noop } - const error = jsonError ?? textError; let finalError = error; for (const fn of interceptors.error._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/headers/core/params.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/headers/core/params.ts index ba35263d8..7559bbb8c 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/headers/core/params.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/headers/core/params.ts @@ -3,21 +3,11 @@ type Slot = 'body' | 'headers' | 'path' | 'query'; export type Field = | { in: Exclude; - /** - * Field name. This is the name we want the user to see and use. - */ key: string; - /** - * Field mapped name. This is the name we want to use in the request. - * If omitted, we use the same value as `key`. - */ map?: string; } | { in: Extract; - /** - * Key isn't required for bodies. - */ key?: string; map?: string; }; diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/headers/core/types.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/headers/core/types.ts index 2dd4106fb..77d879253 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/headers/core/types.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/headers/core/types.ts @@ -102,17 +102,3 @@ export interface Config { */ responseValidator?: (data: unknown) => Promise; } - -type IsExactlyNeverOrNeverUndefined = [T] extends [never] - ? true - : [T] extends [never | undefined] - ? [undefined] extends [T] - ? false - : true - : false; - -export type OmitNever> = { - [K in keyof T as IsExactlyNeverOrNeverUndefined extends true - ? never - : K]: T[K]; -}; diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/integer-formats/valibot.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/integer-formats/valibot.gen.ts index ac62ef699..7accb7c02 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/integer-formats/valibot.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/integer-formats/valibot.gen.ts @@ -4,47 +4,23 @@ import * as v from 'valibot'; export const vIntegerFormats = v.object({ numberNoFormat: v.optional(v.number()), - numberInt8: v.optional(v.pipe(v.number(), v.minValue(-128, 'Invalid value: Expected int8 to be >= -2^7'), v.maxValue(127, 'Invalid value: Expected int8 to be <= 2^7-1'))), - numberInt16: v.optional(v.pipe(v.number(), v.minValue(-32768, 'Invalid value: Expected int16 to be >= -2^15'), v.maxValue(32767, 'Invalid value: Expected int16 to be <= 2^15-1'))), - numberInt32: v.optional(v.pipe(v.number(), v.minValue(-2147483648, 'Invalid value: Expected int32 to be >= -2^31'), v.maxValue(2147483647, 'Invalid value: Expected int32 to be <= 2^31-1'))), - numberInt64: v.optional(v.pipe(v.union([ - v.number(), - v.string(), - v.bigint() - ]), v.transform(x => BigInt(x)), v.minValue(BigInt('-9223372036854775808'), 'Invalid value: Expected int64 to be >= -2^63'), v.maxValue(BigInt('9223372036854775807'), 'Invalid value: Expected int64 to be <= 2^63-1'))), - numberUint8: v.optional(v.pipe(v.number(), v.minValue(0, 'Invalid value: Expected uint8 to be >= 0'), v.maxValue(255, 'Invalid value: Expected uint8 to be <= 2^8-1'))), - numberUint16: v.optional(v.pipe(v.number(), v.minValue(0, 'Invalid value: Expected uint16 to be >= 0'), v.maxValue(65535, 'Invalid value: Expected uint16 to be <= 2^16-1'))), - numberUint32: v.optional(v.pipe(v.number(), v.minValue(0, 'Invalid value: Expected uint32 to be >= 0'), v.maxValue(4294967295, 'Invalid value: Expected uint32 to be <= 2^32-1'))), - numberUint64: v.optional(v.pipe(v.union([ - v.number(), - v.string(), - v.bigint() - ]), v.transform(x => BigInt(x)), v.minValue(BigInt('0'), 'Invalid value: Expected uint64 to be >= 0'), v.maxValue(BigInt('18446744073709551615'), 'Invalid value: Expected uint64 to be <= 2^64-1'))), + numberInt8: v.optional(v.number()), + numberInt16: v.optional(v.number()), + numberInt32: v.optional(v.number()), + numberInt64: v.optional(v.number()), + numberUint8: v.optional(v.number()), + numberUint16: v.optional(v.number()), + numberUint32: v.optional(v.number()), + numberUint64: v.optional(v.number()), integerNoFormat: v.optional(v.pipe(v.number(), v.integer())), - integerInt8: v.optional(v.pipe(v.number(), v.integer(), v.minValue(-128, 'Invalid value: Expected int8 to be >= -2^7'), v.maxValue(127, 'Invalid value: Expected int8 to be <= 2^7-1'))), - integerInt16: v.optional(v.pipe(v.number(), v.integer(), v.minValue(-32768, 'Invalid value: Expected int16 to be >= -2^15'), v.maxValue(32767, 'Invalid value: Expected int16 to be <= 2^15-1'))), - integerInt32: v.optional(v.pipe(v.number(), v.integer(), v.minValue(-2147483648, 'Invalid value: Expected int32 to be >= -2^31'), v.maxValue(2147483647, 'Invalid value: Expected int32 to be <= 2^31-1'))), - integerInt64: v.optional(v.pipe(v.union([ - v.number(), - v.string(), - v.bigint() - ]), v.transform(x => BigInt(x)), v.minValue(BigInt('-9223372036854775808'), 'Invalid value: Expected int64 to be >= -2^63'), v.maxValue(BigInt('9223372036854775807'), 'Invalid value: Expected int64 to be <= 2^63-1'))), - integerUint8: v.optional(v.pipe(v.number(), v.integer(), v.minValue(0, 'Invalid value: Expected uint8 to be >= 0'), v.maxValue(255, 'Invalid value: Expected uint8 to be <= 2^8-1'))), - integerUint16: v.optional(v.pipe(v.number(), v.integer(), v.minValue(0, 'Invalid value: Expected uint16 to be >= 0'), v.maxValue(65535, 'Invalid value: Expected uint16 to be <= 2^16-1'))), - integerUint32: v.optional(v.pipe(v.number(), v.integer(), v.minValue(0, 'Invalid value: Expected uint32 to be >= 0'), v.maxValue(4294967295, 'Invalid value: Expected uint32 to be <= 2^32-1'))), - integerUint64: v.optional(v.pipe(v.union([ - v.number(), - v.string(), - v.bigint() - ]), v.transform(x => BigInt(x)), v.minValue(BigInt('0'), 'Invalid value: Expected uint64 to be >= 0'), v.maxValue(BigInt('18446744073709551615'), 'Invalid value: Expected uint64 to be <= 2^64-1'))), - stringInt64: v.optional(v.pipe(v.union([ - v.number(), - v.string(), - v.bigint() - ]), v.transform(x => BigInt(x)), v.minValue(BigInt('-9223372036854775808'), 'Invalid value: Expected int64 to be >= -2^63'), v.maxValue(BigInt('9223372036854775807'), 'Invalid value: Expected int64 to be <= 2^63-1'))), - stringUint64: v.optional(v.pipe(v.union([ - v.number(), - v.string(), - v.bigint() - ]), v.transform(x => BigInt(x)), v.minValue(BigInt('0'), 'Invalid value: Expected uint64 to be >= 0'), v.maxValue(BigInt('18446744073709551615'), 'Invalid value: Expected uint64 to be <= 2^64-1'))) + integerInt8: v.optional(v.pipe(v.number(), v.integer())), + integerInt16: v.optional(v.pipe(v.number(), v.integer())), + integerInt32: v.optional(v.pipe(v.number(), v.integer())), + integerInt64: v.optional(v.bigint()), + integerUint8: v.optional(v.pipe(v.number(), v.integer())), + integerUint16: v.optional(v.pipe(v.number(), v.integer())), + integerUint32: v.optional(v.pipe(v.number(), v.integer())), + integerUint64: v.optional(v.pipe(v.number(), v.integer())), + stringInt64: v.optional(v.string()), + stringUint64: v.optional(v.string()) }); \ No newline at end of file diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/internal-name-conflict/@tanstack/react-query.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/internal-name-conflict/@tanstack/react-query.gen.ts index a084ac71c..475b08ba9 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/internal-name-conflict/@tanstack/react-query.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/internal-name-conflict/@tanstack/react-query.gen.ts @@ -15,7 +15,7 @@ export type QueryKey = [ const createQueryKey = (id: string, options?: TOptions, infinite?: boolean): [ QueryKey[0] ] => { - const params: QueryKey[0] = { _id: id, baseUrl: options?.baseUrl || (options?.client ?? _heyApiClient).getConfig().baseUrl } as QueryKey[0]; + const params: QueryKey[0] = { _id: id, baseUrl: (options?.client ?? _heyApiClient).getConfig().baseUrl } as QueryKey[0]; if (infinite) { params._infinite = infinite; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/internal-name-conflict/client/client.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/internal-name-conflict/client/client.ts index 89d1e3158..dddfe80c0 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/internal-name-conflict/client/client.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/internal-name-conflict/client/client.ts @@ -143,16 +143,14 @@ export const createClient = (config: Config = {}): Client => { }; } - const textError = await response.text(); - let jsonError: unknown; + let error = await response.text(); try { - jsonError = JSON.parse(textError); + error = JSON.parse(error); } catch { // noop } - const error = jsonError ?? textError; let finalError = error; for (const fn of interceptors.error._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/internal-name-conflict/core/params.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/internal-name-conflict/core/params.ts index ba35263d8..7559bbb8c 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/internal-name-conflict/core/params.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/internal-name-conflict/core/params.ts @@ -3,21 +3,11 @@ type Slot = 'body' | 'headers' | 'path' | 'query'; export type Field = | { in: Exclude; - /** - * Field name. This is the name we want the user to see and use. - */ key: string; - /** - * Field mapped name. This is the name we want to use in the request. - * If omitted, we use the same value as `key`. - */ map?: string; } | { in: Extract; - /** - * Key isn't required for bodies. - */ key?: string; map?: string; }; diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/internal-name-conflict/core/types.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/internal-name-conflict/core/types.ts index 2dd4106fb..77d879253 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/internal-name-conflict/core/types.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/internal-name-conflict/core/types.ts @@ -102,17 +102,3 @@ export interface Config { */ responseValidator?: (data: unknown) => Promise; } - -type IsExactlyNeverOrNeverUndefined = [T] extends [never] - ? true - : [T] extends [never | undefined] - ? [undefined] extends [T] - ? false - : true - : false; - -export type OmitNever> = { - [K in keyof T as IsExactlyNeverOrNeverUndefined extends true - ? never - : K]: T[K]; -}; diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/pagination-ref/@tanstack/react-query.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/pagination-ref/@tanstack/react-query.gen.ts index 29df7ca39..7f5edcaf4 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/pagination-ref/@tanstack/react-query.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/pagination-ref/@tanstack/react-query.gen.ts @@ -15,7 +15,7 @@ export type QueryKey = [ const createQueryKey = (id: string, options?: TOptions, infinite?: boolean): [ QueryKey[0] ] => { - const params: QueryKey[0] = { _id: id, baseUrl: options?.baseUrl || (options?.client ?? _heyApiClient).getConfig().baseUrl } as QueryKey[0]; + const params: QueryKey[0] = { _id: id, baseUrl: (options?.client ?? _heyApiClient).getConfig().baseUrl } as QueryKey[0]; if (infinite) { params._infinite = infinite; } diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/pagination-ref/client/client.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/pagination-ref/client/client.ts index 89d1e3158..dddfe80c0 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/pagination-ref/client/client.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/pagination-ref/client/client.ts @@ -143,16 +143,14 @@ export const createClient = (config: Config = {}): Client => { }; } - const textError = await response.text(); - let jsonError: unknown; + let error = await response.text(); try { - jsonError = JSON.parse(textError); + error = JSON.parse(error); } catch { // noop } - const error = jsonError ?? textError; let finalError = error; for (const fn of interceptors.error._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/pagination-ref/core/params.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/pagination-ref/core/params.ts index ba35263d8..7559bbb8c 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/pagination-ref/core/params.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/pagination-ref/core/params.ts @@ -3,21 +3,11 @@ type Slot = 'body' | 'headers' | 'path' | 'query'; export type Field = | { in: Exclude; - /** - * Field name. This is the name we want the user to see and use. - */ key: string; - /** - * Field mapped name. This is the name we want to use in the request. - * If omitted, we use the same value as `key`. - */ map?: string; } | { in: Extract; - /** - * Key isn't required for bodies. - */ key?: string; map?: string; }; diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/pagination-ref/core/types.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/pagination-ref/core/types.ts index 2dd4106fb..77d879253 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/pagination-ref/core/types.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/pagination-ref/core/types.ts @@ -102,17 +102,3 @@ export interface Config { */ responseValidator?: (data: unknown) => Promise; } - -type IsExactlyNeverOrNeverUndefined = [T] extends [never] - ? true - : [T] extends [never | undefined] - ? [undefined] extends [T] - ? false - : true - : false; - -export type OmitNever> = { - [K in keyof T as IsExactlyNeverOrNeverUndefined extends true - ? never - : K]: T[K]; -}; diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/parameter-explode-false-axios/client/client.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/parameter-explode-false-axios/client/client.ts index 307a986cf..41b7494eb 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/parameter-explode-false-axios/client/client.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/parameter-explode-false-axios/client/client.ts @@ -1,4 +1,4 @@ -import type { AxiosError, AxiosInstance, RawAxiosRequestHeaders } from 'axios'; +import type { AxiosError, RawAxiosRequestHeaders } from 'axios'; import axios from 'axios'; import type { Client, Config } from './types'; @@ -13,15 +13,9 @@ import { export const createClient = (config: Config = {}): Client => { let _config = mergeConfigs(createConfig(), config); - let instance: AxiosInstance; - - if (_config.axios && !('Axios' in _config.axios)) { - instance = _config.axios; - } else { - // eslint-disable-next-line @typescript-eslint/no-unused-vars - const { auth, ...configWithoutAuth } = _config; - instance = axios.create(configWithoutAuth); - } + // eslint-disable-next-line @typescript-eslint/no-unused-vars + const { auth, ...configWithoutAuth } = _config; + const instance = axios.create(configWithoutAuth); const getConfig = (): Config => ({ ..._config }); diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/parameter-explode-false-axios/client/types.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/parameter-explode-false-axios/client/types.ts index ffcf05181..fb9d690f3 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/parameter-explode-false-axios/client/types.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/parameter-explode-false-axios/client/types.ts @@ -1,7 +1,6 @@ import type { AxiosError, AxiosInstance, - AxiosRequestHeaders, AxiosResponse, AxiosStatic, CreateAxiosDefaults, @@ -17,12 +16,12 @@ export interface Config extends Omit, CoreConfig { /** - * Axios implementation. You can use this option to provide either an - * `AxiosStatic` or an `AxiosInstance`. + * Axios implementation. You can use this option to provide a custom + * Axios instance. * * @default axios */ - axios?: AxiosStatic | AxiosInstance; + axios?: AxiosStatic; /** * Base URL for all requests made by this client. */ @@ -34,7 +33,7 @@ export interface Config * {@link https://developer.mozilla.org/docs/Web/API/Headers/Headers#init See more} */ headers?: - | AxiosRequestHeaders + | CreateAxiosDefaults['headers'] | Record< string, | string diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/parameter-explode-false-axios/core/params.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/parameter-explode-false-axios/core/params.ts index ba35263d8..7559bbb8c 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/parameter-explode-false-axios/core/params.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/parameter-explode-false-axios/core/params.ts @@ -3,21 +3,11 @@ type Slot = 'body' | 'headers' | 'path' | 'query'; export type Field = | { in: Exclude; - /** - * Field name. This is the name we want the user to see and use. - */ key: string; - /** - * Field mapped name. This is the name we want to use in the request. - * If omitted, we use the same value as `key`. - */ map?: string; } | { in: Extract; - /** - * Key isn't required for bodies. - */ key?: string; map?: string; }; diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/parameter-explode-false-axios/core/types.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/parameter-explode-false-axios/core/types.ts index 2dd4106fb..77d879253 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/parameter-explode-false-axios/core/types.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/parameter-explode-false-axios/core/types.ts @@ -102,17 +102,3 @@ export interface Config { */ responseValidator?: (data: unknown) => Promise; } - -type IsExactlyNeverOrNeverUndefined = [T] extends [never] - ? true - : [T] extends [never | undefined] - ? [undefined] extends [T] - ? false - : true - : false; - -export type OmitNever> = { - [K in keyof T as IsExactlyNeverOrNeverUndefined extends true - ? never - : K]: T[K]; -}; diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/parameter-explode-false/client/client.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/parameter-explode-false/client/client.ts index 89d1e3158..dddfe80c0 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/parameter-explode-false/client/client.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/parameter-explode-false/client/client.ts @@ -143,16 +143,14 @@ export const createClient = (config: Config = {}): Client => { }; } - const textError = await response.text(); - let jsonError: unknown; + let error = await response.text(); try { - jsonError = JSON.parse(textError); + error = JSON.parse(error); } catch { // noop } - const error = jsonError ?? textError; let finalError = error; for (const fn of interceptors.error._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/parameter-explode-false/core/params.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/parameter-explode-false/core/params.ts index ba35263d8..7559bbb8c 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/parameter-explode-false/core/params.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/parameter-explode-false/core/params.ts @@ -3,21 +3,11 @@ type Slot = 'body' | 'headers' | 'path' | 'query'; export type Field = | { in: Exclude; - /** - * Field name. This is the name we want the user to see and use. - */ key: string; - /** - * Field mapped name. This is the name we want to use in the request. - * If omitted, we use the same value as `key`. - */ map?: string; } | { in: Extract; - /** - * Key isn't required for bodies. - */ key?: string; map?: string; }; diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/parameter-explode-false/core/types.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/parameter-explode-false/core/types.ts index 2dd4106fb..77d879253 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/parameter-explode-false/core/types.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/parameter-explode-false/core/types.ts @@ -102,17 +102,3 @@ export interface Config { */ responseValidator?: (data: unknown) => Promise; } - -type IsExactlyNeverOrNeverUndefined = [T] extends [never] - ? true - : [T] extends [never | undefined] - ? [undefined] extends [T] - ? false - : true - : false; - -export type OmitNever> = { - [K in keyof T as IsExactlyNeverOrNeverUndefined extends true - ? never - : K]: T[K]; -}; diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/schema-const/valibot.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/schema-const/valibot.gen.ts index 01d8e66df..3caf7a2a5 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/schema-const/valibot.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/schema-const/valibot.gen.ts @@ -15,23 +15,23 @@ export const vFoo = v.object({ v.literal(true) ])), corge: v.optional(v.object({})), - garply: v.optional(v.literal(BigInt('10'))), + garply: v.optional(v.bigint()), numberInt8: v.optional(v.literal(100)), numberInt16: v.optional(v.literal(1000)), numberInt32: v.optional(v.literal(100000)), - numberInt64: v.optional(v.literal(BigInt('1000000000000'))), + numberInt64: v.optional(v.literal(1000000000000)), numberUint8: v.optional(v.literal(200)), numberUint16: v.optional(v.literal(50000)), numberUint32: v.optional(v.literal(3000000000)), - numberUint64: v.optional(v.literal(BigInt('18000000000000000000'))), + numberUint64: v.optional(v.literal(18000000000000000000)), integerInt8: v.optional(v.literal(-100)), integerInt16: v.optional(v.literal(-1000)), integerInt32: v.optional(v.literal(-100000)), - integerInt64: v.optional(v.literal(BigInt('-1000000000000'))), + integerInt64: v.optional(v.literal(-1000000000000)), integerUint8: v.optional(v.literal(255)), integerUint16: v.optional(v.literal(65535)), integerUint32: v.optional(v.literal(4294967295)), - integerUint64: v.optional(v.literal(BigInt('18446744073709551615'))), - stringInt64: v.optional(v.literal(BigInt('-9223372036854775808'))), - stringUint64: v.optional(v.literal(BigInt('18446744073709551615'))) + integerUint64: v.optional(v.pipe(v.number(), v.integer())), + stringInt64: v.optional(v.literal('-9223372036854775808')), + stringUint64: v.optional(v.literal('18446744073709551615')) }); \ No newline at end of file diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-api-key/client/client.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-api-key/client/client.ts index 89d1e3158..dddfe80c0 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-api-key/client/client.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-api-key/client/client.ts @@ -143,16 +143,14 @@ export const createClient = (config: Config = {}): Client => { }; } - const textError = await response.text(); - let jsonError: unknown; + let error = await response.text(); try { - jsonError = JSON.parse(textError); + error = JSON.parse(error); } catch { // noop } - const error = jsonError ?? textError; let finalError = error; for (const fn of interceptors.error._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-api-key/core/params.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-api-key/core/params.ts index ba35263d8..7559bbb8c 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-api-key/core/params.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-api-key/core/params.ts @@ -3,21 +3,11 @@ type Slot = 'body' | 'headers' | 'path' | 'query'; export type Field = | { in: Exclude; - /** - * Field name. This is the name we want the user to see and use. - */ key: string; - /** - * Field mapped name. This is the name we want to use in the request. - * If omitted, we use the same value as `key`. - */ map?: string; } | { in: Extract; - /** - * Key isn't required for bodies. - */ key?: string; map?: string; }; diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-api-key/core/types.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-api-key/core/types.ts index 2dd4106fb..77d879253 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-api-key/core/types.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-api-key/core/types.ts @@ -102,17 +102,3 @@ export interface Config { */ responseValidator?: (data: unknown) => Promise; } - -type IsExactlyNeverOrNeverUndefined = [T] extends [never] - ? true - : [T] extends [never | undefined] - ? [undefined] extends [T] - ? false - : true - : false; - -export type OmitNever> = { - [K in keyof T as IsExactlyNeverOrNeverUndefined extends true - ? never - : K]: T[K]; -}; diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-false/client/client.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-false/client/client.ts index 89d1e3158..dddfe80c0 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-false/client/client.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-false/client/client.ts @@ -143,16 +143,14 @@ export const createClient = (config: Config = {}): Client => { }; } - const textError = await response.text(); - let jsonError: unknown; + let error = await response.text(); try { - jsonError = JSON.parse(textError); + error = JSON.parse(error); } catch { // noop } - const error = jsonError ?? textError; let finalError = error; for (const fn of interceptors.error._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-false/core/params.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-false/core/params.ts index ba35263d8..7559bbb8c 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-false/core/params.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-false/core/params.ts @@ -3,21 +3,11 @@ type Slot = 'body' | 'headers' | 'path' | 'query'; export type Field = | { in: Exclude; - /** - * Field name. This is the name we want the user to see and use. - */ key: string; - /** - * Field mapped name. This is the name we want to use in the request. - * If omitted, we use the same value as `key`. - */ map?: string; } | { in: Extract; - /** - * Key isn't required for bodies. - */ key?: string; map?: string; }; diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-false/core/types.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-false/core/types.ts index 2dd4106fb..77d879253 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-false/core/types.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-false/core/types.ts @@ -102,17 +102,3 @@ export interface Config { */ responseValidator?: (data: unknown) => Promise; } - -type IsExactlyNeverOrNeverUndefined = [T] extends [never] - ? true - : [T] extends [never | undefined] - ? [undefined] extends [T] - ? false - : true - : false; - -export type OmitNever> = { - [K in keyof T as IsExactlyNeverOrNeverUndefined extends true - ? never - : K]: T[K]; -}; diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-http-bearer/client/client.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-http-bearer/client/client.ts index 89d1e3158..dddfe80c0 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-http-bearer/client/client.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-http-bearer/client/client.ts @@ -143,16 +143,14 @@ export const createClient = (config: Config = {}): Client => { }; } - const textError = await response.text(); - let jsonError: unknown; + let error = await response.text(); try { - jsonError = JSON.parse(textError); + error = JSON.parse(error); } catch { // noop } - const error = jsonError ?? textError; let finalError = error; for (const fn of interceptors.error._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-http-bearer/core/params.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-http-bearer/core/params.ts index ba35263d8..7559bbb8c 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-http-bearer/core/params.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-http-bearer/core/params.ts @@ -3,21 +3,11 @@ type Slot = 'body' | 'headers' | 'path' | 'query'; export type Field = | { in: Exclude; - /** - * Field name. This is the name we want the user to see and use. - */ key: string; - /** - * Field mapped name. This is the name we want to use in the request. - * If omitted, we use the same value as `key`. - */ map?: string; } | { in: Extract; - /** - * Key isn't required for bodies. - */ key?: string; map?: string; }; diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-http-bearer/core/types.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-http-bearer/core/types.ts index 2dd4106fb..77d879253 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-http-bearer/core/types.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-http-bearer/core/types.ts @@ -102,17 +102,3 @@ export interface Config { */ responseValidator?: (data: unknown) => Promise; } - -type IsExactlyNeverOrNeverUndefined = [T] extends [never] - ? true - : [T] extends [never | undefined] - ? [undefined] extends [T] - ? false - : true - : false; - -export type OmitNever> = { - [K in keyof T as IsExactlyNeverOrNeverUndefined extends true - ? never - : K]: T[K]; -}; diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-oauth2/client/client.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-oauth2/client/client.ts index 89d1e3158..dddfe80c0 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-oauth2/client/client.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-oauth2/client/client.ts @@ -143,16 +143,14 @@ export const createClient = (config: Config = {}): Client => { }; } - const textError = await response.text(); - let jsonError: unknown; + let error = await response.text(); try { - jsonError = JSON.parse(textError); + error = JSON.parse(error); } catch { // noop } - const error = jsonError ?? textError; let finalError = error; for (const fn of interceptors.error._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-oauth2/core/params.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-oauth2/core/params.ts index ba35263d8..7559bbb8c 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-oauth2/core/params.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-oauth2/core/params.ts @@ -3,21 +3,11 @@ type Slot = 'body' | 'headers' | 'path' | 'query'; export type Field = | { in: Exclude; - /** - * Field name. This is the name we want the user to see and use. - */ key: string; - /** - * Field mapped name. This is the name we want to use in the request. - * If omitted, we use the same value as `key`. - */ map?: string; } | { in: Extract; - /** - * Key isn't required for bodies. - */ key?: string; map?: string; }; diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-oauth2/core/types.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-oauth2/core/types.ts index 2dd4106fb..77d879253 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-oauth2/core/types.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-oauth2/core/types.ts @@ -102,17 +102,3 @@ export interface Config { */ responseValidator?: (data: unknown) => Promise; } - -type IsExactlyNeverOrNeverUndefined = [T] extends [never] - ? true - : [T] extends [never | undefined] - ? [undefined] extends [T] - ? false - : true - : false; - -export type OmitNever> = { - [K in keyof T as IsExactlyNeverOrNeverUndefined extends true - ? never - : K]: T[K]; -}; diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-open-id-connect/client/client.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-open-id-connect/client/client.ts index 89d1e3158..dddfe80c0 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-open-id-connect/client/client.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-open-id-connect/client/client.ts @@ -143,16 +143,14 @@ export const createClient = (config: Config = {}): Client => { }; } - const textError = await response.text(); - let jsonError: unknown; + let error = await response.text(); try { - jsonError = JSON.parse(textError); + error = JSON.parse(error); } catch { // noop } - const error = jsonError ?? textError; let finalError = error; for (const fn of interceptors.error._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-open-id-connect/core/params.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-open-id-connect/core/params.ts index ba35263d8..7559bbb8c 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-open-id-connect/core/params.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-open-id-connect/core/params.ts @@ -3,21 +3,11 @@ type Slot = 'body' | 'headers' | 'path' | 'query'; export type Field = | { in: Exclude; - /** - * Field name. This is the name we want the user to see and use. - */ key: string; - /** - * Field mapped name. This is the name we want to use in the request. - * If omitted, we use the same value as `key`. - */ map?: string; } | { in: Extract; - /** - * Key isn't required for bodies. - */ key?: string; map?: string; }; diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-open-id-connect/core/types.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-open-id-connect/core/types.ts index 2dd4106fb..77d879253 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-open-id-connect/core/types.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-open-id-connect/core/types.ts @@ -102,17 +102,3 @@ export interface Config { */ responseValidator?: (data: unknown) => Promise; } - -type IsExactlyNeverOrNeverUndefined = [T] extends [never] - ? true - : [T] extends [never | undefined] - ? [undefined] extends [T] - ? false - : true - : false; - -export type OmitNever> = { - [K in keyof T as IsExactlyNeverOrNeverUndefined extends true - ? never - : K]: T[K]; -}; diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/servers/client/client.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/servers/client/client.ts index 89d1e3158..dddfe80c0 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/servers/client/client.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/servers/client/client.ts @@ -143,16 +143,14 @@ export const createClient = (config: Config = {}): Client => { }; } - const textError = await response.text(); - let jsonError: unknown; + let error = await response.text(); try { - jsonError = JSON.parse(textError); + error = JSON.parse(error); } catch { // noop } - const error = jsonError ?? textError; let finalError = error; for (const fn of interceptors.error._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/servers/core/params.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/servers/core/params.ts index ba35263d8..7559bbb8c 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/servers/core/params.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/servers/core/params.ts @@ -3,21 +3,11 @@ type Slot = 'body' | 'headers' | 'path' | 'query'; export type Field = | { in: Exclude; - /** - * Field name. This is the name we want the user to see and use. - */ key: string; - /** - * Field mapped name. This is the name we want to use in the request. - * If omitted, we use the same value as `key`. - */ map?: string; } | { in: Extract; - /** - * Key isn't required for bodies. - */ key?: string; map?: string; }; diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/servers/core/types.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/servers/core/types.ts index 2dd4106fb..77d879253 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/servers/core/types.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/servers/core/types.ts @@ -102,17 +102,3 @@ export interface Config { */ responseValidator?: (data: unknown) => Promise; } - -type IsExactlyNeverOrNeverUndefined = [T] extends [never] - ? true - : [T] extends [never | undefined] - ? [undefined] extends [T] - ? false - : true - : false; - -export type OmitNever> = { - [K in keyof T as IsExactlyNeverOrNeverUndefined extends true - ? never - : K]: T[K]; -}; diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-all-of/client/client.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-all-of/client/client.ts index 89d1e3158..dddfe80c0 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-all-of/client/client.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-all-of/client/client.ts @@ -143,16 +143,14 @@ export const createClient = (config: Config = {}): Client => { }; } - const textError = await response.text(); - let jsonError: unknown; + let error = await response.text(); try { - jsonError = JSON.parse(textError); + error = JSON.parse(error); } catch { // noop } - const error = jsonError ?? textError; let finalError = error; for (const fn of interceptors.error._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-all-of/core/params.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-all-of/core/params.ts index ba35263d8..7559bbb8c 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-all-of/core/params.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-all-of/core/params.ts @@ -3,21 +3,11 @@ type Slot = 'body' | 'headers' | 'path' | 'query'; export type Field = | { in: Exclude; - /** - * Field name. This is the name we want the user to see and use. - */ key: string; - /** - * Field mapped name. This is the name we want to use in the request. - * If omitted, we use the same value as `key`. - */ map?: string; } | { in: Extract; - /** - * Key isn't required for bodies. - */ key?: string; map?: string; }; diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-all-of/core/types.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-all-of/core/types.ts index 2dd4106fb..77d879253 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-all-of/core/types.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-all-of/core/types.ts @@ -102,17 +102,3 @@ export interface Config { */ responseValidator?: (data: unknown) => Promise; } - -type IsExactlyNeverOrNeverUndefined = [T] extends [never] - ? true - : [T] extends [never | undefined] - ? [undefined] extends [T] - ? false - : true - : false; - -export type OmitNever> = { - [K in keyof T as IsExactlyNeverOrNeverUndefined extends true - ? never - : K]: T[K]; -}; diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-any-of-null/client/client.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-any-of-null/client/client.ts index 89d1e3158..dddfe80c0 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-any-of-null/client/client.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-any-of-null/client/client.ts @@ -143,16 +143,14 @@ export const createClient = (config: Config = {}): Client => { }; } - const textError = await response.text(); - let jsonError: unknown; + let error = await response.text(); try { - jsonError = JSON.parse(textError); + error = JSON.parse(error); } catch { // noop } - const error = jsonError ?? textError; let finalError = error; for (const fn of interceptors.error._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-any-of-null/core/params.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-any-of-null/core/params.ts index ba35263d8..7559bbb8c 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-any-of-null/core/params.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-any-of-null/core/params.ts @@ -3,21 +3,11 @@ type Slot = 'body' | 'headers' | 'path' | 'query'; export type Field = | { in: Exclude; - /** - * Field name. This is the name we want the user to see and use. - */ key: string; - /** - * Field mapped name. This is the name we want to use in the request. - * If omitted, we use the same value as `key`. - */ map?: string; } | { in: Extract; - /** - * Key isn't required for bodies. - */ key?: string; map?: string; }; diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-any-of-null/core/types.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-any-of-null/core/types.ts index 2dd4106fb..77d879253 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-any-of-null/core/types.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-any-of-null/core/types.ts @@ -102,17 +102,3 @@ export interface Config { */ responseValidator?: (data: unknown) => Promise; } - -type IsExactlyNeverOrNeverUndefined = [T] extends [never] - ? true - : [T] extends [never | undefined] - ? [undefined] extends [T] - ? false - : true - : false; - -export type OmitNever> = { - [K in keyof T as IsExactlyNeverOrNeverUndefined extends true - ? never - : K]: T[K]; -}; diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-array/client/client.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-array/client/client.ts index 89d1e3158..dddfe80c0 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-array/client/client.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-array/client/client.ts @@ -143,16 +143,14 @@ export const createClient = (config: Config = {}): Client => { }; } - const textError = await response.text(); - let jsonError: unknown; + let error = await response.text(); try { - jsonError = JSON.parse(textError); + error = JSON.parse(error); } catch { // noop } - const error = jsonError ?? textError; let finalError = error; for (const fn of interceptors.error._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-array/core/params.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-array/core/params.ts index ba35263d8..7559bbb8c 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-array/core/params.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-array/core/params.ts @@ -3,21 +3,11 @@ type Slot = 'body' | 'headers' | 'path' | 'query'; export type Field = | { in: Exclude; - /** - * Field name. This is the name we want the user to see and use. - */ key: string; - /** - * Field mapped name. This is the name we want to use in the request. - * If omitted, we use the same value as `key`. - */ map?: string; } | { in: Extract; - /** - * Key isn't required for bodies. - */ key?: string; map?: string; }; diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-array/core/types.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-array/core/types.ts index 2dd4106fb..77d879253 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-array/core/types.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-array/core/types.ts @@ -102,17 +102,3 @@ export interface Config { */ responseValidator?: (data: unknown) => Promise; } - -type IsExactlyNeverOrNeverUndefined = [T] extends [never] - ? true - : [T] extends [never | undefined] - ? [undefined] extends [T] - ? false - : true - : false; - -export type OmitNever> = { - [K in keyof T as IsExactlyNeverOrNeverUndefined extends true - ? never - : K]: T[K]; -}; diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transforms-read-write/client/client.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transforms-read-write/client/client.ts index 89d1e3158..dddfe80c0 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transforms-read-write/client/client.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transforms-read-write/client/client.ts @@ -143,16 +143,14 @@ export const createClient = (config: Config = {}): Client => { }; } - const textError = await response.text(); - let jsonError: unknown; + let error = await response.text(); try { - jsonError = JSON.parse(textError); + error = JSON.parse(error); } catch { // noop } - const error = jsonError ?? textError; let finalError = error; for (const fn of interceptors.error._fns) { diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transforms-read-write/core/params.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transforms-read-write/core/params.ts index ba35263d8..7559bbb8c 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transforms-read-write/core/params.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transforms-read-write/core/params.ts @@ -3,21 +3,11 @@ type Slot = 'body' | 'headers' | 'path' | 'query'; export type Field = | { in: Exclude; - /** - * Field name. This is the name we want the user to see and use. - */ key: string; - /** - * Field mapped name. This is the name we want to use in the request. - * If omitted, we use the same value as `key`. - */ map?: string; } | { in: Extract; - /** - * Key isn't required for bodies. - */ key?: string; map?: string; }; diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transforms-read-write/core/types.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transforms-read-write/core/types.ts index 2dd4106fb..77d879253 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transforms-read-write/core/types.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transforms-read-write/core/types.ts @@ -102,17 +102,3 @@ export interface Config { */ responseValidator?: (data: unknown) => Promise; } - -type IsExactlyNeverOrNeverUndefined = [T] extends [never] - ? true - : [T] extends [never | undefined] - ? [undefined] extends [T] - ? false - : true - : false; - -export type OmitNever> = { - [K in keyof T as IsExactlyNeverOrNeverUndefined extends true - ? never - : K]: T[K]; -}; diff --git a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/validators-bigint-min-max/valibot.gen.ts b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/validators-bigint-min-max/valibot.gen.ts index 284f1ae3b..c438767bb 100644 --- a/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/validators-bigint-min-max/valibot.gen.ts +++ b/packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/validators-bigint-min-max/valibot.gen.ts @@ -3,9 +3,5 @@ import * as v from 'valibot'; export const vFoo = v.object({ - foo: v.optional(v.pipe(v.union([ - v.number(), - v.string(), - v.bigint() - ]), v.transform(x => BigInt(x)), v.minValue(BigInt('-9223372036854775808'), 'Invalid value: Expected int64 to be >= -2^63'), v.maxValue(BigInt('9223372036854775807'), 'Invalid value: Expected int64 to be <= 2^63-1'), v.minValue(BigInt(0)), v.maxValue(BigInt(100)))) + foo: v.optional(v.pipe(v.bigint(), v.minValue(BigInt(0)), v.maxValue(BigInt(100)))) }); \ No newline at end of file diff --git a/packages/openapi-ts-tests/zod/v3/__snapshots__/3.0.x/mini/array-items-one-of-length-1/zod.gen.ts b/packages/openapi-ts-tests/zod/v3/__snapshots__/3.0.x/mini/array-items-one-of-length-1/zod.gen.ts index c0dc11ed2..91997b20b 100644 --- a/packages/openapi-ts-tests/zod/v3/__snapshots__/3.0.x/mini/array-items-one-of-length-1/zod.gen.ts +++ b/packages/openapi-ts-tests/zod/v3/__snapshots__/3.0.x/mini/array-items-one-of-length-1/zod.gen.ts @@ -1,9 +1,9 @@ // This file is auto-generated by @hey-api/openapi-ts -import * as z from 'zod/v4-mini'; +import { z } from 'zod'; export const zBar = z.string(); export const zFoo = z.object({ - foo: z.optional(z.array(zBar).check(z.minLength(1), z.maxLength(2147483647))) + foo: z.array(zBar).min(1).max(2147483647).optional() }); \ No newline at end of file diff --git a/packages/openapi-ts-tests/zod/v3/__snapshots__/3.0.x/mini/enum-null/zod.gen.ts b/packages/openapi-ts-tests/zod/v3/__snapshots__/3.0.x/mini/enum-null/zod.gen.ts index 7071dca84..2b8373603 100644 --- a/packages/openapi-ts-tests/zod/v3/__snapshots__/3.0.x/mini/enum-null/zod.gen.ts +++ b/packages/openapi-ts-tests/zod/v3/__snapshots__/3.0.x/mini/enum-null/zod.gen.ts @@ -1,11 +1,11 @@ // This file is auto-generated by @hey-api/openapi-ts -import * as z from 'zod/v4-mini'; +import { z } from 'zod'; -export const zFoo = z.nullable(z.enum([ +export const zFoo = z.enum([ 'foo', 'bar' -])); +]).nullable(); export const zBar = z.enum([ 'foo', diff --git a/packages/openapi-ts-tests/zod/v3/__snapshots__/3.0.x/mini/validators/zod.gen.ts b/packages/openapi-ts-tests/zod/v3/__snapshots__/3.0.x/mini/validators/zod.gen.ts index 22eb864db..f4142d499 100644 --- a/packages/openapi-ts-tests/zod/v3/__snapshots__/3.0.x/mini/validators/zod.gen.ts +++ b/packages/openapi-ts-tests/zod/v3/__snapshots__/3.0.x/mini/validators/zod.gen.ts @@ -1,25 +1,23 @@ // This file is auto-generated by @hey-api/openapi-ts -import * as z from 'zod/v4-mini'; +import { z } from 'zod'; -export const zBar = z.object({ - get foo(): z.ZodMiniOptional { - return z.optional(zFoo); - } +export const zBar: z.AnyZodObject = z.object({ + foo: z.lazy(() => { + return zFoo; + }).optional() }); -export const zFoo = z._default(z.union([ +export const zFoo: z.ZodTypeAny = z.union([ z.object({ - foo: z.optional(z.string().check(z.regex(/^\d{3}-\d{2}-\d{4}$/))), - bar: z.optional(zBar), - get baz(): z.ZodMiniOptional { - return z.optional(z.array(z.lazy((): any => { - return zFoo; - }))); - }, - qux: z._default(z.optional(z.int().check(z.gt(0))), 0) + foo: z.string().regex(/^\d{3}-\d{2}-\d{4}$/).optional(), + bar: zBar.optional(), + baz: z.array(z.lazy(() => { + return zFoo; + })).optional(), + qux: z.number().int().gt(0).optional().default(0) }), z.null() -]), null); +]).default(null); -export const zBaz = z._default(z.readonly(z.string().check(z.regex(/foo\nbar/))), 'baz'); \ No newline at end of file +export const zBaz = z.string().regex(/foo\nbar/).readonly().default('baz'); \ No newline at end of file diff --git a/packages/openapi-ts-tests/zod/v3/__snapshots__/3.0.x/v4/array-items-one-of-length-1/zod.gen.ts b/packages/openapi-ts-tests/zod/v3/__snapshots__/3.0.x/v4/array-items-one-of-length-1/zod.gen.ts index ea9d76fb3..91997b20b 100644 --- a/packages/openapi-ts-tests/zod/v3/__snapshots__/3.0.x/v4/array-items-one-of-length-1/zod.gen.ts +++ b/packages/openapi-ts-tests/zod/v3/__snapshots__/3.0.x/v4/array-items-one-of-length-1/zod.gen.ts @@ -1,9 +1,9 @@ // This file is auto-generated by @hey-api/openapi-ts -import { z } from 'zod/v4'; +import { z } from 'zod'; export const zBar = z.string(); export const zFoo = z.object({ - foo: z.optional(z.array(zBar).min(1).max(2147483647)) + foo: z.array(zBar).min(1).max(2147483647).optional() }); \ No newline at end of file diff --git a/packages/openapi-ts-tests/zod/v3/__snapshots__/3.0.x/v4/enum-null/zod.gen.ts b/packages/openapi-ts-tests/zod/v3/__snapshots__/3.0.x/v4/enum-null/zod.gen.ts index ac6994702..2b8373603 100644 --- a/packages/openapi-ts-tests/zod/v3/__snapshots__/3.0.x/v4/enum-null/zod.gen.ts +++ b/packages/openapi-ts-tests/zod/v3/__snapshots__/3.0.x/v4/enum-null/zod.gen.ts @@ -1,11 +1,11 @@ // This file is auto-generated by @hey-api/openapi-ts -import { z } from 'zod/v4'; +import { z } from 'zod'; -export const zFoo = z.nullable(z.enum([ +export const zFoo = z.enum([ 'foo', 'bar' -])); +]).nullable(); export const zBar = z.enum([ 'foo', diff --git a/packages/openapi-ts-tests/zod/v3/__snapshots__/3.0.x/v4/validators/zod.gen.ts b/packages/openapi-ts-tests/zod/v3/__snapshots__/3.0.x/v4/validators/zod.gen.ts index 78e8ede96..f4142d499 100644 --- a/packages/openapi-ts-tests/zod/v3/__snapshots__/3.0.x/v4/validators/zod.gen.ts +++ b/packages/openapi-ts-tests/zod/v3/__snapshots__/3.0.x/v4/validators/zod.gen.ts @@ -1,23 +1,21 @@ // This file is auto-generated by @hey-api/openapi-ts -import { z } from 'zod/v4'; +import { z } from 'zod'; -export const zBar = z.object({ - get foo(): z.ZodOptional { - return z.optional(zFoo); - } +export const zBar: z.AnyZodObject = z.object({ + foo: z.lazy(() => { + return zFoo; + }).optional() }); -export const zFoo = z.union([ +export const zFoo: z.ZodTypeAny = z.union([ z.object({ - foo: z.optional(z.string().regex(/^\d{3}-\d{2}-\d{4}$/)), - bar: z.optional(zBar), - get baz(): z.ZodOptional { - return z.optional(z.array(z.lazy((): any => { - return zFoo; - }))); - }, - qux: z.optional(z.int().gt(0)).default(0) + foo: z.string().regex(/^\d{3}-\d{2}-\d{4}$/).optional(), + bar: zBar.optional(), + baz: z.array(z.lazy(() => { + return zFoo; + })).optional(), + qux: z.number().int().gt(0).optional().default(0) }), z.null() ]).default(null); diff --git a/packages/openapi-ts-tests/zod/v3/__snapshots__/3.1.x/mini/array-items-one-of-length-1/zod.gen.ts b/packages/openapi-ts-tests/zod/v3/__snapshots__/3.1.x/mini/array-items-one-of-length-1/zod.gen.ts index c0dc11ed2..91997b20b 100644 --- a/packages/openapi-ts-tests/zod/v3/__snapshots__/3.1.x/mini/array-items-one-of-length-1/zod.gen.ts +++ b/packages/openapi-ts-tests/zod/v3/__snapshots__/3.1.x/mini/array-items-one-of-length-1/zod.gen.ts @@ -1,9 +1,9 @@ // This file is auto-generated by @hey-api/openapi-ts -import * as z from 'zod/v4-mini'; +import { z } from 'zod'; export const zBar = z.string(); export const zFoo = z.object({ - foo: z.optional(z.array(zBar).check(z.minLength(1), z.maxLength(2147483647))) + foo: z.array(zBar).min(1).max(2147483647).optional() }); \ No newline at end of file diff --git a/packages/openapi-ts-tests/zod/v3/__snapshots__/3.1.x/mini/enum-null/zod.gen.ts b/packages/openapi-ts-tests/zod/v3/__snapshots__/3.1.x/mini/enum-null/zod.gen.ts index 7071dca84..2b8373603 100644 --- a/packages/openapi-ts-tests/zod/v3/__snapshots__/3.1.x/mini/enum-null/zod.gen.ts +++ b/packages/openapi-ts-tests/zod/v3/__snapshots__/3.1.x/mini/enum-null/zod.gen.ts @@ -1,11 +1,11 @@ // This file is auto-generated by @hey-api/openapi-ts -import * as z from 'zod/v4-mini'; +import { z } from 'zod'; -export const zFoo = z.nullable(z.enum([ +export const zFoo = z.enum([ 'foo', 'bar' -])); +]).nullable(); export const zBar = z.enum([ 'foo', diff --git a/packages/openapi-ts-tests/zod/v3/__snapshots__/3.1.x/mini/schema-const/zod.gen.ts b/packages/openapi-ts-tests/zod/v3/__snapshots__/3.1.x/mini/schema-const/zod.gen.ts index 76b32a6f4..a7aad3761 100644 --- a/packages/openapi-ts-tests/zod/v3/__snapshots__/3.1.x/mini/schema-const/zod.gen.ts +++ b/packages/openapi-ts-tests/zod/v3/__snapshots__/3.1.x/mini/schema-const/zod.gen.ts @@ -1,37 +1,37 @@ // This file is auto-generated by @hey-api/openapi-ts -import * as z from 'zod/v4-mini'; +import { z } from 'zod'; export const zFoo = z.object({ - foo: z.optional(z.literal('foo')), - bar: z.optional(z.literal(3.2)), - baz: z.optional(z.literal(-1)), - qux: z.optional(z.literal(true)), - quux: z.optional(z.tuple([ + foo: z.literal('foo').optional(), + bar: z.literal(3.2).optional(), + baz: z.literal(-1).optional(), + qux: z.literal(true).optional(), + quux: z.tuple([ z.literal(1), z.literal(2), z.literal(3), z.literal('foo'), z.literal(true) - ])), - corge: z.optional(z.object({})), - garply: z.optional(z.coerce.bigint()), - numberInt8: z.optional(z.literal(100)), - numberInt16: z.optional(z.literal(1000)), - numberInt32: z.optional(z.literal(100000)), - numberInt64: z.optional(z.literal(1000000000000)), - numberUint8: z.optional(z.literal(200)), - numberUint16: z.optional(z.literal(50000)), - numberUint32: z.optional(z.literal(3000000000)), - numberUint64: z.optional(z.literal(18000000000000000000)), - integerInt8: z.optional(z.literal(-100)), - integerInt16: z.optional(z.literal(-1000)), - integerInt32: z.optional(z.literal(-100000)), - integerInt64: z.optional(z.literal(-1000000000000)), - integerUint8: z.optional(z.literal(255)), - integerUint16: z.optional(z.literal(65535)), - integerUint32: z.optional(z.literal(4294967295)), - integerUint64: z.optional(z.int()), - stringInt64: z.optional(z.literal('-9223372036854775808')), - stringUint64: z.optional(z.literal('18446744073709551615')) + ]).optional(), + corge: z.object({}).optional(), + garply: z.coerce.bigint().optional(), + numberInt8: z.literal(100).optional(), + numberInt16: z.literal(1000).optional(), + numberInt32: z.literal(100000).optional(), + numberInt64: z.literal(1000000000000).optional(), + numberUint8: z.literal(200).optional(), + numberUint16: z.literal(50000).optional(), + numberUint32: z.literal(3000000000).optional(), + numberUint64: z.literal(18000000000000000000).optional(), + integerInt8: z.literal(-100).optional(), + integerInt16: z.literal(-1000).optional(), + integerInt32: z.literal(-100000).optional(), + integerInt64: z.literal(-1000000000000).optional(), + integerUint8: z.literal(255).optional(), + integerUint16: z.literal(65535).optional(), + integerUint32: z.literal(4294967295).optional(), + integerUint64: z.number().int().optional(), + stringInt64: z.literal('-9223372036854775808').optional(), + stringUint64: z.literal('18446744073709551615').optional() }); \ No newline at end of file diff --git a/packages/openapi-ts-tests/zod/v3/__snapshots__/3.1.x/mini/validators-bigint-min-max/zod.gen.ts b/packages/openapi-ts-tests/zod/v3/__snapshots__/3.1.x/mini/validators-bigint-min-max/zod.gen.ts index 62a1267c7..cbd60cb15 100644 --- a/packages/openapi-ts-tests/zod/v3/__snapshots__/3.1.x/mini/validators-bigint-min-max/zod.gen.ts +++ b/packages/openapi-ts-tests/zod/v3/__snapshots__/3.1.x/mini/validators-bigint-min-max/zod.gen.ts @@ -1,7 +1,7 @@ // This file is auto-generated by @hey-api/openapi-ts -import * as z from 'zod/v4-mini'; +import { z } from 'zod'; export const zFoo = z.object({ - foo: z.optional(z.coerce.bigint().check(z.gte(BigInt(0)), z.lte(BigInt(100)))) + foo: z.coerce.bigint().gte(BigInt(0)).lte(BigInt(100)).optional() }); \ No newline at end of file diff --git a/packages/openapi-ts-tests/zod/v3/__snapshots__/3.1.x/mini/validators-circular-ref-2/zod.gen.ts b/packages/openapi-ts-tests/zod/v3/__snapshots__/3.1.x/mini/validators-circular-ref-2/zod.gen.ts index 03b6520c0..fe5c68cc8 100644 --- a/packages/openapi-ts-tests/zod/v3/__snapshots__/3.1.x/mini/validators-circular-ref-2/zod.gen.ts +++ b/packages/openapi-ts-tests/zod/v3/__snapshots__/3.1.x/mini/validators-circular-ref-2/zod.gen.ts @@ -1,16 +1,16 @@ // This file is auto-generated by @hey-api/openapi-ts -import * as z from 'zod/v4-mini'; +import { z } from 'zod'; -export const zBar = z.object({ +export const zBar: z.AnyZodObject = z.object({ bar: z.union([ - z.array(z.lazy((): any => { + z.array(z.lazy(() => { return zBar; })), z.null() ]) }); -export const zFoo = z.object({ +export const zFoo: z.AnyZodObject = z.object({ foo: zBar }); \ No newline at end of file diff --git a/packages/openapi-ts-tests/zod/v3/__snapshots__/3.1.x/mini/validators-circular-ref/zod.gen.ts b/packages/openapi-ts-tests/zod/v3/__snapshots__/3.1.x/mini/validators-circular-ref/zod.gen.ts index afe3dfe33..9ed4452c1 100644 --- a/packages/openapi-ts-tests/zod/v3/__snapshots__/3.1.x/mini/validators-circular-ref/zod.gen.ts +++ b/packages/openapi-ts-tests/zod/v3/__snapshots__/3.1.x/mini/validators-circular-ref/zod.gen.ts @@ -1,24 +1,22 @@ // This file is auto-generated by @hey-api/openapi-ts -import * as z from 'zod/v4-mini'; +import { z } from 'zod'; -export const zBar = z.object({ - get bar(): z.ZodMiniOptional { - return z.optional(z.array(z.lazy((): any => { - return zBar; - }))); - } +export const zBar: z.AnyZodObject = z.object({ + bar: z.array(z.lazy(() => { + return zBar; + })).optional() }); -export const zFoo = z.object({ - foo: z.optional(zBar) +export const zFoo: z.AnyZodObject = z.object({ + foo: zBar.optional() }); /** * description caused circular reference error */ -export const zQux = z.lazy((): any => { +export const zQux: z.ZodTypeAny = z.lazy(() => { return zQux; }); -export const zBaz = zQux; \ No newline at end of file +export const zBaz: z.ZodTypeAny = zQux; \ No newline at end of file diff --git a/packages/openapi-ts-tests/zod/v3/__snapshots__/3.1.x/mini/validators-dates/zod.gen.ts b/packages/openapi-ts-tests/zod/v3/__snapshots__/3.1.x/mini/validators-dates/zod.gen.ts index c205b93fa..7d3bc1d19 100644 --- a/packages/openapi-ts-tests/zod/v3/__snapshots__/3.1.x/mini/validators-dates/zod.gen.ts +++ b/packages/openapi-ts-tests/zod/v3/__snapshots__/3.1.x/mini/validators-dates/zod.gen.ts @@ -1,37 +1,35 @@ // This file is auto-generated by @hey-api/openapi-ts -import * as z from 'zod/v4-mini'; +import { z } from 'zod'; /** * This is Bar schema. */ -export const zBar = z.object({ - get foo(): z.ZodMiniOptional { - return z.optional(zFoo); - } +export const zBar: z.AnyZodObject = z.object({ + foo: z.lazy(() => { + return zFoo; + }).optional() }); /** * This is Foo schema. */ -export const zFoo = z._default(z.union([ +export const zFoo: z.ZodTypeAny = z.union([ z.object({ - foo: z.optional(z.string().check(z.regex(/^\d{3}-\d{2}-\d{4}$/))), - bar: z.optional(zBar), - get baz(): z.ZodMiniOptional { - return z.optional(z.array(z.lazy((): any => { - return zFoo; - }))); - }, - qux: z._default(z.optional(z.int().check(z.gt(0))), 0) + foo: z.string().regex(/^\d{3}-\d{2}-\d{4}$/).optional(), + bar: zBar.optional(), + baz: z.array(z.lazy(() => { + return zFoo; + })).optional(), + qux: z.number().int().gt(0).optional().default(0) }), z.null() -]), null); +]).default(null); -export const zBaz = z._default(z.readonly(z.string().check(z.regex(/foo\nbar/))), 'baz'); +export const zBaz = z.string().regex(/foo\nbar/).readonly().default('baz'); -export const zQux = z.record(z.string(), z.object({ - qux: z.optional(z.string()) +export const zQux = z.record(z.object({ + qux: z.string().optional() })); /** @@ -40,29 +38,29 @@ export const zQux = z.record(z.string(), z.object({ export const zFoo2 = z.string(); export const zFoo3 = z.object({ - foo: z.optional(zBar) + foo: zBar.optional() }); export const zPatchFooData = z.object({ body: z.object({ - foo: z.optional(z.string()) + foo: z.string().optional() }), - path: z.optional(z.never()), - query: z.optional(z.object({ - foo: z.optional(z.string()), - bar: z.optional(zBar), - baz: z.optional(z.object({ - baz: z.optional(z.string()) - })), - qux: z.optional(z.iso.date()), - quux: z.optional(z.iso.datetime({ + path: z.never().optional(), + query: z.object({ + foo: z.string().optional(), + bar: zBar.optional(), + baz: z.object({ + baz: z.string().optional() + }).optional(), + qux: z.string().date().optional(), + quux: z.string().datetime({ offset: true - })) - })) + }).optional() + }).optional() }); export const zPostFooData = z.object({ body: zFoo3, - path: z.optional(z.never()), - query: z.optional(z.never()) + path: z.never().optional(), + query: z.never().optional() }); \ No newline at end of file diff --git a/packages/openapi-ts-tests/zod/v3/__snapshots__/3.1.x/mini/validators-metadata/zod.gen.ts b/packages/openapi-ts-tests/zod/v3/__snapshots__/3.1.x/mini/validators-metadata/zod.gen.ts index 25c8c7d32..b269940da 100644 --- a/packages/openapi-ts-tests/zod/v3/__snapshots__/3.1.x/mini/validators-metadata/zod.gen.ts +++ b/packages/openapi-ts-tests/zod/v3/__snapshots__/3.1.x/mini/validators-metadata/zod.gen.ts @@ -1,78 +1,64 @@ // This file is auto-generated by @hey-api/openapi-ts -import * as z from 'zod/v4-mini'; +import { z } from 'zod'; /** * This is Bar schema. */ -export const zBar = z.object({ - get foo(): z.ZodMiniOptional { - return z.optional(zFoo); - } -}).register(z.globalRegistry, { - description: 'This is Bar schema.' -}); +export const zBar: z.AnyZodObject = z.object({ + foo: z.lazy(() => { + return zFoo; + }).optional() +}).describe('This is Bar schema.'); /** * This is Foo schema. */ -export const zFoo = z._default(z.union([ +export const zFoo: z.ZodTypeAny = z.union([ z.object({ - foo: z.optional(z.string().check(z.regex(/^\d{3}-\d{2}-\d{4}$/)).register(z.globalRegistry, { - description: 'This is foo property.' - })), - bar: z.optional(zBar), - get baz(): z.ZodMiniOptional { - return z.optional(z.array(z.lazy((): any => { - return zFoo; - })).register(z.globalRegistry, { - description: 'This is baz property.' - })); - }, - qux: z._default(z.optional(z.int().check(z.gt(0)).register(z.globalRegistry, { - description: 'This is qux property.' - })), 0) + foo: z.string().regex(/^\d{3}-\d{2}-\d{4}$/).describe('This is foo property.').optional(), + bar: zBar.optional(), + baz: z.array(z.lazy(() => { + return zFoo; + })).describe('This is baz property.').optional(), + qux: z.number().int().gt(0).describe('This is qux property.').optional().default(0) }), z.null() -]), null); +]).default(null); -export const zBaz = z._default(z.readonly(z.string().check(z.regex(/foo\nbar/))), 'baz'); +export const zBaz = z.string().regex(/foo\nbar/).readonly().default('baz'); -export const zQux = z.record(z.string(), z.object({ - qux: z.optional(z.string()) +export const zQux = z.record(z.object({ + qux: z.string().optional() })); /** * This is Foo parameter. */ -export const zFoo2 = z.string().register(z.globalRegistry, { - description: 'This is Foo parameter.' -}); +export const zFoo2 = z.string().describe('This is Foo parameter.'); export const zFoo3 = z.object({ - foo: z.optional(zBar) + foo: zBar.optional() }); export const zPatchFooData = z.object({ body: z.object({ - foo: z.optional(z.string()) + foo: z.string().optional() }), - path: z.optional(z.never()), - query: z.optional(z.object({ - foo: z.optional(z.string().register(z.globalRegistry, { - description: 'This is Foo parameter.' - })), - bar: z.optional(zBar), - baz: z.optional(z.object({ - baz: z.optional(z.string()) - })), - qux: z.optional(z.iso.date()), - quux: z.optional(z.iso.datetime()) - })) + path: z.never().optional(), + query: z.object({ + foo: z.string().describe('This is Foo parameter.').optional(), + bar: zBar.optional(), + baz: z.object({ + baz: z.string().optional() + }).optional(), + qux: z.string().date().optional(), + quux: z.string().datetime().optional() + }).optional() }); export const zPostFooData = z.object({ body: zFoo3, - path: z.optional(z.never()), - query: z.optional(z.never()) + path: z.never().optional(), + query: z.never().optional() }); \ No newline at end of file diff --git a/packages/openapi-ts-tests/zod/v3/__snapshots__/3.1.x/mini/validators-types/zod.gen.ts b/packages/openapi-ts-tests/zod/v3/__snapshots__/3.1.x/mini/validators-types/zod.gen.ts index d3893c43c..f8adb5f3f 100644 --- a/packages/openapi-ts-tests/zod/v3/__snapshots__/3.1.x/mini/validators-types/zod.gen.ts +++ b/packages/openapi-ts-tests/zod/v3/__snapshots__/3.1.x/mini/validators-types/zod.gen.ts @@ -1,82 +1,64 @@ // This file is auto-generated by @hey-api/openapi-ts -import * as z from 'zod/v4-mini'; +import { z } from 'zod'; /** * This is Bar schema. */ -export const zBar = z.object({ - get foo(): z.ZodMiniOptional { - return z.optional(zFoo); - } +export const zBar: z.AnyZodObject = z.object({ + foo: z.lazy(() => { + return zFoo; + }).optional() }); -export type BarZodType = z.infer; - /** * This is Foo schema. */ -export const zFoo = z._default(z.union([ +export const zFoo: z.ZodTypeAny = z.union([ z.object({ - foo: z.optional(z.string().check(z.regex(/^\d{3}-\d{2}-\d{4}$/))), - bar: z.optional(zBar), - get baz(): z.ZodMiniOptional { - return z.optional(z.array(z.lazy((): any => { - return zFoo; - }))); - }, - qux: z._default(z.optional(z.int().check(z.gt(0))), 0) + foo: z.string().regex(/^\d{3}-\d{2}-\d{4}$/).optional(), + bar: zBar.optional(), + baz: z.array(z.lazy(() => { + return zFoo; + })).optional(), + qux: z.number().int().gt(0).optional().default(0) }), z.null() -]), null); - -export type FooZodType = z.infer; - -export const zBaz = z._default(z.readonly(z.string().check(z.regex(/foo\nbar/))), 'baz'); +]).default(null); -export type BazZodType = z.infer; +export const zBaz = z.string().regex(/foo\nbar/).readonly().default('baz'); -export const zQux = z.record(z.string(), z.object({ - qux: z.optional(z.string()) +export const zQux = z.record(z.object({ + qux: z.string().optional() })); -export type QuxZodType = z.infer; - /** * This is Foo parameter. */ export const zFoo2 = z.string(); -export type FooZodType2 = z.infer; - export const zFoo3 = z.object({ - foo: z.optional(zBar) + foo: zBar.optional() }); -export type FooZodType3 = z.infer; - export const zPatchFooData = z.object({ body: z.object({ - foo: z.optional(z.string()) + foo: z.string().optional() }), - path: z.optional(z.never()), - query: z.optional(z.object({ - foo: z.optional(z.string()), - bar: z.optional(zBar), - baz: z.optional(z.object({ - baz: z.optional(z.string()) - })), - qux: z.optional(z.iso.date()), - quux: z.optional(z.iso.datetime()) - })) + path: z.never().optional(), + query: z.object({ + foo: z.string().optional(), + bar: zBar.optional(), + baz: z.object({ + baz: z.string().optional() + }).optional(), + qux: z.string().date().optional(), + quux: z.string().datetime().optional() + }).optional() }); -export type PatchFooDataZodType = z.infer; - export const zPostFooData = z.object({ body: zFoo3, - path: z.optional(z.never()), - query: z.optional(z.never()) -}); - -export type PostFooDataZodType = z.infer; \ No newline at end of file + path: z.never().optional(), + query: z.never().optional() +}); \ No newline at end of file diff --git a/packages/openapi-ts-tests/zod/v3/__snapshots__/3.1.x/mini/validators-union-merge/zod.gen.ts b/packages/openapi-ts-tests/zod/v3/__snapshots__/3.1.x/mini/validators-union-merge/zod.gen.ts index 11e304b1b..2a9dd621f 100644 --- a/packages/openapi-ts-tests/zod/v3/__snapshots__/3.1.x/mini/validators-union-merge/zod.gen.ts +++ b/packages/openapi-ts-tests/zod/v3/__snapshots__/3.1.x/mini/validators-union-merge/zod.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import * as z from 'zod/v4-mini'; +import { z } from 'zod'; export const zContact = z.union([ z.object({ @@ -11,13 +11,13 @@ export const zContact = z.union([ }) ]); -export const zUser = z.intersection(zContact, z.object({ +export const zUser = zContact.and(z.object({ username: z.string() })); export const zDogDetails = z.object({ breed: z.string(), - barkVolume: z.int().check(z.gte(1), z.lte(10)) + barkVolume: z.number().int().gte(1).lte(10) }); export const zCatDetails = z.object({ @@ -32,10 +32,10 @@ export const zCatDetails = z.object({ export const zPetStore = z.object({ animals: z.array(z.object({ name: z.string(), - type: z.optional(z.enum([ + type: z.enum([ 'dog', 'cat' - ])), + ]).optional(), details: z.union([ zDogDetails, zCatDetails diff --git a/packages/openapi-ts-tests/zod/v3/__snapshots__/3.1.x/mini/validators/zod.gen.ts b/packages/openapi-ts-tests/zod/v3/__snapshots__/3.1.x/mini/validators/zod.gen.ts index 0fa87bffe..f8adb5f3f 100644 --- a/packages/openapi-ts-tests/zod/v3/__snapshots__/3.1.x/mini/validators/zod.gen.ts +++ b/packages/openapi-ts-tests/zod/v3/__snapshots__/3.1.x/mini/validators/zod.gen.ts @@ -1,37 +1,35 @@ // This file is auto-generated by @hey-api/openapi-ts -import * as z from 'zod/v4-mini'; +import { z } from 'zod'; /** * This is Bar schema. */ -export const zBar = z.object({ - get foo(): z.ZodMiniOptional { - return z.optional(zFoo); - } +export const zBar: z.AnyZodObject = z.object({ + foo: z.lazy(() => { + return zFoo; + }).optional() }); /** * This is Foo schema. */ -export const zFoo = z._default(z.union([ +export const zFoo: z.ZodTypeAny = z.union([ z.object({ - foo: z.optional(z.string().check(z.regex(/^\d{3}-\d{2}-\d{4}$/))), - bar: z.optional(zBar), - get baz(): z.ZodMiniOptional { - return z.optional(z.array(z.lazy((): any => { - return zFoo; - }))); - }, - qux: z._default(z.optional(z.int().check(z.gt(0))), 0) + foo: z.string().regex(/^\d{3}-\d{2}-\d{4}$/).optional(), + bar: zBar.optional(), + baz: z.array(z.lazy(() => { + return zFoo; + })).optional(), + qux: z.number().int().gt(0).optional().default(0) }), z.null() -]), null); +]).default(null); -export const zBaz = z._default(z.readonly(z.string().check(z.regex(/foo\nbar/))), 'baz'); +export const zBaz = z.string().regex(/foo\nbar/).readonly().default('baz'); -export const zQux = z.record(z.string(), z.object({ - qux: z.optional(z.string()) +export const zQux = z.record(z.object({ + qux: z.string().optional() })); /** @@ -40,27 +38,27 @@ export const zQux = z.record(z.string(), z.object({ export const zFoo2 = z.string(); export const zFoo3 = z.object({ - foo: z.optional(zBar) + foo: zBar.optional() }); export const zPatchFooData = z.object({ body: z.object({ - foo: z.optional(z.string()) + foo: z.string().optional() }), - path: z.optional(z.never()), - query: z.optional(z.object({ - foo: z.optional(z.string()), - bar: z.optional(zBar), - baz: z.optional(z.object({ - baz: z.optional(z.string()) - })), - qux: z.optional(z.iso.date()), - quux: z.optional(z.iso.datetime()) - })) + path: z.never().optional(), + query: z.object({ + foo: z.string().optional(), + bar: zBar.optional(), + baz: z.object({ + baz: z.string().optional() + }).optional(), + qux: z.string().date().optional(), + quux: z.string().datetime().optional() + }).optional() }); export const zPostFooData = z.object({ body: zFoo3, - path: z.optional(z.never()), - query: z.optional(z.never()) + path: z.never().optional(), + query: z.never().optional() }); \ No newline at end of file diff --git a/packages/openapi-ts-tests/zod/v3/__snapshots__/3.1.x/v3/validators-types/zod.gen.ts b/packages/openapi-ts-tests/zod/v3/__snapshots__/3.1.x/v3/validators-types/zod.gen.ts index 1a96490b6..f8adb5f3f 100644 --- a/packages/openapi-ts-tests/zod/v3/__snapshots__/3.1.x/v3/validators-types/zod.gen.ts +++ b/packages/openapi-ts-tests/zod/v3/__snapshots__/3.1.x/v3/validators-types/zod.gen.ts @@ -11,8 +11,6 @@ export const zBar: z.AnyZodObject = z.object({ }).optional() }); -export type BarZodType = z.infer; - /** * This is Foo schema. */ @@ -28,31 +26,21 @@ export const zFoo: z.ZodTypeAny = z.union([ z.null() ]).default(null); -export type FooZodType = z.infer; - export const zBaz = z.string().regex(/foo\nbar/).readonly().default('baz'); -export type BazZodType = z.infer; - export const zQux = z.record(z.object({ qux: z.string().optional() })); -export type QuxZodType = z.infer; - /** * This is Foo parameter. */ export const zFoo2 = z.string(); -export type FooZodType2 = z.infer; - export const zFoo3 = z.object({ foo: zBar.optional() }); -export type FooZodType3 = z.infer; - export const zPatchFooData = z.object({ body: z.object({ foo: z.string().optional() @@ -69,12 +57,8 @@ export const zPatchFooData = z.object({ }).optional() }); -export type PatchFooDataZodType = z.infer; - export const zPostFooData = z.object({ body: zFoo3, path: z.never().optional(), query: z.never().optional() -}); - -export type PostFooDataZodType = z.infer; \ No newline at end of file +}); \ No newline at end of file diff --git a/packages/openapi-ts-tests/zod/v3/__snapshots__/3.1.x/v4/array-items-one-of-length-1/zod.gen.ts b/packages/openapi-ts-tests/zod/v3/__snapshots__/3.1.x/v4/array-items-one-of-length-1/zod.gen.ts index ea9d76fb3..91997b20b 100644 --- a/packages/openapi-ts-tests/zod/v3/__snapshots__/3.1.x/v4/array-items-one-of-length-1/zod.gen.ts +++ b/packages/openapi-ts-tests/zod/v3/__snapshots__/3.1.x/v4/array-items-one-of-length-1/zod.gen.ts @@ -1,9 +1,9 @@ // This file is auto-generated by @hey-api/openapi-ts -import { z } from 'zod/v4'; +import { z } from 'zod'; export const zBar = z.string(); export const zFoo = z.object({ - foo: z.optional(z.array(zBar).min(1).max(2147483647)) + foo: z.array(zBar).min(1).max(2147483647).optional() }); \ No newline at end of file diff --git a/packages/openapi-ts-tests/zod/v3/__snapshots__/3.1.x/v4/enum-null/zod.gen.ts b/packages/openapi-ts-tests/zod/v3/__snapshots__/3.1.x/v4/enum-null/zod.gen.ts index ac6994702..2b8373603 100644 --- a/packages/openapi-ts-tests/zod/v3/__snapshots__/3.1.x/v4/enum-null/zod.gen.ts +++ b/packages/openapi-ts-tests/zod/v3/__snapshots__/3.1.x/v4/enum-null/zod.gen.ts @@ -1,11 +1,11 @@ // This file is auto-generated by @hey-api/openapi-ts -import { z } from 'zod/v4'; +import { z } from 'zod'; -export const zFoo = z.nullable(z.enum([ +export const zFoo = z.enum([ 'foo', 'bar' -])); +]).nullable(); export const zBar = z.enum([ 'foo', diff --git a/packages/openapi-ts-tests/zod/v3/__snapshots__/3.1.x/v4/schema-const/zod.gen.ts b/packages/openapi-ts-tests/zod/v3/__snapshots__/3.1.x/v4/schema-const/zod.gen.ts index ee6fdf50e..a7aad3761 100644 --- a/packages/openapi-ts-tests/zod/v3/__snapshots__/3.1.x/v4/schema-const/zod.gen.ts +++ b/packages/openapi-ts-tests/zod/v3/__snapshots__/3.1.x/v4/schema-const/zod.gen.ts @@ -1,37 +1,37 @@ // This file is auto-generated by @hey-api/openapi-ts -import { z } from 'zod/v4'; +import { z } from 'zod'; export const zFoo = z.object({ - foo: z.optional(z.literal('foo')), - bar: z.optional(z.literal(3.2)), - baz: z.optional(z.literal(-1)), - qux: z.optional(z.literal(true)), - quux: z.optional(z.tuple([ + foo: z.literal('foo').optional(), + bar: z.literal(3.2).optional(), + baz: z.literal(-1).optional(), + qux: z.literal(true).optional(), + quux: z.tuple([ z.literal(1), z.literal(2), z.literal(3), z.literal('foo'), z.literal(true) - ])), - corge: z.optional(z.object({})), - garply: z.optional(z.coerce.bigint()), - numberInt8: z.optional(z.literal(100)), - numberInt16: z.optional(z.literal(1000)), - numberInt32: z.optional(z.literal(100000)), - numberInt64: z.optional(z.literal(1000000000000)), - numberUint8: z.optional(z.literal(200)), - numberUint16: z.optional(z.literal(50000)), - numberUint32: z.optional(z.literal(3000000000)), - numberUint64: z.optional(z.literal(18000000000000000000)), - integerInt8: z.optional(z.literal(-100)), - integerInt16: z.optional(z.literal(-1000)), - integerInt32: z.optional(z.literal(-100000)), - integerInt64: z.optional(z.literal(-1000000000000)), - integerUint8: z.optional(z.literal(255)), - integerUint16: z.optional(z.literal(65535)), - integerUint32: z.optional(z.literal(4294967295)), - integerUint64: z.optional(z.int()), - stringInt64: z.optional(z.literal('-9223372036854775808')), - stringUint64: z.optional(z.literal('18446744073709551615')) + ]).optional(), + corge: z.object({}).optional(), + garply: z.coerce.bigint().optional(), + numberInt8: z.literal(100).optional(), + numberInt16: z.literal(1000).optional(), + numberInt32: z.literal(100000).optional(), + numberInt64: z.literal(1000000000000).optional(), + numberUint8: z.literal(200).optional(), + numberUint16: z.literal(50000).optional(), + numberUint32: z.literal(3000000000).optional(), + numberUint64: z.literal(18000000000000000000).optional(), + integerInt8: z.literal(-100).optional(), + integerInt16: z.literal(-1000).optional(), + integerInt32: z.literal(-100000).optional(), + integerInt64: z.literal(-1000000000000).optional(), + integerUint8: z.literal(255).optional(), + integerUint16: z.literal(65535).optional(), + integerUint32: z.literal(4294967295).optional(), + integerUint64: z.number().int().optional(), + stringInt64: z.literal('-9223372036854775808').optional(), + stringUint64: z.literal('18446744073709551615').optional() }); \ No newline at end of file diff --git a/packages/openapi-ts-tests/zod/v3/__snapshots__/3.1.x/v4/validators-bigint-min-max/zod.gen.ts b/packages/openapi-ts-tests/zod/v3/__snapshots__/3.1.x/v4/validators-bigint-min-max/zod.gen.ts index 087712a4d..cbd60cb15 100644 --- a/packages/openapi-ts-tests/zod/v3/__snapshots__/3.1.x/v4/validators-bigint-min-max/zod.gen.ts +++ b/packages/openapi-ts-tests/zod/v3/__snapshots__/3.1.x/v4/validators-bigint-min-max/zod.gen.ts @@ -1,7 +1,7 @@ // This file is auto-generated by @hey-api/openapi-ts -import { z } from 'zod/v4'; +import { z } from 'zod'; export const zFoo = z.object({ - foo: z.optional(z.coerce.bigint().gte(BigInt(0)).lte(BigInt(100))) + foo: z.coerce.bigint().gte(BigInt(0)).lte(BigInt(100)).optional() }); \ No newline at end of file diff --git a/packages/openapi-ts-tests/zod/v3/__snapshots__/3.1.x/v4/validators-circular-ref-2/zod.gen.ts b/packages/openapi-ts-tests/zod/v3/__snapshots__/3.1.x/v4/validators-circular-ref-2/zod.gen.ts index d67b3c1cd..fe5c68cc8 100644 --- a/packages/openapi-ts-tests/zod/v3/__snapshots__/3.1.x/v4/validators-circular-ref-2/zod.gen.ts +++ b/packages/openapi-ts-tests/zod/v3/__snapshots__/3.1.x/v4/validators-circular-ref-2/zod.gen.ts @@ -1,16 +1,16 @@ // This file is auto-generated by @hey-api/openapi-ts -import { z } from 'zod/v4'; +import { z } from 'zod'; -export const zBar = z.object({ +export const zBar: z.AnyZodObject = z.object({ bar: z.union([ - z.array(z.lazy((): any => { + z.array(z.lazy(() => { return zBar; })), z.null() ]) }); -export const zFoo = z.object({ +export const zFoo: z.AnyZodObject = z.object({ foo: zBar }); \ No newline at end of file diff --git a/packages/openapi-ts-tests/zod/v3/__snapshots__/3.1.x/v4/validators-circular-ref/zod.gen.ts b/packages/openapi-ts-tests/zod/v3/__snapshots__/3.1.x/v4/validators-circular-ref/zod.gen.ts index 0d3e704cb..9ed4452c1 100644 --- a/packages/openapi-ts-tests/zod/v3/__snapshots__/3.1.x/v4/validators-circular-ref/zod.gen.ts +++ b/packages/openapi-ts-tests/zod/v3/__snapshots__/3.1.x/v4/validators-circular-ref/zod.gen.ts @@ -1,24 +1,22 @@ // This file is auto-generated by @hey-api/openapi-ts -import { z } from 'zod/v4'; +import { z } from 'zod'; -export const zBar = z.object({ - get bar(): z.ZodOptional { - return z.optional(z.array(z.lazy((): any => { - return zBar; - }))); - } +export const zBar: z.AnyZodObject = z.object({ + bar: z.array(z.lazy(() => { + return zBar; + })).optional() }); -export const zFoo = z.object({ - foo: z.optional(zBar) +export const zFoo: z.AnyZodObject = z.object({ + foo: zBar.optional() }); /** * description caused circular reference error */ -export const zQux = z.lazy((): any => { +export const zQux: z.ZodTypeAny = z.lazy(() => { return zQux; }); -export const zBaz = zQux; \ No newline at end of file +export const zBaz: z.ZodTypeAny = zQux; \ No newline at end of file diff --git a/packages/openapi-ts-tests/zod/v3/__snapshots__/3.1.x/v4/validators-dates/zod.gen.ts b/packages/openapi-ts-tests/zod/v3/__snapshots__/3.1.x/v4/validators-dates/zod.gen.ts index b65fa7128..7d3bc1d19 100644 --- a/packages/openapi-ts-tests/zod/v3/__snapshots__/3.1.x/v4/validators-dates/zod.gen.ts +++ b/packages/openapi-ts-tests/zod/v3/__snapshots__/3.1.x/v4/validators-dates/zod.gen.ts @@ -1,37 +1,35 @@ // This file is auto-generated by @hey-api/openapi-ts -import { z } from 'zod/v4'; +import { z } from 'zod'; /** * This is Bar schema. */ -export const zBar = z.object({ - get foo(): z.ZodOptional { - return z.optional(zFoo); - } +export const zBar: z.AnyZodObject = z.object({ + foo: z.lazy(() => { + return zFoo; + }).optional() }); /** * This is Foo schema. */ -export const zFoo = z.union([ +export const zFoo: z.ZodTypeAny = z.union([ z.object({ - foo: z.optional(z.string().regex(/^\d{3}-\d{2}-\d{4}$/)), - bar: z.optional(zBar), - get baz(): z.ZodOptional { - return z.optional(z.array(z.lazy((): any => { - return zFoo; - }))); - }, - qux: z.optional(z.int().gt(0)).default(0) + foo: z.string().regex(/^\d{3}-\d{2}-\d{4}$/).optional(), + bar: zBar.optional(), + baz: z.array(z.lazy(() => { + return zFoo; + })).optional(), + qux: z.number().int().gt(0).optional().default(0) }), z.null() ]).default(null); export const zBaz = z.string().regex(/foo\nbar/).readonly().default('baz'); -export const zQux = z.record(z.string(), z.object({ - qux: z.optional(z.string()) +export const zQux = z.record(z.object({ + qux: z.string().optional() })); /** @@ -40,29 +38,29 @@ export const zQux = z.record(z.string(), z.object({ export const zFoo2 = z.string(); export const zFoo3 = z.object({ - foo: z.optional(zBar) + foo: zBar.optional() }); export const zPatchFooData = z.object({ body: z.object({ - foo: z.optional(z.string()) + foo: z.string().optional() }), - path: z.optional(z.never()), - query: z.optional(z.object({ - foo: z.optional(z.string()), - bar: z.optional(zBar), - baz: z.optional(z.object({ - baz: z.optional(z.string()) - })), - qux: z.optional(z.iso.date()), - quux: z.optional(z.iso.datetime({ + path: z.never().optional(), + query: z.object({ + foo: z.string().optional(), + bar: zBar.optional(), + baz: z.object({ + baz: z.string().optional() + }).optional(), + qux: z.string().date().optional(), + quux: z.string().datetime({ offset: true - })) - })) + }).optional() + }).optional() }); export const zPostFooData = z.object({ body: zFoo3, - path: z.optional(z.never()), - query: z.optional(z.never()) + path: z.never().optional(), + query: z.never().optional() }); \ No newline at end of file diff --git a/packages/openapi-ts-tests/zod/v3/__snapshots__/3.1.x/v4/validators-metadata/zod.gen.ts b/packages/openapi-ts-tests/zod/v3/__snapshots__/3.1.x/v4/validators-metadata/zod.gen.ts index 1d6c9f57e..b269940da 100644 --- a/packages/openapi-ts-tests/zod/v3/__snapshots__/3.1.x/v4/validators-metadata/zod.gen.ts +++ b/packages/openapi-ts-tests/zod/v3/__snapshots__/3.1.x/v4/validators-metadata/zod.gen.ts @@ -1,78 +1,64 @@ // This file is auto-generated by @hey-api/openapi-ts -import { z } from 'zod/v4'; +import { z } from 'zod'; /** * This is Bar schema. */ -export const zBar = z.object({ - get foo(): z.ZodOptional { - return z.optional(zFoo); - } -}).register(z.globalRegistry, { - description: 'This is Bar schema.' -}); +export const zBar: z.AnyZodObject = z.object({ + foo: z.lazy(() => { + return zFoo; + }).optional() +}).describe('This is Bar schema.'); /** * This is Foo schema. */ -export const zFoo = z.union([ +export const zFoo: z.ZodTypeAny = z.union([ z.object({ - foo: z.optional(z.string().regex(/^\d{3}-\d{2}-\d{4}$/).register(z.globalRegistry, { - description: 'This is foo property.' - })), - bar: z.optional(zBar), - get baz(): z.ZodOptional { - return z.optional(z.array(z.lazy((): any => { - return zFoo; - })).register(z.globalRegistry, { - description: 'This is baz property.' - })); - }, - qux: z.optional(z.int().gt(0).register(z.globalRegistry, { - description: 'This is qux property.' - })).default(0) + foo: z.string().regex(/^\d{3}-\d{2}-\d{4}$/).describe('This is foo property.').optional(), + bar: zBar.optional(), + baz: z.array(z.lazy(() => { + return zFoo; + })).describe('This is baz property.').optional(), + qux: z.number().int().gt(0).describe('This is qux property.').optional().default(0) }), z.null() ]).default(null); export const zBaz = z.string().regex(/foo\nbar/).readonly().default('baz'); -export const zQux = z.record(z.string(), z.object({ - qux: z.optional(z.string()) +export const zQux = z.record(z.object({ + qux: z.string().optional() })); /** * This is Foo parameter. */ -export const zFoo2 = z.string().register(z.globalRegistry, { - description: 'This is Foo parameter.' -}); +export const zFoo2 = z.string().describe('This is Foo parameter.'); export const zFoo3 = z.object({ - foo: z.optional(zBar) + foo: zBar.optional() }); export const zPatchFooData = z.object({ body: z.object({ - foo: z.optional(z.string()) + foo: z.string().optional() }), - path: z.optional(z.never()), - query: z.optional(z.object({ - foo: z.optional(z.string().register(z.globalRegistry, { - description: 'This is Foo parameter.' - })), - bar: z.optional(zBar), - baz: z.optional(z.object({ - baz: z.optional(z.string()) - })), - qux: z.optional(z.iso.date()), - quux: z.optional(z.iso.datetime()) - })) + path: z.never().optional(), + query: z.object({ + foo: z.string().describe('This is Foo parameter.').optional(), + bar: zBar.optional(), + baz: z.object({ + baz: z.string().optional() + }).optional(), + qux: z.string().date().optional(), + quux: z.string().datetime().optional() + }).optional() }); export const zPostFooData = z.object({ body: zFoo3, - path: z.optional(z.never()), - query: z.optional(z.never()) + path: z.never().optional(), + query: z.never().optional() }); \ No newline at end of file diff --git a/packages/openapi-ts-tests/zod/v3/__snapshots__/3.1.x/v4/validators-types/zod.gen.ts b/packages/openapi-ts-tests/zod/v3/__snapshots__/3.1.x/v4/validators-types/zod.gen.ts index 2b9fd480e..f8adb5f3f 100644 --- a/packages/openapi-ts-tests/zod/v3/__snapshots__/3.1.x/v4/validators-types/zod.gen.ts +++ b/packages/openapi-ts-tests/zod/v3/__snapshots__/3.1.x/v4/validators-types/zod.gen.ts @@ -1,82 +1,64 @@ // This file is auto-generated by @hey-api/openapi-ts -import { z } from 'zod/v4'; +import { z } from 'zod'; /** * This is Bar schema. */ -export const zBar = z.object({ - get foo(): z.ZodOptional { - return z.optional(zFoo); - } +export const zBar: z.AnyZodObject = z.object({ + foo: z.lazy(() => { + return zFoo; + }).optional() }); -export type BarZodType = z.infer; - /** * This is Foo schema. */ -export const zFoo = z.union([ +export const zFoo: z.ZodTypeAny = z.union([ z.object({ - foo: z.optional(z.string().regex(/^\d{3}-\d{2}-\d{4}$/)), - bar: z.optional(zBar), - get baz(): z.ZodOptional { - return z.optional(z.array(z.lazy((): any => { - return zFoo; - }))); - }, - qux: z.optional(z.int().gt(0)).default(0) + foo: z.string().regex(/^\d{3}-\d{2}-\d{4}$/).optional(), + bar: zBar.optional(), + baz: z.array(z.lazy(() => { + return zFoo; + })).optional(), + qux: z.number().int().gt(0).optional().default(0) }), z.null() ]).default(null); -export type FooZodType = z.infer; - export const zBaz = z.string().regex(/foo\nbar/).readonly().default('baz'); -export type BazZodType = z.infer; - -export const zQux = z.record(z.string(), z.object({ - qux: z.optional(z.string()) +export const zQux = z.record(z.object({ + qux: z.string().optional() })); -export type QuxZodType = z.infer; - /** * This is Foo parameter. */ export const zFoo2 = z.string(); -export type FooZodType2 = z.infer; - export const zFoo3 = z.object({ - foo: z.optional(zBar) + foo: zBar.optional() }); -export type FooZodType3 = z.infer; - export const zPatchFooData = z.object({ body: z.object({ - foo: z.optional(z.string()) + foo: z.string().optional() }), - path: z.optional(z.never()), - query: z.optional(z.object({ - foo: z.optional(z.string()), - bar: z.optional(zBar), - baz: z.optional(z.object({ - baz: z.optional(z.string()) - })), - qux: z.optional(z.iso.date()), - quux: z.optional(z.iso.datetime()) - })) + path: z.never().optional(), + query: z.object({ + foo: z.string().optional(), + bar: zBar.optional(), + baz: z.object({ + baz: z.string().optional() + }).optional(), + qux: z.string().date().optional(), + quux: z.string().datetime().optional() + }).optional() }); -export type PatchFooDataZodType = z.infer; - export const zPostFooData = z.object({ body: zFoo3, - path: z.optional(z.never()), - query: z.optional(z.never()) -}); - -export type PostFooDataZodType = z.infer; \ No newline at end of file + path: z.never().optional(), + query: z.never().optional() +}); \ No newline at end of file diff --git a/packages/openapi-ts-tests/zod/v3/__snapshots__/3.1.x/v4/validators-union-merge/zod.gen.ts b/packages/openapi-ts-tests/zod/v3/__snapshots__/3.1.x/v4/validators-union-merge/zod.gen.ts index 41f1b60c9..2a9dd621f 100644 --- a/packages/openapi-ts-tests/zod/v3/__snapshots__/3.1.x/v4/validators-union-merge/zod.gen.ts +++ b/packages/openapi-ts-tests/zod/v3/__snapshots__/3.1.x/v4/validators-union-merge/zod.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import { z } from 'zod/v4'; +import { z } from 'zod'; export const zContact = z.union([ z.object({ @@ -17,7 +17,7 @@ export const zUser = zContact.and(z.object({ export const zDogDetails = z.object({ breed: z.string(), - barkVolume: z.int().gte(1).lte(10) + barkVolume: z.number().int().gte(1).lte(10) }); export const zCatDetails = z.object({ @@ -32,10 +32,10 @@ export const zCatDetails = z.object({ export const zPetStore = z.object({ animals: z.array(z.object({ name: z.string(), - type: z.optional(z.enum([ + type: z.enum([ 'dog', 'cat' - ])), + ]).optional(), details: z.union([ zDogDetails, zCatDetails diff --git a/packages/openapi-ts-tests/zod/v3/__snapshots__/3.1.x/v4/validators/zod.gen.ts b/packages/openapi-ts-tests/zod/v3/__snapshots__/3.1.x/v4/validators/zod.gen.ts index e93af974b..f8adb5f3f 100644 --- a/packages/openapi-ts-tests/zod/v3/__snapshots__/3.1.x/v4/validators/zod.gen.ts +++ b/packages/openapi-ts-tests/zod/v3/__snapshots__/3.1.x/v4/validators/zod.gen.ts @@ -1,37 +1,35 @@ // This file is auto-generated by @hey-api/openapi-ts -import { z } from 'zod/v4'; +import { z } from 'zod'; /** * This is Bar schema. */ -export const zBar = z.object({ - get foo(): z.ZodOptional { - return z.optional(zFoo); - } +export const zBar: z.AnyZodObject = z.object({ + foo: z.lazy(() => { + return zFoo; + }).optional() }); /** * This is Foo schema. */ -export const zFoo = z.union([ +export const zFoo: z.ZodTypeAny = z.union([ z.object({ - foo: z.optional(z.string().regex(/^\d{3}-\d{2}-\d{4}$/)), - bar: z.optional(zBar), - get baz(): z.ZodOptional { - return z.optional(z.array(z.lazy((): any => { - return zFoo; - }))); - }, - qux: z.optional(z.int().gt(0)).default(0) + foo: z.string().regex(/^\d{3}-\d{2}-\d{4}$/).optional(), + bar: zBar.optional(), + baz: z.array(z.lazy(() => { + return zFoo; + })).optional(), + qux: z.number().int().gt(0).optional().default(0) }), z.null() ]).default(null); export const zBaz = z.string().regex(/foo\nbar/).readonly().default('baz'); -export const zQux = z.record(z.string(), z.object({ - qux: z.optional(z.string()) +export const zQux = z.record(z.object({ + qux: z.string().optional() })); /** @@ -40,27 +38,27 @@ export const zQux = z.record(z.string(), z.object({ export const zFoo2 = z.string(); export const zFoo3 = z.object({ - foo: z.optional(zBar) + foo: zBar.optional() }); export const zPatchFooData = z.object({ body: z.object({ - foo: z.optional(z.string()) + foo: z.string().optional() }), - path: z.optional(z.never()), - query: z.optional(z.object({ - foo: z.optional(z.string()), - bar: z.optional(zBar), - baz: z.optional(z.object({ - baz: z.optional(z.string()) - })), - qux: z.optional(z.iso.date()), - quux: z.optional(z.iso.datetime()) - })) + path: z.never().optional(), + query: z.object({ + foo: z.string().optional(), + bar: zBar.optional(), + baz: z.object({ + baz: z.string().optional() + }).optional(), + qux: z.string().date().optional(), + quux: z.string().datetime().optional() + }).optional() }); export const zPostFooData = z.object({ body: zFoo3, - path: z.optional(z.never()), - query: z.optional(z.never()) + path: z.never().optional(), + query: z.never().optional() }); \ No newline at end of file diff --git a/packages/openapi-ts-tests/zod/v4/__snapshots__/3.0.x/mini/array-items-one-of-length-1/zod.gen.ts b/packages/openapi-ts-tests/zod/v4/__snapshots__/3.0.x/mini/array-items-one-of-length-1/zod.gen.ts index c28387394..91997b20b 100644 --- a/packages/openapi-ts-tests/zod/v4/__snapshots__/3.0.x/mini/array-items-one-of-length-1/zod.gen.ts +++ b/packages/openapi-ts-tests/zod/v4/__snapshots__/3.0.x/mini/array-items-one-of-length-1/zod.gen.ts @@ -1,9 +1,9 @@ // This file is auto-generated by @hey-api/openapi-ts -import * as z from 'zod/mini'; +import { z } from 'zod'; export const zBar = z.string(); export const zFoo = z.object({ - foo: z.optional(z.array(zBar).check(z.minLength(1), z.maxLength(2147483647))) + foo: z.array(zBar).min(1).max(2147483647).optional() }); \ No newline at end of file diff --git a/packages/openapi-ts-tests/zod/v4/__snapshots__/3.0.x/mini/enum-null/zod.gen.ts b/packages/openapi-ts-tests/zod/v4/__snapshots__/3.0.x/mini/enum-null/zod.gen.ts index 084c93ee0..2b8373603 100644 --- a/packages/openapi-ts-tests/zod/v4/__snapshots__/3.0.x/mini/enum-null/zod.gen.ts +++ b/packages/openapi-ts-tests/zod/v4/__snapshots__/3.0.x/mini/enum-null/zod.gen.ts @@ -1,11 +1,11 @@ // This file is auto-generated by @hey-api/openapi-ts -import * as z from 'zod/mini'; +import { z } from 'zod'; -export const zFoo = z.nullable(z.enum([ +export const zFoo = z.enum([ 'foo', 'bar' -])); +]).nullable(); export const zBar = z.enum([ 'foo', diff --git a/packages/openapi-ts-tests/zod/v4/__snapshots__/3.0.x/mini/validators/zod.gen.ts b/packages/openapi-ts-tests/zod/v4/__snapshots__/3.0.x/mini/validators/zod.gen.ts index 343657678..f4142d499 100644 --- a/packages/openapi-ts-tests/zod/v4/__snapshots__/3.0.x/mini/validators/zod.gen.ts +++ b/packages/openapi-ts-tests/zod/v4/__snapshots__/3.0.x/mini/validators/zod.gen.ts @@ -1,25 +1,23 @@ // This file is auto-generated by @hey-api/openapi-ts -import * as z from 'zod/mini'; +import { z } from 'zod'; -export const zBar = z.object({ - get foo(): z.ZodMiniOptional { - return z.optional(zFoo); - } +export const zBar: z.AnyZodObject = z.object({ + foo: z.lazy(() => { + return zFoo; + }).optional() }); -export const zFoo = z._default(z.union([ +export const zFoo: z.ZodTypeAny = z.union([ z.object({ - foo: z.optional(z.string().check(z.regex(/^\d{3}-\d{2}-\d{4}$/))), - bar: z.optional(zBar), - get baz(): z.ZodMiniOptional { - return z.optional(z.array(z.lazy((): any => { - return zFoo; - }))); - }, - qux: z._default(z.optional(z.int().check(z.gt(0))), 0) + foo: z.string().regex(/^\d{3}-\d{2}-\d{4}$/).optional(), + bar: zBar.optional(), + baz: z.array(z.lazy(() => { + return zFoo; + })).optional(), + qux: z.number().int().gt(0).optional().default(0) }), z.null() -]), null); +]).default(null); -export const zBaz = z._default(z.readonly(z.string().check(z.regex(/foo\nbar/))), 'baz'); \ No newline at end of file +export const zBaz = z.string().regex(/foo\nbar/).readonly().default('baz'); \ No newline at end of file diff --git a/packages/openapi-ts-tests/zod/v4/__snapshots__/3.0.x/v3/array-items-one-of-length-1/zod.gen.ts b/packages/openapi-ts-tests/zod/v4/__snapshots__/3.0.x/v3/array-items-one-of-length-1/zod.gen.ts index d6e23fb2f..91997b20b 100644 --- a/packages/openapi-ts-tests/zod/v4/__snapshots__/3.0.x/v3/array-items-one-of-length-1/zod.gen.ts +++ b/packages/openapi-ts-tests/zod/v4/__snapshots__/3.0.x/v3/array-items-one-of-length-1/zod.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import { z } from 'zod/v3'; +import { z } from 'zod'; export const zBar = z.string(); diff --git a/packages/openapi-ts-tests/zod/v4/__snapshots__/3.0.x/v3/enum-null/zod.gen.ts b/packages/openapi-ts-tests/zod/v4/__snapshots__/3.0.x/v3/enum-null/zod.gen.ts index b3477bf27..2b8373603 100644 --- a/packages/openapi-ts-tests/zod/v4/__snapshots__/3.0.x/v3/enum-null/zod.gen.ts +++ b/packages/openapi-ts-tests/zod/v4/__snapshots__/3.0.x/v3/enum-null/zod.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import { z } from 'zod/v3'; +import { z } from 'zod'; export const zFoo = z.enum([ 'foo', diff --git a/packages/openapi-ts-tests/zod/v4/__snapshots__/3.0.x/v3/validators/zod.gen.ts b/packages/openapi-ts-tests/zod/v4/__snapshots__/3.0.x/v3/validators/zod.gen.ts index 01928bc8f..f4142d499 100644 --- a/packages/openapi-ts-tests/zod/v4/__snapshots__/3.0.x/v3/validators/zod.gen.ts +++ b/packages/openapi-ts-tests/zod/v4/__snapshots__/3.0.x/v3/validators/zod.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import { z } from 'zod/v3'; +import { z } from 'zod'; export const zBar: z.AnyZodObject = z.object({ foo: z.lazy(() => { diff --git a/packages/openapi-ts-tests/zod/v4/__snapshots__/3.0.x/v4/array-items-one-of-length-1/zod.gen.ts b/packages/openapi-ts-tests/zod/v4/__snapshots__/3.0.x/v4/array-items-one-of-length-1/zod.gen.ts index 1b393bda1..91997b20b 100644 --- a/packages/openapi-ts-tests/zod/v4/__snapshots__/3.0.x/v4/array-items-one-of-length-1/zod.gen.ts +++ b/packages/openapi-ts-tests/zod/v4/__snapshots__/3.0.x/v4/array-items-one-of-length-1/zod.gen.ts @@ -5,5 +5,5 @@ import { z } from 'zod'; export const zBar = z.string(); export const zFoo = z.object({ - foo: z.optional(z.array(zBar).min(1).max(2147483647)) + foo: z.array(zBar).min(1).max(2147483647).optional() }); \ No newline at end of file diff --git a/packages/openapi-ts-tests/zod/v4/__snapshots__/3.0.x/v4/enum-null/zod.gen.ts b/packages/openapi-ts-tests/zod/v4/__snapshots__/3.0.x/v4/enum-null/zod.gen.ts index d79efe5d2..2b8373603 100644 --- a/packages/openapi-ts-tests/zod/v4/__snapshots__/3.0.x/v4/enum-null/zod.gen.ts +++ b/packages/openapi-ts-tests/zod/v4/__snapshots__/3.0.x/v4/enum-null/zod.gen.ts @@ -2,10 +2,10 @@ import { z } from 'zod'; -export const zFoo = z.nullable(z.enum([ +export const zFoo = z.enum([ 'foo', 'bar' -])); +]).nullable(); export const zBar = z.enum([ 'foo', diff --git a/packages/openapi-ts-tests/zod/v4/__snapshots__/3.0.x/v4/validators/zod.gen.ts b/packages/openapi-ts-tests/zod/v4/__snapshots__/3.0.x/v4/validators/zod.gen.ts index e9044ceb6..f4142d499 100644 --- a/packages/openapi-ts-tests/zod/v4/__snapshots__/3.0.x/v4/validators/zod.gen.ts +++ b/packages/openapi-ts-tests/zod/v4/__snapshots__/3.0.x/v4/validators/zod.gen.ts @@ -2,22 +2,20 @@ import { z } from 'zod'; -export const zBar = z.object({ - get foo(): z.ZodOptional { - return z.optional(zFoo); - } +export const zBar: z.AnyZodObject = z.object({ + foo: z.lazy(() => { + return zFoo; + }).optional() }); -export const zFoo = z.union([ +export const zFoo: z.ZodTypeAny = z.union([ z.object({ - foo: z.optional(z.string().regex(/^\d{3}-\d{2}-\d{4}$/)), - bar: z.optional(zBar), - get baz(): z.ZodOptional { - return z.optional(z.array(z.lazy((): any => { - return zFoo; - }))); - }, - qux: z.optional(z.int().gt(0)).default(0) + foo: z.string().regex(/^\d{3}-\d{2}-\d{4}$/).optional(), + bar: zBar.optional(), + baz: z.array(z.lazy(() => { + return zFoo; + })).optional(), + qux: z.number().int().gt(0).optional().default(0) }), z.null() ]).default(null); diff --git a/packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/mini/array-items-one-of-length-1/zod.gen.ts b/packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/mini/array-items-one-of-length-1/zod.gen.ts index c28387394..91997b20b 100644 --- a/packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/mini/array-items-one-of-length-1/zod.gen.ts +++ b/packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/mini/array-items-one-of-length-1/zod.gen.ts @@ -1,9 +1,9 @@ // This file is auto-generated by @hey-api/openapi-ts -import * as z from 'zod/mini'; +import { z } from 'zod'; export const zBar = z.string(); export const zFoo = z.object({ - foo: z.optional(z.array(zBar).check(z.minLength(1), z.maxLength(2147483647))) + foo: z.array(zBar).min(1).max(2147483647).optional() }); \ No newline at end of file diff --git a/packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/mini/enum-null/zod.gen.ts b/packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/mini/enum-null/zod.gen.ts index 084c93ee0..2b8373603 100644 --- a/packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/mini/enum-null/zod.gen.ts +++ b/packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/mini/enum-null/zod.gen.ts @@ -1,11 +1,11 @@ // This file is auto-generated by @hey-api/openapi-ts -import * as z from 'zod/mini'; +import { z } from 'zod'; -export const zFoo = z.nullable(z.enum([ +export const zFoo = z.enum([ 'foo', 'bar' -])); +]).nullable(); export const zBar = z.enum([ 'foo', diff --git a/packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/mini/schema-const/zod.gen.ts b/packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/mini/schema-const/zod.gen.ts index c3a7d4a82..a7aad3761 100644 --- a/packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/mini/schema-const/zod.gen.ts +++ b/packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/mini/schema-const/zod.gen.ts @@ -1,37 +1,37 @@ // This file is auto-generated by @hey-api/openapi-ts -import * as z from 'zod/mini'; +import { z } from 'zod'; export const zFoo = z.object({ - foo: z.optional(z.literal('foo')), - bar: z.optional(z.literal(3.2)), - baz: z.optional(z.literal(-1)), - qux: z.optional(z.literal(true)), - quux: z.optional(z.tuple([ + foo: z.literal('foo').optional(), + bar: z.literal(3.2).optional(), + baz: z.literal(-1).optional(), + qux: z.literal(true).optional(), + quux: z.tuple([ z.literal(1), z.literal(2), z.literal(3), z.literal('foo'), z.literal(true) - ])), - corge: z.optional(z.object({})), - garply: z.optional(z.coerce.bigint()), - numberInt8: z.optional(z.literal(100)), - numberInt16: z.optional(z.literal(1000)), - numberInt32: z.optional(z.literal(100000)), - numberInt64: z.optional(z.literal(1000000000000)), - numberUint8: z.optional(z.literal(200)), - numberUint16: z.optional(z.literal(50000)), - numberUint32: z.optional(z.literal(3000000000)), - numberUint64: z.optional(z.literal(18000000000000000000)), - integerInt8: z.optional(z.literal(-100)), - integerInt16: z.optional(z.literal(-1000)), - integerInt32: z.optional(z.literal(-100000)), - integerInt64: z.optional(z.literal(-1000000000000)), - integerUint8: z.optional(z.literal(255)), - integerUint16: z.optional(z.literal(65535)), - integerUint32: z.optional(z.literal(4294967295)), - integerUint64: z.optional(z.int()), - stringInt64: z.optional(z.literal('-9223372036854775808')), - stringUint64: z.optional(z.literal('18446744073709551615')) + ]).optional(), + corge: z.object({}).optional(), + garply: z.coerce.bigint().optional(), + numberInt8: z.literal(100).optional(), + numberInt16: z.literal(1000).optional(), + numberInt32: z.literal(100000).optional(), + numberInt64: z.literal(1000000000000).optional(), + numberUint8: z.literal(200).optional(), + numberUint16: z.literal(50000).optional(), + numberUint32: z.literal(3000000000).optional(), + numberUint64: z.literal(18000000000000000000).optional(), + integerInt8: z.literal(-100).optional(), + integerInt16: z.literal(-1000).optional(), + integerInt32: z.literal(-100000).optional(), + integerInt64: z.literal(-1000000000000).optional(), + integerUint8: z.literal(255).optional(), + integerUint16: z.literal(65535).optional(), + integerUint32: z.literal(4294967295).optional(), + integerUint64: z.number().int().optional(), + stringInt64: z.literal('-9223372036854775808').optional(), + stringUint64: z.literal('18446744073709551615').optional() }); \ No newline at end of file diff --git a/packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/mini/validators-bigint-min-max/zod.gen.ts b/packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/mini/validators-bigint-min-max/zod.gen.ts index 4d4d93b43..cbd60cb15 100644 --- a/packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/mini/validators-bigint-min-max/zod.gen.ts +++ b/packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/mini/validators-bigint-min-max/zod.gen.ts @@ -1,7 +1,7 @@ // This file is auto-generated by @hey-api/openapi-ts -import * as z from 'zod/mini'; +import { z } from 'zod'; export const zFoo = z.object({ - foo: z.optional(z.coerce.bigint().check(z.gte(BigInt(0)), z.lte(BigInt(100)))) + foo: z.coerce.bigint().gte(BigInt(0)).lte(BigInt(100)).optional() }); \ No newline at end of file diff --git a/packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/mini/validators-circular-ref-2/zod.gen.ts b/packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/mini/validators-circular-ref-2/zod.gen.ts index fa78939fd..fe5c68cc8 100644 --- a/packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/mini/validators-circular-ref-2/zod.gen.ts +++ b/packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/mini/validators-circular-ref-2/zod.gen.ts @@ -1,16 +1,16 @@ // This file is auto-generated by @hey-api/openapi-ts -import * as z from 'zod/mini'; +import { z } from 'zod'; -export const zBar = z.object({ +export const zBar: z.AnyZodObject = z.object({ bar: z.union([ - z.array(z.lazy((): any => { + z.array(z.lazy(() => { return zBar; })), z.null() ]) }); -export const zFoo = z.object({ +export const zFoo: z.AnyZodObject = z.object({ foo: zBar }); \ No newline at end of file diff --git a/packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/mini/validators-circular-ref/zod.gen.ts b/packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/mini/validators-circular-ref/zod.gen.ts index b5a3b1153..9ed4452c1 100644 --- a/packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/mini/validators-circular-ref/zod.gen.ts +++ b/packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/mini/validators-circular-ref/zod.gen.ts @@ -1,24 +1,22 @@ // This file is auto-generated by @hey-api/openapi-ts -import * as z from 'zod/mini'; +import { z } from 'zod'; -export const zBar = z.object({ - get bar(): z.ZodMiniOptional { - return z.optional(z.array(z.lazy((): any => { - return zBar; - }))); - } +export const zBar: z.AnyZodObject = z.object({ + bar: z.array(z.lazy(() => { + return zBar; + })).optional() }); -export const zFoo = z.object({ - foo: z.optional(zBar) +export const zFoo: z.AnyZodObject = z.object({ + foo: zBar.optional() }); /** * description caused circular reference error */ -export const zQux = z.lazy((): any => { +export const zQux: z.ZodTypeAny = z.lazy(() => { return zQux; }); -export const zBaz = zQux; \ No newline at end of file +export const zBaz: z.ZodTypeAny = zQux; \ No newline at end of file diff --git a/packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/mini/validators-dates/zod.gen.ts b/packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/mini/validators-dates/zod.gen.ts index f5e6d804c..7d3bc1d19 100644 --- a/packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/mini/validators-dates/zod.gen.ts +++ b/packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/mini/validators-dates/zod.gen.ts @@ -1,37 +1,35 @@ // This file is auto-generated by @hey-api/openapi-ts -import * as z from 'zod/mini'; +import { z } from 'zod'; /** * This is Bar schema. */ -export const zBar = z.object({ - get foo(): z.ZodMiniOptional { - return z.optional(zFoo); - } +export const zBar: z.AnyZodObject = z.object({ + foo: z.lazy(() => { + return zFoo; + }).optional() }); /** * This is Foo schema. */ -export const zFoo = z._default(z.union([ +export const zFoo: z.ZodTypeAny = z.union([ z.object({ - foo: z.optional(z.string().check(z.regex(/^\d{3}-\d{2}-\d{4}$/))), - bar: z.optional(zBar), - get baz(): z.ZodMiniOptional { - return z.optional(z.array(z.lazy((): any => { - return zFoo; - }))); - }, - qux: z._default(z.optional(z.int().check(z.gt(0))), 0) + foo: z.string().regex(/^\d{3}-\d{2}-\d{4}$/).optional(), + bar: zBar.optional(), + baz: z.array(z.lazy(() => { + return zFoo; + })).optional(), + qux: z.number().int().gt(0).optional().default(0) }), z.null() -]), null); +]).default(null); -export const zBaz = z._default(z.readonly(z.string().check(z.regex(/foo\nbar/))), 'baz'); +export const zBaz = z.string().regex(/foo\nbar/).readonly().default('baz'); -export const zQux = z.record(z.string(), z.object({ - qux: z.optional(z.string()) +export const zQux = z.record(z.object({ + qux: z.string().optional() })); /** @@ -40,29 +38,29 @@ export const zQux = z.record(z.string(), z.object({ export const zFoo2 = z.string(); export const zFoo3 = z.object({ - foo: z.optional(zBar) + foo: zBar.optional() }); export const zPatchFooData = z.object({ body: z.object({ - foo: z.optional(z.string()) + foo: z.string().optional() }), - path: z.optional(z.never()), - query: z.optional(z.object({ - foo: z.optional(z.string()), - bar: z.optional(zBar), - baz: z.optional(z.object({ - baz: z.optional(z.string()) - })), - qux: z.optional(z.iso.date()), - quux: z.optional(z.iso.datetime({ + path: z.never().optional(), + query: z.object({ + foo: z.string().optional(), + bar: zBar.optional(), + baz: z.object({ + baz: z.string().optional() + }).optional(), + qux: z.string().date().optional(), + quux: z.string().datetime({ offset: true - })) - })) + }).optional() + }).optional() }); export const zPostFooData = z.object({ body: zFoo3, - path: z.optional(z.never()), - query: z.optional(z.never()) + path: z.never().optional(), + query: z.never().optional() }); \ No newline at end of file diff --git a/packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/mini/validators-metadata/zod.gen.ts b/packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/mini/validators-metadata/zod.gen.ts index 0089cf010..b269940da 100644 --- a/packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/mini/validators-metadata/zod.gen.ts +++ b/packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/mini/validators-metadata/zod.gen.ts @@ -1,78 +1,64 @@ // This file is auto-generated by @hey-api/openapi-ts -import * as z from 'zod/mini'; +import { z } from 'zod'; /** * This is Bar schema. */ -export const zBar = z.object({ - get foo(): z.ZodMiniOptional { - return z.optional(zFoo); - } -}).register(z.globalRegistry, { - description: 'This is Bar schema.' -}); +export const zBar: z.AnyZodObject = z.object({ + foo: z.lazy(() => { + return zFoo; + }).optional() +}).describe('This is Bar schema.'); /** * This is Foo schema. */ -export const zFoo = z._default(z.union([ +export const zFoo: z.ZodTypeAny = z.union([ z.object({ - foo: z.optional(z.string().check(z.regex(/^\d{3}-\d{2}-\d{4}$/)).register(z.globalRegistry, { - description: 'This is foo property.' - })), - bar: z.optional(zBar), - get baz(): z.ZodMiniOptional { - return z.optional(z.array(z.lazy((): any => { - return zFoo; - })).register(z.globalRegistry, { - description: 'This is baz property.' - })); - }, - qux: z._default(z.optional(z.int().check(z.gt(0)).register(z.globalRegistry, { - description: 'This is qux property.' - })), 0) + foo: z.string().regex(/^\d{3}-\d{2}-\d{4}$/).describe('This is foo property.').optional(), + bar: zBar.optional(), + baz: z.array(z.lazy(() => { + return zFoo; + })).describe('This is baz property.').optional(), + qux: z.number().int().gt(0).describe('This is qux property.').optional().default(0) }), z.null() -]), null); +]).default(null); -export const zBaz = z._default(z.readonly(z.string().check(z.regex(/foo\nbar/))), 'baz'); +export const zBaz = z.string().regex(/foo\nbar/).readonly().default('baz'); -export const zQux = z.record(z.string(), z.object({ - qux: z.optional(z.string()) +export const zQux = z.record(z.object({ + qux: z.string().optional() })); /** * This is Foo parameter. */ -export const zFoo2 = z.string().register(z.globalRegistry, { - description: 'This is Foo parameter.' -}); +export const zFoo2 = z.string().describe('This is Foo parameter.'); export const zFoo3 = z.object({ - foo: z.optional(zBar) + foo: zBar.optional() }); export const zPatchFooData = z.object({ body: z.object({ - foo: z.optional(z.string()) + foo: z.string().optional() }), - path: z.optional(z.never()), - query: z.optional(z.object({ - foo: z.optional(z.string().register(z.globalRegistry, { - description: 'This is Foo parameter.' - })), - bar: z.optional(zBar), - baz: z.optional(z.object({ - baz: z.optional(z.string()) - })), - qux: z.optional(z.iso.date()), - quux: z.optional(z.iso.datetime()) - })) + path: z.never().optional(), + query: z.object({ + foo: z.string().describe('This is Foo parameter.').optional(), + bar: zBar.optional(), + baz: z.object({ + baz: z.string().optional() + }).optional(), + qux: z.string().date().optional(), + quux: z.string().datetime().optional() + }).optional() }); export const zPostFooData = z.object({ body: zFoo3, - path: z.optional(z.never()), - query: z.optional(z.never()) + path: z.never().optional(), + query: z.never().optional() }); \ No newline at end of file diff --git a/packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/mini/validators-types/zod.gen.ts b/packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/mini/validators-types/zod.gen.ts index 1d1545e1f..f8adb5f3f 100644 --- a/packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/mini/validators-types/zod.gen.ts +++ b/packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/mini/validators-types/zod.gen.ts @@ -1,82 +1,64 @@ // This file is auto-generated by @hey-api/openapi-ts -import * as z from 'zod/mini'; +import { z } from 'zod'; /** * This is Bar schema. */ -export const zBar = z.object({ - get foo(): z.ZodMiniOptional { - return z.optional(zFoo); - } +export const zBar: z.AnyZodObject = z.object({ + foo: z.lazy(() => { + return zFoo; + }).optional() }); -export type BarZodType = z.infer; - /** * This is Foo schema. */ -export const zFoo = z._default(z.union([ +export const zFoo: z.ZodTypeAny = z.union([ z.object({ - foo: z.optional(z.string().check(z.regex(/^\d{3}-\d{2}-\d{4}$/))), - bar: z.optional(zBar), - get baz(): z.ZodMiniOptional { - return z.optional(z.array(z.lazy((): any => { - return zFoo; - }))); - }, - qux: z._default(z.optional(z.int().check(z.gt(0))), 0) + foo: z.string().regex(/^\d{3}-\d{2}-\d{4}$/).optional(), + bar: zBar.optional(), + baz: z.array(z.lazy(() => { + return zFoo; + })).optional(), + qux: z.number().int().gt(0).optional().default(0) }), z.null() -]), null); - -export type FooZodType = z.infer; - -export const zBaz = z._default(z.readonly(z.string().check(z.regex(/foo\nbar/))), 'baz'); +]).default(null); -export type BazZodType = z.infer; +export const zBaz = z.string().regex(/foo\nbar/).readonly().default('baz'); -export const zQux = z.record(z.string(), z.object({ - qux: z.optional(z.string()) +export const zQux = z.record(z.object({ + qux: z.string().optional() })); -export type QuxZodType = z.infer; - /** * This is Foo parameter. */ export const zFoo2 = z.string(); -export type FooZodType2 = z.infer; - export const zFoo3 = z.object({ - foo: z.optional(zBar) + foo: zBar.optional() }); -export type FooZodType3 = z.infer; - export const zPatchFooData = z.object({ body: z.object({ - foo: z.optional(z.string()) + foo: z.string().optional() }), - path: z.optional(z.never()), - query: z.optional(z.object({ - foo: z.optional(z.string()), - bar: z.optional(zBar), - baz: z.optional(z.object({ - baz: z.optional(z.string()) - })), - qux: z.optional(z.iso.date()), - quux: z.optional(z.iso.datetime()) - })) + path: z.never().optional(), + query: z.object({ + foo: z.string().optional(), + bar: zBar.optional(), + baz: z.object({ + baz: z.string().optional() + }).optional(), + qux: z.string().date().optional(), + quux: z.string().datetime().optional() + }).optional() }); -export type PatchFooDataZodType = z.infer; - export const zPostFooData = z.object({ body: zFoo3, - path: z.optional(z.never()), - query: z.optional(z.never()) -}); - -export type PostFooDataZodType = z.infer; \ No newline at end of file + path: z.never().optional(), + query: z.never().optional() +}); \ No newline at end of file diff --git a/packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/mini/validators-union-merge/zod.gen.ts b/packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/mini/validators-union-merge/zod.gen.ts index 86003751f..2a9dd621f 100644 --- a/packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/mini/validators-union-merge/zod.gen.ts +++ b/packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/mini/validators-union-merge/zod.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import * as z from 'zod/mini'; +import { z } from 'zod'; export const zContact = z.union([ z.object({ @@ -11,13 +11,13 @@ export const zContact = z.union([ }) ]); -export const zUser = z.intersection(zContact, z.object({ +export const zUser = zContact.and(z.object({ username: z.string() })); export const zDogDetails = z.object({ breed: z.string(), - barkVolume: z.int().check(z.gte(1), z.lte(10)) + barkVolume: z.number().int().gte(1).lte(10) }); export const zCatDetails = z.object({ @@ -32,10 +32,10 @@ export const zCatDetails = z.object({ export const zPetStore = z.object({ animals: z.array(z.object({ name: z.string(), - type: z.optional(z.enum([ + type: z.enum([ 'dog', 'cat' - ])), + ]).optional(), details: z.union([ zDogDetails, zCatDetails diff --git a/packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/mini/validators/zod.gen.ts b/packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/mini/validators/zod.gen.ts index 04f65c781..f8adb5f3f 100644 --- a/packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/mini/validators/zod.gen.ts +++ b/packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/mini/validators/zod.gen.ts @@ -1,37 +1,35 @@ // This file is auto-generated by @hey-api/openapi-ts -import * as z from 'zod/mini'; +import { z } from 'zod'; /** * This is Bar schema. */ -export const zBar = z.object({ - get foo(): z.ZodMiniOptional { - return z.optional(zFoo); - } +export const zBar: z.AnyZodObject = z.object({ + foo: z.lazy(() => { + return zFoo; + }).optional() }); /** * This is Foo schema. */ -export const zFoo = z._default(z.union([ +export const zFoo: z.ZodTypeAny = z.union([ z.object({ - foo: z.optional(z.string().check(z.regex(/^\d{3}-\d{2}-\d{4}$/))), - bar: z.optional(zBar), - get baz(): z.ZodMiniOptional { - return z.optional(z.array(z.lazy((): any => { - return zFoo; - }))); - }, - qux: z._default(z.optional(z.int().check(z.gt(0))), 0) + foo: z.string().regex(/^\d{3}-\d{2}-\d{4}$/).optional(), + bar: zBar.optional(), + baz: z.array(z.lazy(() => { + return zFoo; + })).optional(), + qux: z.number().int().gt(0).optional().default(0) }), z.null() -]), null); +]).default(null); -export const zBaz = z._default(z.readonly(z.string().check(z.regex(/foo\nbar/))), 'baz'); +export const zBaz = z.string().regex(/foo\nbar/).readonly().default('baz'); -export const zQux = z.record(z.string(), z.object({ - qux: z.optional(z.string()) +export const zQux = z.record(z.object({ + qux: z.string().optional() })); /** @@ -40,27 +38,27 @@ export const zQux = z.record(z.string(), z.object({ export const zFoo2 = z.string(); export const zFoo3 = z.object({ - foo: z.optional(zBar) + foo: zBar.optional() }); export const zPatchFooData = z.object({ body: z.object({ - foo: z.optional(z.string()) + foo: z.string().optional() }), - path: z.optional(z.never()), - query: z.optional(z.object({ - foo: z.optional(z.string()), - bar: z.optional(zBar), - baz: z.optional(z.object({ - baz: z.optional(z.string()) - })), - qux: z.optional(z.iso.date()), - quux: z.optional(z.iso.datetime()) - })) + path: z.never().optional(), + query: z.object({ + foo: z.string().optional(), + bar: zBar.optional(), + baz: z.object({ + baz: z.string().optional() + }).optional(), + qux: z.string().date().optional(), + quux: z.string().datetime().optional() + }).optional() }); export const zPostFooData = z.object({ body: zFoo3, - path: z.optional(z.never()), - query: z.optional(z.never()) + path: z.never().optional(), + query: z.never().optional() }); \ No newline at end of file diff --git a/packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/v3/array-items-one-of-length-1/zod.gen.ts b/packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/v3/array-items-one-of-length-1/zod.gen.ts index d6e23fb2f..91997b20b 100644 --- a/packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/v3/array-items-one-of-length-1/zod.gen.ts +++ b/packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/v3/array-items-one-of-length-1/zod.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import { z } from 'zod/v3'; +import { z } from 'zod'; export const zBar = z.string(); diff --git a/packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/v3/enum-null/zod.gen.ts b/packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/v3/enum-null/zod.gen.ts index b3477bf27..2b8373603 100644 --- a/packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/v3/enum-null/zod.gen.ts +++ b/packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/v3/enum-null/zod.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import { z } from 'zod/v3'; +import { z } from 'zod'; export const zFoo = z.enum([ 'foo', diff --git a/packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/v3/schema-const/zod.gen.ts b/packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/v3/schema-const/zod.gen.ts index 354d86ddb..a7aad3761 100644 --- a/packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/v3/schema-const/zod.gen.ts +++ b/packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/v3/schema-const/zod.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import { z } from 'zod/v3'; +import { z } from 'zod'; export const zFoo = z.object({ foo: z.literal('foo').optional(), diff --git a/packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/v3/validators-bigint-min-max/zod.gen.ts b/packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/v3/validators-bigint-min-max/zod.gen.ts index 702b021c9..cbd60cb15 100644 --- a/packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/v3/validators-bigint-min-max/zod.gen.ts +++ b/packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/v3/validators-bigint-min-max/zod.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import { z } from 'zod/v3'; +import { z } from 'zod'; export const zFoo = z.object({ foo: z.coerce.bigint().gte(BigInt(0)).lte(BigInt(100)).optional() diff --git a/packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/v3/validators-circular-ref-2/zod.gen.ts b/packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/v3/validators-circular-ref-2/zod.gen.ts index da59ef9db..fe5c68cc8 100644 --- a/packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/v3/validators-circular-ref-2/zod.gen.ts +++ b/packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/v3/validators-circular-ref-2/zod.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import { z } from 'zod/v3'; +import { z } from 'zod'; export const zBar: z.AnyZodObject = z.object({ bar: z.union([ diff --git a/packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/v3/validators-circular-ref/zod.gen.ts b/packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/v3/validators-circular-ref/zod.gen.ts index c64ceaa73..9ed4452c1 100644 --- a/packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/v3/validators-circular-ref/zod.gen.ts +++ b/packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/v3/validators-circular-ref/zod.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import { z } from 'zod/v3'; +import { z } from 'zod'; export const zBar: z.AnyZodObject = z.object({ bar: z.array(z.lazy(() => { diff --git a/packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/v3/validators-dates/zod.gen.ts b/packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/v3/validators-dates/zod.gen.ts index 575a66456..7d3bc1d19 100644 --- a/packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/v3/validators-dates/zod.gen.ts +++ b/packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/v3/validators-dates/zod.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import { z } from 'zod/v3'; +import { z } from 'zod'; /** * This is Bar schema. diff --git a/packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/v3/validators-metadata/zod.gen.ts b/packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/v3/validators-metadata/zod.gen.ts index dd909ef91..b269940da 100644 --- a/packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/v3/validators-metadata/zod.gen.ts +++ b/packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/v3/validators-metadata/zod.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import { z } from 'zod/v3'; +import { z } from 'zod'; /** * This is Bar schema. diff --git a/packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/v3/validators-types/zod.gen.ts b/packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/v3/validators-types/zod.gen.ts index 29f89864b..f8adb5f3f 100644 --- a/packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/v3/validators-types/zod.gen.ts +++ b/packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/v3/validators-types/zod.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import { z } from 'zod/v3'; +import { z } from 'zod'; /** * This is Bar schema. @@ -11,8 +11,6 @@ export const zBar: z.AnyZodObject = z.object({ }).optional() }); -export type BarZodType = z.infer; - /** * This is Foo schema. */ @@ -28,31 +26,21 @@ export const zFoo: z.ZodTypeAny = z.union([ z.null() ]).default(null); -export type FooZodType = z.infer; - export const zBaz = z.string().regex(/foo\nbar/).readonly().default('baz'); -export type BazZodType = z.infer; - export const zQux = z.record(z.object({ qux: z.string().optional() })); -export type QuxZodType = z.infer; - /** * This is Foo parameter. */ export const zFoo2 = z.string(); -export type FooZodType2 = z.infer; - export const zFoo3 = z.object({ foo: zBar.optional() }); -export type FooZodType3 = z.infer; - export const zPatchFooData = z.object({ body: z.object({ foo: z.string().optional() @@ -69,12 +57,8 @@ export const zPatchFooData = z.object({ }).optional() }); -export type PatchFooDataZodType = z.infer; - export const zPostFooData = z.object({ body: zFoo3, path: z.never().optional(), query: z.never().optional() -}); - -export type PostFooDataZodType = z.infer; \ No newline at end of file +}); \ No newline at end of file diff --git a/packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/v3/validators-union-merge/zod.gen.ts b/packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/v3/validators-union-merge/zod.gen.ts index 23c1d7fb2..2a9dd621f 100644 --- a/packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/v3/validators-union-merge/zod.gen.ts +++ b/packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/v3/validators-union-merge/zod.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import { z } from 'zod/v3'; +import { z } from 'zod'; export const zContact = z.union([ z.object({ diff --git a/packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/v3/validators/zod.gen.ts b/packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/v3/validators/zod.gen.ts index 47451c58f..f8adb5f3f 100644 --- a/packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/v3/validators/zod.gen.ts +++ b/packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/v3/validators/zod.gen.ts @@ -1,6 +1,6 @@ // This file is auto-generated by @hey-api/openapi-ts -import { z } from 'zod/v3'; +import { z } from 'zod'; /** * This is Bar schema. diff --git a/packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/v4/array-items-one-of-length-1/zod.gen.ts b/packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/v4/array-items-one-of-length-1/zod.gen.ts index 1b393bda1..91997b20b 100644 --- a/packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/v4/array-items-one-of-length-1/zod.gen.ts +++ b/packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/v4/array-items-one-of-length-1/zod.gen.ts @@ -5,5 +5,5 @@ import { z } from 'zod'; export const zBar = z.string(); export const zFoo = z.object({ - foo: z.optional(z.array(zBar).min(1).max(2147483647)) + foo: z.array(zBar).min(1).max(2147483647).optional() }); \ No newline at end of file diff --git a/packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/v4/enum-null/zod.gen.ts b/packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/v4/enum-null/zod.gen.ts index d79efe5d2..2b8373603 100644 --- a/packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/v4/enum-null/zod.gen.ts +++ b/packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/v4/enum-null/zod.gen.ts @@ -2,10 +2,10 @@ import { z } from 'zod'; -export const zFoo = z.nullable(z.enum([ +export const zFoo = z.enum([ 'foo', 'bar' -])); +]).nullable(); export const zBar = z.enum([ 'foo', diff --git a/packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/v4/schema-const/zod.gen.ts b/packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/v4/schema-const/zod.gen.ts index e4e073a25..a7aad3761 100644 --- a/packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/v4/schema-const/zod.gen.ts +++ b/packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/v4/schema-const/zod.gen.ts @@ -3,35 +3,35 @@ import { z } from 'zod'; export const zFoo = z.object({ - foo: z.optional(z.literal('foo')), - bar: z.optional(z.literal(3.2)), - baz: z.optional(z.literal(-1)), - qux: z.optional(z.literal(true)), - quux: z.optional(z.tuple([ + foo: z.literal('foo').optional(), + bar: z.literal(3.2).optional(), + baz: z.literal(-1).optional(), + qux: z.literal(true).optional(), + quux: z.tuple([ z.literal(1), z.literal(2), z.literal(3), z.literal('foo'), z.literal(true) - ])), - corge: z.optional(z.object({})), - garply: z.optional(z.coerce.bigint()), - numberInt8: z.optional(z.literal(100)), - numberInt16: z.optional(z.literal(1000)), - numberInt32: z.optional(z.literal(100000)), - numberInt64: z.optional(z.literal(1000000000000)), - numberUint8: z.optional(z.literal(200)), - numberUint16: z.optional(z.literal(50000)), - numberUint32: z.optional(z.literal(3000000000)), - numberUint64: z.optional(z.literal(18000000000000000000)), - integerInt8: z.optional(z.literal(-100)), - integerInt16: z.optional(z.literal(-1000)), - integerInt32: z.optional(z.literal(-100000)), - integerInt64: z.optional(z.literal(-1000000000000)), - integerUint8: z.optional(z.literal(255)), - integerUint16: z.optional(z.literal(65535)), - integerUint32: z.optional(z.literal(4294967295)), - integerUint64: z.optional(z.int()), - stringInt64: z.optional(z.literal('-9223372036854775808')), - stringUint64: z.optional(z.literal('18446744073709551615')) + ]).optional(), + corge: z.object({}).optional(), + garply: z.coerce.bigint().optional(), + numberInt8: z.literal(100).optional(), + numberInt16: z.literal(1000).optional(), + numberInt32: z.literal(100000).optional(), + numberInt64: z.literal(1000000000000).optional(), + numberUint8: z.literal(200).optional(), + numberUint16: z.literal(50000).optional(), + numberUint32: z.literal(3000000000).optional(), + numberUint64: z.literal(18000000000000000000).optional(), + integerInt8: z.literal(-100).optional(), + integerInt16: z.literal(-1000).optional(), + integerInt32: z.literal(-100000).optional(), + integerInt64: z.literal(-1000000000000).optional(), + integerUint8: z.literal(255).optional(), + integerUint16: z.literal(65535).optional(), + integerUint32: z.literal(4294967295).optional(), + integerUint64: z.number().int().optional(), + stringInt64: z.literal('-9223372036854775808').optional(), + stringUint64: z.literal('18446744073709551615').optional() }); \ No newline at end of file diff --git a/packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/v4/validators-bigint-min-max/zod.gen.ts b/packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/v4/validators-bigint-min-max/zod.gen.ts index eb3ccb962..cbd60cb15 100644 --- a/packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/v4/validators-bigint-min-max/zod.gen.ts +++ b/packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/v4/validators-bigint-min-max/zod.gen.ts @@ -3,5 +3,5 @@ import { z } from 'zod'; export const zFoo = z.object({ - foo: z.optional(z.coerce.bigint().gte(BigInt(0)).lte(BigInt(100))) + foo: z.coerce.bigint().gte(BigInt(0)).lte(BigInt(100)).optional() }); \ No newline at end of file diff --git a/packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/v4/validators-circular-ref-2/zod.gen.ts b/packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/v4/validators-circular-ref-2/zod.gen.ts index 8b058709a..fe5c68cc8 100644 --- a/packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/v4/validators-circular-ref-2/zod.gen.ts +++ b/packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/v4/validators-circular-ref-2/zod.gen.ts @@ -2,15 +2,15 @@ import { z } from 'zod'; -export const zBar = z.object({ +export const zBar: z.AnyZodObject = z.object({ bar: z.union([ - z.array(z.lazy((): any => { + z.array(z.lazy(() => { return zBar; })), z.null() ]) }); -export const zFoo = z.object({ +export const zFoo: z.AnyZodObject = z.object({ foo: zBar }); \ No newline at end of file diff --git a/packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/v4/validators-circular-ref/zod.gen.ts b/packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/v4/validators-circular-ref/zod.gen.ts index 8fbd29229..9ed4452c1 100644 --- a/packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/v4/validators-circular-ref/zod.gen.ts +++ b/packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/v4/validators-circular-ref/zod.gen.ts @@ -2,23 +2,21 @@ import { z } from 'zod'; -export const zBar = z.object({ - get bar(): z.ZodOptional { - return z.optional(z.array(z.lazy((): any => { - return zBar; - }))); - } +export const zBar: z.AnyZodObject = z.object({ + bar: z.array(z.lazy(() => { + return zBar; + })).optional() }); -export const zFoo = z.object({ - foo: z.optional(zBar) +export const zFoo: z.AnyZodObject = z.object({ + foo: zBar.optional() }); /** * description caused circular reference error */ -export const zQux = z.lazy((): any => { +export const zQux: z.ZodTypeAny = z.lazy(() => { return zQux; }); -export const zBaz = zQux; \ No newline at end of file +export const zBaz: z.ZodTypeAny = zQux; \ No newline at end of file diff --git a/packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/v4/validators-dates/zod.gen.ts b/packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/v4/validators-dates/zod.gen.ts index 7a3e6c6b7..7d3bc1d19 100644 --- a/packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/v4/validators-dates/zod.gen.ts +++ b/packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/v4/validators-dates/zod.gen.ts @@ -5,33 +5,31 @@ import { z } from 'zod'; /** * This is Bar schema. */ -export const zBar = z.object({ - get foo(): z.ZodOptional { - return z.optional(zFoo); - } +export const zBar: z.AnyZodObject = z.object({ + foo: z.lazy(() => { + return zFoo; + }).optional() }); /** * This is Foo schema. */ -export const zFoo = z.union([ +export const zFoo: z.ZodTypeAny = z.union([ z.object({ - foo: z.optional(z.string().regex(/^\d{3}-\d{2}-\d{4}$/)), - bar: z.optional(zBar), - get baz(): z.ZodOptional { - return z.optional(z.array(z.lazy((): any => { - return zFoo; - }))); - }, - qux: z.optional(z.int().gt(0)).default(0) + foo: z.string().regex(/^\d{3}-\d{2}-\d{4}$/).optional(), + bar: zBar.optional(), + baz: z.array(z.lazy(() => { + return zFoo; + })).optional(), + qux: z.number().int().gt(0).optional().default(0) }), z.null() ]).default(null); export const zBaz = z.string().regex(/foo\nbar/).readonly().default('baz'); -export const zQux = z.record(z.string(), z.object({ - qux: z.optional(z.string()) +export const zQux = z.record(z.object({ + qux: z.string().optional() })); /** @@ -40,29 +38,29 @@ export const zQux = z.record(z.string(), z.object({ export const zFoo2 = z.string(); export const zFoo3 = z.object({ - foo: z.optional(zBar) + foo: zBar.optional() }); export const zPatchFooData = z.object({ body: z.object({ - foo: z.optional(z.string()) + foo: z.string().optional() }), - path: z.optional(z.never()), - query: z.optional(z.object({ - foo: z.optional(z.string()), - bar: z.optional(zBar), - baz: z.optional(z.object({ - baz: z.optional(z.string()) - })), - qux: z.optional(z.iso.date()), - quux: z.optional(z.iso.datetime({ + path: z.never().optional(), + query: z.object({ + foo: z.string().optional(), + bar: zBar.optional(), + baz: z.object({ + baz: z.string().optional() + }).optional(), + qux: z.string().date().optional(), + quux: z.string().datetime({ offset: true - })) - })) + }).optional() + }).optional() }); export const zPostFooData = z.object({ body: zFoo3, - path: z.optional(z.never()), - query: z.optional(z.never()) + path: z.never().optional(), + query: z.never().optional() }); \ No newline at end of file diff --git a/packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/v4/validators-metadata/zod.gen.ts b/packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/v4/validators-metadata/zod.gen.ts index fc9c4caaa..b269940da 100644 --- a/packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/v4/validators-metadata/zod.gen.ts +++ b/packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/v4/validators-metadata/zod.gen.ts @@ -5,74 +5,60 @@ import { z } from 'zod'; /** * This is Bar schema. */ -export const zBar = z.object({ - get foo(): z.ZodOptional { - return z.optional(zFoo); - } -}).register(z.globalRegistry, { - description: 'This is Bar schema.' -}); +export const zBar: z.AnyZodObject = z.object({ + foo: z.lazy(() => { + return zFoo; + }).optional() +}).describe('This is Bar schema.'); /** * This is Foo schema. */ -export const zFoo = z.union([ +export const zFoo: z.ZodTypeAny = z.union([ z.object({ - foo: z.optional(z.string().regex(/^\d{3}-\d{2}-\d{4}$/).register(z.globalRegistry, { - description: 'This is foo property.' - })), - bar: z.optional(zBar), - get baz(): z.ZodOptional { - return z.optional(z.array(z.lazy((): any => { - return zFoo; - })).register(z.globalRegistry, { - description: 'This is baz property.' - })); - }, - qux: z.optional(z.int().gt(0).register(z.globalRegistry, { - description: 'This is qux property.' - })).default(0) + foo: z.string().regex(/^\d{3}-\d{2}-\d{4}$/).describe('This is foo property.').optional(), + bar: zBar.optional(), + baz: z.array(z.lazy(() => { + return zFoo; + })).describe('This is baz property.').optional(), + qux: z.number().int().gt(0).describe('This is qux property.').optional().default(0) }), z.null() ]).default(null); export const zBaz = z.string().regex(/foo\nbar/).readonly().default('baz'); -export const zQux = z.record(z.string(), z.object({ - qux: z.optional(z.string()) +export const zQux = z.record(z.object({ + qux: z.string().optional() })); /** * This is Foo parameter. */ -export const zFoo2 = z.string().register(z.globalRegistry, { - description: 'This is Foo parameter.' -}); +export const zFoo2 = z.string().describe('This is Foo parameter.'); export const zFoo3 = z.object({ - foo: z.optional(zBar) + foo: zBar.optional() }); export const zPatchFooData = z.object({ body: z.object({ - foo: z.optional(z.string()) + foo: z.string().optional() }), - path: z.optional(z.never()), - query: z.optional(z.object({ - foo: z.optional(z.string().register(z.globalRegistry, { - description: 'This is Foo parameter.' - })), - bar: z.optional(zBar), - baz: z.optional(z.object({ - baz: z.optional(z.string()) - })), - qux: z.optional(z.iso.date()), - quux: z.optional(z.iso.datetime()) - })) + path: z.never().optional(), + query: z.object({ + foo: z.string().describe('This is Foo parameter.').optional(), + bar: zBar.optional(), + baz: z.object({ + baz: z.string().optional() + }).optional(), + qux: z.string().date().optional(), + quux: z.string().datetime().optional() + }).optional() }); export const zPostFooData = z.object({ body: zFoo3, - path: z.optional(z.never()), - query: z.optional(z.never()) + path: z.never().optional(), + query: z.never().optional() }); \ No newline at end of file diff --git a/packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/v4/validators-types/zod.gen.ts b/packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/v4/validators-types/zod.gen.ts index 011094631..f8adb5f3f 100644 --- a/packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/v4/validators-types/zod.gen.ts +++ b/packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/v4/validators-types/zod.gen.ts @@ -5,78 +5,60 @@ import { z } from 'zod'; /** * This is Bar schema. */ -export const zBar = z.object({ - get foo(): z.ZodOptional { - return z.optional(zFoo); - } +export const zBar: z.AnyZodObject = z.object({ + foo: z.lazy(() => { + return zFoo; + }).optional() }); -export type BarZodType = z.infer; - /** * This is Foo schema. */ -export const zFoo = z.union([ +export const zFoo: z.ZodTypeAny = z.union([ z.object({ - foo: z.optional(z.string().regex(/^\d{3}-\d{2}-\d{4}$/)), - bar: z.optional(zBar), - get baz(): z.ZodOptional { - return z.optional(z.array(z.lazy((): any => { - return zFoo; - }))); - }, - qux: z.optional(z.int().gt(0)).default(0) + foo: z.string().regex(/^\d{3}-\d{2}-\d{4}$/).optional(), + bar: zBar.optional(), + baz: z.array(z.lazy(() => { + return zFoo; + })).optional(), + qux: z.number().int().gt(0).optional().default(0) }), z.null() ]).default(null); -export type FooZodType = z.infer; - export const zBaz = z.string().regex(/foo\nbar/).readonly().default('baz'); -export type BazZodType = z.infer; - -export const zQux = z.record(z.string(), z.object({ - qux: z.optional(z.string()) +export const zQux = z.record(z.object({ + qux: z.string().optional() })); -export type QuxZodType = z.infer; - /** * This is Foo parameter. */ export const zFoo2 = z.string(); -export type FooZodType2 = z.infer; - export const zFoo3 = z.object({ - foo: z.optional(zBar) + foo: zBar.optional() }); -export type FooZodType3 = z.infer; - export const zPatchFooData = z.object({ body: z.object({ - foo: z.optional(z.string()) + foo: z.string().optional() }), - path: z.optional(z.never()), - query: z.optional(z.object({ - foo: z.optional(z.string()), - bar: z.optional(zBar), - baz: z.optional(z.object({ - baz: z.optional(z.string()) - })), - qux: z.optional(z.iso.date()), - quux: z.optional(z.iso.datetime()) - })) + path: z.never().optional(), + query: z.object({ + foo: z.string().optional(), + bar: zBar.optional(), + baz: z.object({ + baz: z.string().optional() + }).optional(), + qux: z.string().date().optional(), + quux: z.string().datetime().optional() + }).optional() }); -export type PatchFooDataZodType = z.infer; - export const zPostFooData = z.object({ body: zFoo3, - path: z.optional(z.never()), - query: z.optional(z.never()) -}); - -export type PostFooDataZodType = z.infer; \ No newline at end of file + path: z.never().optional(), + query: z.never().optional() +}); \ No newline at end of file diff --git a/packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/v4/validators-union-merge/zod.gen.ts b/packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/v4/validators-union-merge/zod.gen.ts index dbebab297..2a9dd621f 100644 --- a/packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/v4/validators-union-merge/zod.gen.ts +++ b/packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/v4/validators-union-merge/zod.gen.ts @@ -17,7 +17,7 @@ export const zUser = zContact.and(z.object({ export const zDogDetails = z.object({ breed: z.string(), - barkVolume: z.int().gte(1).lte(10) + barkVolume: z.number().int().gte(1).lte(10) }); export const zCatDetails = z.object({ @@ -32,10 +32,10 @@ export const zCatDetails = z.object({ export const zPetStore = z.object({ animals: z.array(z.object({ name: z.string(), - type: z.optional(z.enum([ + type: z.enum([ 'dog', 'cat' - ])), + ]).optional(), details: z.union([ zDogDetails, zCatDetails diff --git a/packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/v4/validators/zod.gen.ts b/packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/v4/validators/zod.gen.ts index dd2dc5c96..f8adb5f3f 100644 --- a/packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/v4/validators/zod.gen.ts +++ b/packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/v4/validators/zod.gen.ts @@ -5,33 +5,31 @@ import { z } from 'zod'; /** * This is Bar schema. */ -export const zBar = z.object({ - get foo(): z.ZodOptional { - return z.optional(zFoo); - } +export const zBar: z.AnyZodObject = z.object({ + foo: z.lazy(() => { + return zFoo; + }).optional() }); /** * This is Foo schema. */ -export const zFoo = z.union([ +export const zFoo: z.ZodTypeAny = z.union([ z.object({ - foo: z.optional(z.string().regex(/^\d{3}-\d{2}-\d{4}$/)), - bar: z.optional(zBar), - get baz(): z.ZodOptional { - return z.optional(z.array(z.lazy((): any => { - return zFoo; - }))); - }, - qux: z.optional(z.int().gt(0)).default(0) + foo: z.string().regex(/^\d{3}-\d{2}-\d{4}$/).optional(), + bar: zBar.optional(), + baz: z.array(z.lazy(() => { + return zFoo; + })).optional(), + qux: z.number().int().gt(0).optional().default(0) }), z.null() ]).default(null); export const zBaz = z.string().regex(/foo\nbar/).readonly().default('baz'); -export const zQux = z.record(z.string(), z.object({ - qux: z.optional(z.string()) +export const zQux = z.record(z.object({ + qux: z.string().optional() })); /** @@ -40,27 +38,27 @@ export const zQux = z.record(z.string(), z.object({ export const zFoo2 = z.string(); export const zFoo3 = z.object({ - foo: z.optional(zBar) + foo: zBar.optional() }); export const zPatchFooData = z.object({ body: z.object({ - foo: z.optional(z.string()) + foo: z.string().optional() }), - path: z.optional(z.never()), - query: z.optional(z.object({ - foo: z.optional(z.string()), - bar: z.optional(zBar), - baz: z.optional(z.object({ - baz: z.optional(z.string()) - })), - qux: z.optional(z.iso.date()), - quux: z.optional(z.iso.datetime()) - })) + path: z.never().optional(), + query: z.object({ + foo: z.string().optional(), + bar: zBar.optional(), + baz: z.object({ + baz: z.string().optional() + }).optional(), + qux: z.string().date().optional(), + quux: z.string().datetime().optional() + }).optional() }); export const zPostFooData = z.object({ body: zFoo3, - path: z.optional(z.never()), - query: z.optional(z.never()) + path: z.never().optional(), + query: z.never().optional() }); \ No newline at end of file -- 2.51.2