fork of hey-api/openapi-ts because I need some additional things
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

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)

MaxwellAt 91d91df0 9a8a56ca

+1149 -2388
+2
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/additional-properties-false/index.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + export * from './types.gen';
+15
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/additional-properties-false/types.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + export type Foo = { 4 + foo: string; 5 + }; 6 + 7 + export type Bar = Foo & {}; 8 + 9 + export type Baz = Foo & { 10 + bar: string; 11 + }; 12 + 13 + export type ClientOptions = { 14 + baseUrl: string; 15 + };
+2 -4
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/body-response-text-plain/client/client.ts
··· 143 143 }; 144 144 } 145 145 146 - const textError = await response.text(); 147 - let jsonError: unknown; 146 + let error = await response.text(); 148 147 149 148 try { 150 - jsonError = JSON.parse(textError); 149 + error = JSON.parse(error); 151 150 } catch { 152 151 // noop 153 152 } 154 153 155 - const error = jsonError ?? textError; 156 154 let finalError = error; 157 155 158 156 for (const fn of interceptors.error._fns) {
-10
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/body-response-text-plain/core/params.ts
··· 3 3 export type Field = 4 4 | { 5 5 in: Exclude<Slot, 'body'>; 6 - /** 7 - * Field name. This is the name we want the user to see and use. 8 - */ 9 6 key: string; 10 - /** 11 - * Field mapped name. This is the name we want to use in the request. 12 - * If omitted, we use the same value as `key`. 13 - */ 14 7 map?: string; 15 8 } 16 9 | { 17 10 in: Extract<Slot, 'body'>; 18 - /** 19 - * Key isn't required for bodies. 20 - */ 21 11 key?: string; 22 12 map?: string; 23 13 };
-14
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/body-response-text-plain/core/types.ts
··· 102 102 */ 103 103 responseValidator?: (data: unknown) => Promise<unknown>; 104 104 } 105 - 106 - type IsExactlyNeverOrNeverUndefined<T> = [T] extends [never] 107 - ? true 108 - : [T] extends [never | undefined] 109 - ? [undefined] extends [T] 110 - ? false 111 - : true 112 - : false; 113 - 114 - export type OmitNever<T extends Record<string, unknown>> = { 115 - [K in keyof T as IsExactlyNeverOrNeverUndefined<T[K]> extends true 116 - ? never 117 - : K]: T[K]; 118 - };
+13 -7
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/enum-names-values-javascript-PascalCase/types.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 + export type _110 = '1-10' | '11-20'; 4 + 3 5 export const _110 = { 4 6 110: '1-10', 5 7 1120: '11-20' 6 8 } as const; 7 9 8 - export type _110 = typeof _110[keyof typeof _110]; 10 + export type MyFoo = 'myFoo' | 'myBar'; 9 11 10 12 export const MyFoo = { 11 13 MyFoo: 'myFoo', 12 14 MyBar: 'myBar' 13 15 } as const; 14 16 15 - export type MyFoo = typeof MyFoo[keyof typeof MyFoo]; 17 + export type MyFoo2 = 'MyFoo' | 'MyBar'; 16 18 17 19 export const MyFoo2 = { 18 20 MyFoo: 'MyFoo', 19 21 MyBar: 'MyBar' 20 22 } as const; 21 23 22 - export type MyFoo2 = typeof MyFoo2[keyof typeof MyFoo2]; 24 + export type Foo = 'foo' | 'bar' | '' | true | false; 23 25 24 26 export const Foo = { 25 27 Foo: 'foo', ··· 29 31 False: false 30 32 } as const; 31 33 32 - export type Foo = typeof Foo[keyof typeof Foo]; 34 + export type Numbers = 100 | 200 | 300 | -100 | -200 | -300; 33 35 34 36 export const Numbers = { 35 37 100: 100, ··· 40 42 '-300': -300 41 43 } as const; 42 44 43 - export type Numbers = typeof Numbers[keyof typeof Numbers]; 45 + export type Arrays = [ 46 + 'foo' 47 + ] | [ 48 + 'bar' 49 + ] | [ 50 + 'baz' 51 + ]; 44 52 45 53 export const Arrays = { 46 54 0: ['foo'], 47 55 1: ['bar'], 48 56 2: ['baz'] 49 57 } as const; 50 - 51 - export type Arrays = typeof Arrays[keyof typeof Arrays]; 52 58 53 59 export type ClientOptions = { 54 60 baseUrl: string;
+13 -7
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/enum-names-values-javascript-SCREAMING_SNAKE_CASE/types.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 + export type _110 = '1-10' | '11-20'; 4 + 3 5 export const _110 = { 4 6 '1_10': '1-10', 5 7 '11_20': '11-20' 6 8 } as const; 7 9 8 - export type _110 = typeof _110[keyof typeof _110]; 10 + export type MyFoo = 'myFoo' | 'myBar'; 9 11 10 12 export const MyFoo = { 11 13 MY_FOO: 'myFoo', 12 14 MY_BAR: 'myBar' 13 15 } as const; 14 16 15 - export type MyFoo = typeof MyFoo[keyof typeof MyFoo]; 17 + export type MyFoo2 = 'MyFoo' | 'MyBar'; 16 18 17 19 export const MyFoo2 = { 18 20 MY_FOO: 'MyFoo', 19 21 MY_BAR: 'MyBar' 20 22 } as const; 21 23 22 - export type MyFoo2 = typeof MyFoo2[keyof typeof MyFoo2]; 24 + export type Foo = 'foo' | 'bar' | '' | true | false; 23 25 24 26 export const Foo = { 25 27 FOO: 'foo', ··· 29 31 FALSE: false 30 32 } as const; 31 33 32 - export type Foo = typeof Foo[keyof typeof Foo]; 34 + export type Numbers = 100 | 200 | 300 | -100 | -200 | -300; 33 35 34 36 export const Numbers = { 35 37 100: 100, ··· 40 42 '-300': -300 41 43 } as const; 42 44 43 - export type Numbers = typeof Numbers[keyof typeof Numbers]; 45 + export type Arrays = [ 46 + 'foo' 47 + ] | [ 48 + 'bar' 49 + ] | [ 50 + 'baz' 51 + ]; 44 52 45 53 export const Arrays = { 46 54 0: ['foo'], 47 55 1: ['bar'], 48 56 2: ['baz'] 49 57 } as const; 50 - 51 - export type Arrays = typeof Arrays[keyof typeof Arrays]; 52 58 53 59 export type ClientOptions = { 54 60 baseUrl: string;
+13 -7
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/enum-names-values-javascript-camelCase/types.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 + export type _110 = '1-10' | '11-20'; 4 + 3 5 export const _110 = { 4 6 110: '1-10', 5 7 1120: '11-20' 6 8 } as const; 7 9 8 - export type _110 = typeof _110[keyof typeof _110]; 10 + export type MyFoo = 'myFoo' | 'myBar'; 9 11 10 12 export const MyFoo = { 11 13 myFoo: 'myFoo', 12 14 myBar: 'myBar' 13 15 } as const; 14 16 15 - export type MyFoo = typeof MyFoo[keyof typeof MyFoo]; 17 + export type MyFoo2 = 'MyFoo' | 'MyBar'; 16 18 17 19 export const MyFoo2 = { 18 20 myFoo: 'MyFoo', 19 21 myBar: 'MyBar' 20 22 } as const; 21 23 22 - export type MyFoo2 = typeof MyFoo2[keyof typeof MyFoo2]; 24 + export type Foo = 'foo' | 'bar' | '' | true | false; 23 25 24 26 export const Foo = { 25 27 foo: 'foo', ··· 29 31 false: false 30 32 } as const; 31 33 32 - export type Foo = typeof Foo[keyof typeof Foo]; 34 + export type Numbers = 100 | 200 | 300 | -100 | -200 | -300; 33 35 34 36 export const Numbers = { 35 37 100: 100, ··· 40 42 '-300': -300 41 43 } as const; 42 44 43 - export type Numbers = typeof Numbers[keyof typeof Numbers]; 45 + export type Arrays = [ 46 + 'foo' 47 + ] | [ 48 + 'bar' 49 + ] | [ 50 + 'baz' 51 + ]; 44 52 45 53 export const Arrays = { 46 54 0: ['foo'], 47 55 1: ['bar'], 48 56 2: ['baz'] 49 57 } as const; 50 - 51 - export type Arrays = typeof Arrays[keyof typeof Arrays]; 52 58 53 59 export type ClientOptions = { 54 60 baseUrl: string;
+13 -7
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/enum-names-values-javascript-preserve/types.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 + export type _110 = '1-10' | '11-20'; 4 + 3 5 export const _110 = { 4 6 '1-10': '1-10', 5 7 '11-20': '11-20' 6 8 } as const; 7 9 8 - export type _110 = typeof _110[keyof typeof _110]; 10 + export type MyFoo = 'myFoo' | 'myBar'; 9 11 10 12 export const MyFoo = { 11 13 myFoo: 'myFoo', 12 14 myBar: 'myBar' 13 15 } as const; 14 16 15 - export type MyFoo = typeof MyFoo[keyof typeof MyFoo]; 17 + export type MyFoo2 = 'MyFoo' | 'MyBar'; 16 18 17 19 export const MyFoo2 = { 18 20 MyFoo: 'MyFoo', 19 21 MyBar: 'MyBar' 20 22 } as const; 21 23 22 - export type MyFoo2 = typeof MyFoo2[keyof typeof MyFoo2]; 24 + export type Foo = 'foo' | 'bar' | '' | true | false; 23 25 24 26 export const Foo = { 25 27 foo: 'foo', ··· 29 31 false: false 30 32 } as const; 31 33 32 - export type Foo = typeof Foo[keyof typeof Foo]; 34 + export type Numbers = 100 | 200 | 300 | -100 | -200 | -300; 33 35 34 36 export const Numbers = { 35 37 100: 100, ··· 40 42 '-300': -300 41 43 } as const; 42 44 43 - export type Numbers = typeof Numbers[keyof typeof Numbers]; 45 + export type Arrays = [ 46 + 'foo' 47 + ] | [ 48 + 'bar' 49 + ] | [ 50 + 'baz' 51 + ]; 44 52 45 53 export const Arrays = { 46 54 0: ['foo'], 47 55 1: ['bar'], 48 56 2: ['baz'] 49 57 } as const; 50 - 51 - export type Arrays = typeof Arrays[keyof typeof Arrays]; 52 58 53 59 export type ClientOptions = { 54 60 baseUrl: string;
+13 -7
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/enum-names-values-javascript-snake_case/types.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 + export type _110 = '1-10' | '11-20'; 4 + 3 5 export const _110 = { 4 6 '1_10': '1-10', 5 7 '11_20': '11-20' 6 8 } as const; 7 9 8 - export type _110 = typeof _110[keyof typeof _110]; 10 + export type MyFoo = 'myFoo' | 'myBar'; 9 11 10 12 export const MyFoo = { 11 13 my_foo: 'myFoo', 12 14 my_bar: 'myBar' 13 15 } as const; 14 16 15 - export type MyFoo = typeof MyFoo[keyof typeof MyFoo]; 17 + export type MyFoo2 = 'MyFoo' | 'MyBar'; 16 18 17 19 export const MyFoo2 = { 18 20 my_foo: 'MyFoo', 19 21 my_bar: 'MyBar' 20 22 } as const; 21 23 22 - export type MyFoo2 = typeof MyFoo2[keyof typeof MyFoo2]; 24 + export type Foo = 'foo' | 'bar' | '' | true | false; 23 25 24 26 export const Foo = { 25 27 foo: 'foo', ··· 29 31 false: false 30 32 } as const; 31 33 32 - export type Foo = typeof Foo[keyof typeof Foo]; 34 + export type Numbers = 100 | 200 | 300 | -100 | -200 | -300; 33 35 34 36 export const Numbers = { 35 37 100: 100, ··· 40 42 '-300': -300 41 43 } as const; 42 44 43 - export type Numbers = typeof Numbers[keyof typeof Numbers]; 45 + export type Arrays = [ 46 + 'foo' 47 + ] | [ 48 + 'bar' 49 + ] | [ 50 + 'baz' 51 + ]; 44 52 45 53 export const Arrays = { 46 54 0: ['foo'], 47 55 1: ['bar'], 48 56 2: ['baz'] 49 57 } as const; 50 - 51 - export type Arrays = typeof Arrays[keyof typeof Arrays]; 52 58 53 59 export type ClientOptions = { 54 60 baseUrl: string;
+2 -4
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/form-data/client/client.ts
··· 143 143 }; 144 144 } 145 145 146 - const textError = await response.text(); 147 - let jsonError: unknown; 146 + let error = await response.text(); 148 147 149 148 try { 150 - jsonError = JSON.parse(textError); 149 + error = JSON.parse(error); 151 150 } catch { 152 151 // noop 153 152 } 154 153 155 - const error = jsonError ?? textError; 156 154 let finalError = error; 157 155 158 156 for (const fn of interceptors.error._fns) {
-10
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/form-data/core/params.ts
··· 3 3 export type Field = 4 4 | { 5 5 in: Exclude<Slot, 'body'>; 6 - /** 7 - * Field name. This is the name we want the user to see and use. 8 - */ 9 6 key: string; 10 - /** 11 - * Field mapped name. This is the name we want to use in the request. 12 - * If omitted, we use the same value as `key`. 13 - */ 14 7 map?: string; 15 8 } 16 9 | { 17 10 in: Extract<Slot, 'body'>; 18 - /** 19 - * Key isn't required for bodies. 20 - */ 21 11 key?: string; 22 12 map?: string; 23 13 };
-14
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/form-data/core/types.ts
··· 102 102 */ 103 103 responseValidator?: (data: unknown) => Promise<unknown>; 104 104 } 105 - 106 - type IsExactlyNeverOrNeverUndefined<T> = [T] extends [never] 107 - ? true 108 - : [T] extends [never | undefined] 109 - ? [undefined] extends [T] 110 - ? false 111 - : true 112 - : false; 113 - 114 - export type OmitNever<T extends Record<string, unknown>> = { 115 - [K in keyof T as IsExactlyNeverOrNeverUndefined<T[K]> extends true 116 - ? never 117 - : K]: T[K]; 118 - };
+2 -4
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/schema-unknown/client/client.ts
··· 143 143 }; 144 144 } 145 145 146 - const textError = await response.text(); 147 - let jsonError: unknown; 146 + let error = await response.text(); 148 147 149 148 try { 150 - jsonError = JSON.parse(textError); 149 + error = JSON.parse(error); 151 150 } catch { 152 151 // noop 153 152 } 154 153 155 - const error = jsonError ?? textError; 156 154 let finalError = error; 157 155 158 156 for (const fn of interceptors.error._fns) {
-10
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/schema-unknown/core/params.ts
··· 3 3 export type Field = 4 4 | { 5 5 in: Exclude<Slot, 'body'>; 6 - /** 7 - * Field name. This is the name we want the user to see and use. 8 - */ 9 6 key: string; 10 - /** 11 - * Field mapped name. This is the name we want to use in the request. 12 - * If omitted, we use the same value as `key`. 13 - */ 14 7 map?: string; 15 8 } 16 9 | { 17 10 in: Extract<Slot, 'body'>; 18 - /** 19 - * Key isn't required for bodies. 20 - */ 21 11 key?: string; 22 12 map?: string; 23 13 };
-14
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/schema-unknown/core/types.ts
··· 102 102 */ 103 103 responseValidator?: (data: unknown) => Promise<unknown>; 104 104 } 105 - 106 - type IsExactlyNeverOrNeverUndefined<T> = [T] extends [never] 107 - ? true 108 - : [T] extends [never | undefined] 109 - ? [undefined] extends [T] 110 - ? false 111 - : true 112 - : false; 113 - 114 - export type OmitNever<T extends Record<string, unknown>> = { 115 - [K in keyof T as IsExactlyNeverOrNeverUndefined<T[K]> extends true 116 - ? never 117 - : K]: T[K]; 118 - };
+2 -4
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-api-key/client/client.ts
··· 143 143 }; 144 144 } 145 145 146 - const textError = await response.text(); 147 - let jsonError: unknown; 146 + let error = await response.text(); 148 147 149 148 try { 150 - jsonError = JSON.parse(textError); 149 + error = JSON.parse(error); 151 150 } catch { 152 151 // noop 153 152 } 154 153 155 - const error = jsonError ?? textError; 156 154 let finalError = error; 157 155 158 156 for (const fn of interceptors.error._fns) {
-10
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-api-key/core/params.ts
··· 3 3 export type Field = 4 4 | { 5 5 in: Exclude<Slot, 'body'>; 6 - /** 7 - * Field name. This is the name we want the user to see and use. 8 - */ 9 6 key: string; 10 - /** 11 - * Field mapped name. This is the name we want to use in the request. 12 - * If omitted, we use the same value as `key`. 13 - */ 14 7 map?: string; 15 8 } 16 9 | { 17 10 in: Extract<Slot, 'body'>; 18 - /** 19 - * Key isn't required for bodies. 20 - */ 21 11 key?: string; 22 12 map?: string; 23 13 };
-14
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-api-key/core/types.ts
··· 102 102 */ 103 103 responseValidator?: (data: unknown) => Promise<unknown>; 104 104 } 105 - 106 - type IsExactlyNeverOrNeverUndefined<T> = [T] extends [never] 107 - ? true 108 - : [T] extends [never | undefined] 109 - ? [undefined] extends [T] 110 - ? false 111 - : true 112 - : false; 113 - 114 - export type OmitNever<T extends Record<string, unknown>> = { 115 - [K in keyof T as IsExactlyNeverOrNeverUndefined<T[K]> extends true 116 - ? never 117 - : K]: T[K]; 118 - };
+2 -4
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-basic/client/client.ts
··· 143 143 }; 144 144 } 145 145 146 - const textError = await response.text(); 147 - let jsonError: unknown; 146 + let error = await response.text(); 148 147 149 148 try { 150 - jsonError = JSON.parse(textError); 149 + error = JSON.parse(error); 151 150 } catch { 152 151 // noop 153 152 } 154 153 155 - const error = jsonError ?? textError; 156 154 let finalError = error; 157 155 158 156 for (const fn of interceptors.error._fns) {
-10
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-basic/core/params.ts
··· 3 3 export type Field = 4 4 | { 5 5 in: Exclude<Slot, 'body'>; 6 - /** 7 - * Field name. This is the name we want the user to see and use. 8 - */ 9 6 key: string; 10 - /** 11 - * Field mapped name. This is the name we want to use in the request. 12 - * If omitted, we use the same value as `key`. 13 - */ 14 7 map?: string; 15 8 } 16 9 | { 17 10 in: Extract<Slot, 'body'>; 18 - /** 19 - * Key isn't required for bodies. 20 - */ 21 11 key?: string; 22 12 map?: string; 23 13 };
-14
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-basic/core/types.ts
··· 102 102 */ 103 103 responseValidator?: (data: unknown) => Promise<unknown>; 104 104 } 105 - 106 - type IsExactlyNeverOrNeverUndefined<T> = [T] extends [never] 107 - ? true 108 - : [T] extends [never | undefined] 109 - ? [undefined] extends [T] 110 - ? false 111 - : true 112 - : false; 113 - 114 - export type OmitNever<T extends Record<string, unknown>> = { 115 - [K in keyof T as IsExactlyNeverOrNeverUndefined<T[K]> extends true 116 - ? never 117 - : K]: T[K]; 118 - };
+2 -4
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-false/client/client.ts
··· 143 143 }; 144 144 } 145 145 146 - const textError = await response.text(); 147 - let jsonError: unknown; 146 + let error = await response.text(); 148 147 149 148 try { 150 - jsonError = JSON.parse(textError); 149 + error = JSON.parse(error); 151 150 } catch { 152 151 // noop 153 152 } 154 153 155 - const error = jsonError ?? textError; 156 154 let finalError = error; 157 155 158 156 for (const fn of interceptors.error._fns) {
-10
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-false/core/params.ts
··· 3 3 export type Field = 4 4 | { 5 5 in: Exclude<Slot, 'body'>; 6 - /** 7 - * Field name. This is the name we want the user to see and use. 8 - */ 9 6 key: string; 10 - /** 11 - * Field mapped name. This is the name we want to use in the request. 12 - * If omitted, we use the same value as `key`. 13 - */ 14 7 map?: string; 15 8 } 16 9 | { 17 10 in: Extract<Slot, 'body'>; 18 - /** 19 - * Key isn't required for bodies. 20 - */ 21 11 key?: string; 22 12 map?: string; 23 13 };
-14
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-false/core/types.ts
··· 102 102 */ 103 103 responseValidator?: (data: unknown) => Promise<unknown>; 104 104 } 105 - 106 - type IsExactlyNeverOrNeverUndefined<T> = [T] extends [never] 107 - ? true 108 - : [T] extends [never | undefined] 109 - ? [undefined] extends [T] 110 - ? false 111 - : true 112 - : false; 113 - 114 - export type OmitNever<T extends Record<string, unknown>> = { 115 - [K in keyof T as IsExactlyNeverOrNeverUndefined<T[K]> extends true 116 - ? never 117 - : K]: T[K]; 118 - };
+2 -4
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-oauth2/client/client.ts
··· 143 143 }; 144 144 } 145 145 146 - const textError = await response.text(); 147 - let jsonError: unknown; 146 + let error = await response.text(); 148 147 149 148 try { 150 - jsonError = JSON.parse(textError); 149 + error = JSON.parse(error); 151 150 } catch { 152 151 // noop 153 152 } 154 153 155 - const error = jsonError ?? textError; 156 154 let finalError = error; 157 155 158 156 for (const fn of interceptors.error._fns) {
-10
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-oauth2/core/params.ts
··· 3 3 export type Field = 4 4 | { 5 5 in: Exclude<Slot, 'body'>; 6 - /** 7 - * Field name. This is the name we want the user to see and use. 8 - */ 9 6 key: string; 10 - /** 11 - * Field mapped name. This is the name we want to use in the request. 12 - * If omitted, we use the same value as `key`. 13 - */ 14 7 map?: string; 15 8 } 16 9 | { 17 10 in: Extract<Slot, 'body'>; 18 - /** 19 - * Key isn't required for bodies. 20 - */ 21 11 key?: string; 22 12 map?: string; 23 13 };
-14
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-oauth2/core/types.ts
··· 102 102 */ 103 103 responseValidator?: (data: unknown) => Promise<unknown>; 104 104 } 105 - 106 - type IsExactlyNeverOrNeverUndefined<T> = [T] extends [never] 107 - ? true 108 - : [T] extends [never | undefined] 109 - ? [undefined] extends [T] 110 - ? false 111 - : true 112 - : false; 113 - 114 - export type OmitNever<T extends Record<string, unknown>> = { 115 - [K in keyof T as IsExactlyNeverOrNeverUndefined<T[K]> extends true 116 - ? never 117 - : K]: T[K]; 118 - };
+2 -4
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/servers-base-path/client/client.ts
··· 143 143 }; 144 144 } 145 145 146 - const textError = await response.text(); 147 - let jsonError: unknown; 146 + let error = await response.text(); 148 147 149 148 try { 150 - jsonError = JSON.parse(textError); 149 + error = JSON.parse(error); 151 150 } catch { 152 151 // noop 153 152 } 154 153 155 - const error = jsonError ?? textError; 156 154 let finalError = error; 157 155 158 156 for (const fn of interceptors.error._fns) {
-10
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/servers-base-path/core/params.ts
··· 3 3 export type Field = 4 4 | { 5 5 in: Exclude<Slot, 'body'>; 6 - /** 7 - * Field name. This is the name we want the user to see and use. 8 - */ 9 6 key: string; 10 - /** 11 - * Field mapped name. This is the name we want to use in the request. 12 - * If omitted, we use the same value as `key`. 13 - */ 14 7 map?: string; 15 8 } 16 9 | { 17 10 in: Extract<Slot, 'body'>; 18 - /** 19 - * Key isn't required for bodies. 20 - */ 21 11 key?: string; 22 12 map?: string; 23 13 };
-14
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/servers-base-path/core/types.ts
··· 102 102 */ 103 103 responseValidator?: (data: unknown) => Promise<unknown>; 104 104 } 105 - 106 - type IsExactlyNeverOrNeverUndefined<T> = [T] extends [never] 107 - ? true 108 - : [T] extends [never | undefined] 109 - ? [undefined] extends [T] 110 - ? false 111 - : true 112 - : false; 113 - 114 - export type OmitNever<T extends Record<string, unknown>> = { 115 - [K in keyof T as IsExactlyNeverOrNeverUndefined<T[K]> extends true 116 - ? never 117 - : K]: T[K]; 118 - };
+2 -4
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/servers-host/client/client.ts
··· 143 143 }; 144 144 } 145 145 146 - const textError = await response.text(); 147 - let jsonError: unknown; 146 + let error = await response.text(); 148 147 149 148 try { 150 - jsonError = JSON.parse(textError); 149 + error = JSON.parse(error); 151 150 } catch { 152 151 // noop 153 152 } 154 153 155 - const error = jsonError ?? textError; 156 154 let finalError = error; 157 155 158 156 for (const fn of interceptors.error._fns) {
-10
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/servers-host/core/params.ts
··· 3 3 export type Field = 4 4 | { 5 5 in: Exclude<Slot, 'body'>; 6 - /** 7 - * Field name. This is the name we want the user to see and use. 8 - */ 9 6 key: string; 10 - /** 11 - * Field mapped name. This is the name we want to use in the request. 12 - * If omitted, we use the same value as `key`. 13 - */ 14 7 map?: string; 15 8 } 16 9 | { 17 10 in: Extract<Slot, 'body'>; 18 - /** 19 - * Key isn't required for bodies. 20 - */ 21 11 key?: string; 22 12 map?: string; 23 13 };
-14
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/servers-host/core/types.ts
··· 102 102 */ 103 103 responseValidator?: (data: unknown) => Promise<unknown>; 104 104 } 105 - 106 - type IsExactlyNeverOrNeverUndefined<T> = [T] extends [never] 107 - ? true 108 - : [T] extends [never | undefined] 109 - ? [undefined] extends [T] 110 - ? false 111 - : true 112 - : false; 113 - 114 - export type OmitNever<T extends Record<string, unknown>> = { 115 - [K in keyof T as IsExactlyNeverOrNeverUndefined<T[K]> extends true 116 - ? never 117 - : K]: T[K]; 118 - };
+2 -4
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/servers/client/client.ts
··· 143 143 }; 144 144 } 145 145 146 - const textError = await response.text(); 147 - let jsonError: unknown; 146 + let error = await response.text(); 148 147 149 148 try { 150 - jsonError = JSON.parse(textError); 149 + error = JSON.parse(error); 151 150 } catch { 152 151 // noop 153 152 } 154 153 155 - const error = jsonError ?? textError; 156 154 let finalError = error; 157 155 158 156 for (const fn of interceptors.error._fns) {
-10
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/servers/core/params.ts
··· 3 3 export type Field = 4 4 | { 5 5 in: Exclude<Slot, 'body'>; 6 - /** 7 - * Field name. This is the name we want the user to see and use. 8 - */ 9 6 key: string; 10 - /** 11 - * Field mapped name. This is the name we want to use in the request. 12 - * If omitted, we use the same value as `key`. 13 - */ 14 7 map?: string; 15 8 } 16 9 | { 17 10 in: Extract<Slot, 'body'>; 18 - /** 19 - * Key isn't required for bodies. 20 - */ 21 11 key?: string; 22 12 map?: string; 23 13 };
-14
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/servers/core/types.ts
··· 102 102 */ 103 103 responseValidator?: (data: unknown) => Promise<unknown>; 104 104 } 105 - 106 - type IsExactlyNeverOrNeverUndefined<T> = [T] extends [never] 107 - ? true 108 - : [T] extends [never | undefined] 109 - ? [undefined] extends [T] 110 - ? false 111 - : true 112 - : false; 113 - 114 - export type OmitNever<T extends Record<string, unknown>> = { 115 - [K in keyof T as IsExactlyNeverOrNeverUndefined<T[K]> extends true 116 - ? never 117 - : K]: T[K]; 118 - };
+2 -4
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/transforms-read-write/client/client.ts
··· 143 143 }; 144 144 } 145 145 146 - const textError = await response.text(); 147 - let jsonError: unknown; 146 + let error = await response.text(); 148 147 149 148 try { 150 - jsonError = JSON.parse(textError); 149 + error = JSON.parse(error); 151 150 } catch { 152 151 // noop 153 152 } 154 153 155 - const error = jsonError ?? textError; 156 154 let finalError = error; 157 155 158 156 for (const fn of interceptors.error._fns) {
-10
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/transforms-read-write/core/params.ts
··· 3 3 export type Field = 4 4 | { 5 5 in: Exclude<Slot, 'body'>; 6 - /** 7 - * Field name. This is the name we want the user to see and use. 8 - */ 9 6 key: string; 10 - /** 11 - * Field mapped name. This is the name we want to use in the request. 12 - * If omitted, we use the same value as `key`. 13 - */ 14 7 map?: string; 15 8 } 16 9 | { 17 10 in: Extract<Slot, 'body'>; 18 - /** 19 - * Key isn't required for bodies. 20 - */ 21 11 key?: string; 22 12 map?: string; 23 13 };
-14
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/transforms-read-write/core/types.ts
··· 102 102 */ 103 103 responseValidator?: (data: unknown) => Promise<unknown>; 104 104 } 105 - 106 - type IsExactlyNeverOrNeverUndefined<T> = [T] extends [never] 107 - ? true 108 - : [T] extends [never | undefined] 109 - ? [undefined] extends [T] 110 - ? false 111 - : true 112 - : false; 113 - 114 - export type OmitNever<T extends Record<string, unknown>> = { 115 - [K in keyof T as IsExactlyNeverOrNeverUndefined<T[K]> extends true 116 - ? never 117 - : K]: T[K]; 118 - };
+2 -4
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/body-response-text-plain/client/client.ts
··· 143 143 }; 144 144 } 145 145 146 - const textError = await response.text(); 147 - let jsonError: unknown; 146 + let error = await response.text(); 148 147 149 148 try { 150 - jsonError = JSON.parse(textError); 149 + error = JSON.parse(error); 151 150 } catch { 152 151 // noop 153 152 } 154 153 155 - const error = jsonError ?? textError; 156 154 let finalError = error; 157 155 158 156 for (const fn of interceptors.error._fns) {
-10
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/body-response-text-plain/core/params.ts
··· 3 3 export type Field = 4 4 | { 5 5 in: Exclude<Slot, 'body'>; 6 - /** 7 - * Field name. This is the name we want the user to see and use. 8 - */ 9 6 key: string; 10 - /** 11 - * Field mapped name. This is the name we want to use in the request. 12 - * If omitted, we use the same value as `key`. 13 - */ 14 7 map?: string; 15 8 } 16 9 | { 17 10 in: Extract<Slot, 'body'>; 18 - /** 19 - * Key isn't required for bodies. 20 - */ 21 11 key?: string; 22 12 map?: string; 23 13 };
-14
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/body-response-text-plain/core/types.ts
··· 102 102 */ 103 103 responseValidator?: (data: unknown) => Promise<unknown>; 104 104 } 105 - 106 - type IsExactlyNeverOrNeverUndefined<T> = [T] extends [never] 107 - ? true 108 - : [T] extends [never | undefined] 109 - ? [undefined] extends [T] 110 - ? false 111 - : true 112 - : false; 113 - 114 - export type OmitNever<T extends Record<string, unknown>> = { 115 - [K in keyof T as IsExactlyNeverOrNeverUndefined<T[K]> extends true 116 - ? never 117 - : K]: T[K]; 118 - };
+3 -3
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/case-preserve/types.gen.ts
··· 51 51 */ 52 52 export type FooBar = string; 53 53 54 - export type getFooData = { 54 + export type GetFooData = { 55 55 body: Foo; 56 56 path?: never; 57 57 query: { ··· 71 71 url: '/foo'; 72 72 }; 73 73 74 - export type getFooResponses = { 74 + export type GetFooResponses = { 75 75 /** 76 76 * OK 77 77 */ ··· 82 82 201: _201; 83 83 }; 84 84 85 - export type getFooResponse = getFooResponses[keyof getFooResponses]; 85 + export type GetFooResponse = GetFooResponses[keyof GetFooResponses]; 86 86 87 87 export type ClientOptions = { 88 88 baseUrl: `${string}://${string}` | (string & {});
+4 -10
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/content-types/client/client.ts
··· 1 - import type { AxiosError, AxiosInstance, RawAxiosRequestHeaders } from 'axios'; 1 + import type { AxiosError, RawAxiosRequestHeaders } from 'axios'; 2 2 import axios from 'axios'; 3 3 4 4 import type { Client, Config } from './types'; ··· 13 13 export const createClient = (config: Config = {}): Client => { 14 14 let _config = mergeConfigs(createConfig(), config); 15 15 16 - let instance: AxiosInstance; 17 - 18 - if (_config.axios && !('Axios' in _config.axios)) { 19 - instance = _config.axios; 20 - } else { 21 - // eslint-disable-next-line @typescript-eslint/no-unused-vars 22 - const { auth, ...configWithoutAuth } = _config; 23 - instance = axios.create(configWithoutAuth); 24 - } 16 + // eslint-disable-next-line @typescript-eslint/no-unused-vars 17 + const { auth, ...configWithoutAuth } = _config; 18 + const instance = axios.create(configWithoutAuth); 25 19 26 20 const getConfig = (): Config => ({ ..._config }); 27 21
+4 -5
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/content-types/client/types.ts
··· 1 1 import type { 2 2 AxiosError, 3 3 AxiosInstance, 4 - AxiosRequestHeaders, 5 4 AxiosResponse, 6 5 AxiosStatic, 7 6 CreateAxiosDefaults, ··· 17 16 extends Omit<CreateAxiosDefaults, 'auth' | 'baseURL' | 'headers' | 'method'>, 18 17 CoreConfig { 19 18 /** 20 - * Axios implementation. You can use this option to provide either an 21 - * `AxiosStatic` or an `AxiosInstance`. 19 + * Axios implementation. You can use this option to provide a custom 20 + * Axios instance. 22 21 * 23 22 * @default axios 24 23 */ 25 - axios?: AxiosStatic | AxiosInstance; 24 + axios?: AxiosStatic; 26 25 /** 27 26 * Base URL for all requests made by this client. 28 27 */ ··· 34 33 * {@link https://developer.mozilla.org/docs/Web/API/Headers/Headers#init See more} 35 34 */ 36 35 headers?: 37 - | AxiosRequestHeaders 36 + | CreateAxiosDefaults['headers'] 38 37 | Record< 39 38 string, 40 39 | string
-10
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/content-types/core/params.ts
··· 3 3 export type Field = 4 4 | { 5 5 in: Exclude<Slot, 'body'>; 6 - /** 7 - * Field name. This is the name we want the user to see and use. 8 - */ 9 6 key: string; 10 - /** 11 - * Field mapped name. This is the name we want to use in the request. 12 - * If omitted, we use the same value as `key`. 13 - */ 14 7 map?: string; 15 8 } 16 9 | { 17 10 in: Extract<Slot, 'body'>; 18 - /** 19 - * Key isn't required for bodies. 20 - */ 21 11 key?: string; 22 12 map?: string; 23 13 };
-14
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/content-types/core/types.ts
··· 102 102 */ 103 103 responseValidator?: (data: unknown) => Promise<unknown>; 104 104 } 105 - 106 - type IsExactlyNeverOrNeverUndefined<T> = [T] extends [never] 107 - ? true 108 - : [T] extends [never | undefined] 109 - ? [undefined] extends [T] 110 - ? false 111 - : true 112 - : false; 113 - 114 - export type OmitNever<T extends Record<string, unknown>> = { 115 - [K in keyof T as IsExactlyNeverOrNeverUndefined<T[K]> extends true 116 - ? never 117 - : K]: T[K]; 118 - };
+2 -2
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/enum-inline-javascript/types.gen.ts
··· 4 4 type?: TypeEnum; 5 5 }; 6 6 7 + export type TypeEnum = 'foo' | 'bar'; 8 + 7 9 export const TypeEnum = { 8 10 FOO: 'foo', 9 11 BAR: 'bar' 10 12 } as const; 11 - 12 - export type TypeEnum = typeof TypeEnum[keyof typeof TypeEnum]; 13 13 14 14 export type ClientOptions = { 15 15 baseUrl: `${string}://${string}` | (string & {});
+13 -7
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/enum-names-values-javascript-PascalCase/types.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 + export type _110 = '1-10' | '11-20'; 4 + 3 5 export const _110 = { 4 6 110: '1-10', 5 7 1120: '11-20' 6 8 } as const; 7 9 8 - export type _110 = typeof _110[keyof typeof _110]; 10 + export type MyFoo = 'myFoo' | 'myBar'; 9 11 10 12 export const MyFoo = { 11 13 MyFoo: 'myFoo', 12 14 MyBar: 'myBar' 13 15 } as const; 14 16 15 - export type MyFoo = typeof MyFoo[keyof typeof MyFoo]; 17 + export type MyFoo2 = 'MyFoo' | 'MyBar'; 16 18 17 19 export const MyFoo2 = { 18 20 MyFoo: 'MyFoo', 19 21 MyBar: 'MyBar' 20 22 } as const; 21 23 22 - export type MyFoo2 = typeof MyFoo2[keyof typeof MyFoo2]; 24 + export type Foo = 'foo' | 'bar' | null | '' | true | false; 23 25 24 26 export const Foo = { 25 27 Foo: 'foo', ··· 30 32 False: false 31 33 } as const; 32 34 33 - export type Foo = typeof Foo[keyof typeof Foo]; 35 + export type Numbers = 100 | 200 | 300 | -100 | -200 | -300; 34 36 35 37 export const Numbers = { 36 38 100: 100, ··· 41 43 '-300': -300 42 44 } as const; 43 45 44 - export type Numbers = typeof Numbers[keyof typeof Numbers]; 46 + export type Arrays = [ 47 + 'foo' 48 + ] | [ 49 + 'bar' 50 + ] | [ 51 + 'baz' 52 + ]; 45 53 46 54 export const Arrays = { 47 55 0: ['foo'], 48 56 1: ['bar'], 49 57 2: ['baz'] 50 58 } as const; 51 - 52 - export type Arrays = typeof Arrays[keyof typeof Arrays]; 53 59 54 60 export type ClientOptions = { 55 61 baseUrl: `${string}://${string}` | (string & {});
+13 -7
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/enum-names-values-javascript-SCREAMING_SNAKE_CASE/types.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 + export type _110 = '1-10' | '11-20'; 4 + 3 5 export const _110 = { 4 6 '1_10': '1-10', 5 7 '11_20': '11-20' 6 8 } as const; 7 9 8 - export type _110 = typeof _110[keyof typeof _110]; 10 + export type MyFoo = 'myFoo' | 'myBar'; 9 11 10 12 export const MyFoo = { 11 13 MY_FOO: 'myFoo', 12 14 MY_BAR: 'myBar' 13 15 } as const; 14 16 15 - export type MyFoo = typeof MyFoo[keyof typeof MyFoo]; 17 + export type MyFoo2 = 'MyFoo' | 'MyBar'; 16 18 17 19 export const MyFoo2 = { 18 20 MY_FOO: 'MyFoo', 19 21 MY_BAR: 'MyBar' 20 22 } as const; 21 23 22 - export type MyFoo2 = typeof MyFoo2[keyof typeof MyFoo2]; 24 + export type Foo = 'foo' | 'bar' | null | '' | true | false; 23 25 24 26 export const Foo = { 25 27 FOO: 'foo', ··· 30 32 FALSE: false 31 33 } as const; 32 34 33 - export type Foo = typeof Foo[keyof typeof Foo]; 35 + export type Numbers = 100 | 200 | 300 | -100 | -200 | -300; 34 36 35 37 export const Numbers = { 36 38 100: 100, ··· 41 43 '-300': -300 42 44 } as const; 43 45 44 - export type Numbers = typeof Numbers[keyof typeof Numbers]; 46 + export type Arrays = [ 47 + 'foo' 48 + ] | [ 49 + 'bar' 50 + ] | [ 51 + 'baz' 52 + ]; 45 53 46 54 export const Arrays = { 47 55 0: ['foo'], 48 56 1: ['bar'], 49 57 2: ['baz'] 50 58 } as const; 51 - 52 - export type Arrays = typeof Arrays[keyof typeof Arrays]; 53 59 54 60 export type ClientOptions = { 55 61 baseUrl: `${string}://${string}` | (string & {});
+13 -7
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/enum-names-values-javascript-camelCase/types.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 + export type _110 = '1-10' | '11-20'; 4 + 3 5 export const _110 = { 4 6 110: '1-10', 5 7 1120: '11-20' 6 8 } as const; 7 9 8 - export type _110 = typeof _110[keyof typeof _110]; 10 + export type MyFoo = 'myFoo' | 'myBar'; 9 11 10 12 export const MyFoo = { 11 13 myFoo: 'myFoo', 12 14 myBar: 'myBar' 13 15 } as const; 14 16 15 - export type MyFoo = typeof MyFoo[keyof typeof MyFoo]; 17 + export type MyFoo2 = 'MyFoo' | 'MyBar'; 16 18 17 19 export const MyFoo2 = { 18 20 myFoo: 'MyFoo', 19 21 myBar: 'MyBar' 20 22 } as const; 21 23 22 - export type MyFoo2 = typeof MyFoo2[keyof typeof MyFoo2]; 24 + export type Foo = 'foo' | 'bar' | null | '' | true | false; 23 25 24 26 export const Foo = { 25 27 foo: 'foo', ··· 30 32 false: false 31 33 } as const; 32 34 33 - export type Foo = typeof Foo[keyof typeof Foo]; 35 + export type Numbers = 100 | 200 | 300 | -100 | -200 | -300; 34 36 35 37 export const Numbers = { 36 38 100: 100, ··· 41 43 '-300': -300 42 44 } as const; 43 45 44 - export type Numbers = typeof Numbers[keyof typeof Numbers]; 46 + export type Arrays = [ 47 + 'foo' 48 + ] | [ 49 + 'bar' 50 + ] | [ 51 + 'baz' 52 + ]; 45 53 46 54 export const Arrays = { 47 55 0: ['foo'], 48 56 1: ['bar'], 49 57 2: ['baz'] 50 58 } as const; 51 - 52 - export type Arrays = typeof Arrays[keyof typeof Arrays]; 53 59 54 60 export type ClientOptions = { 55 61 baseUrl: `${string}://${string}` | (string & {});
+13 -7
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/enum-names-values-javascript-ignore-null/types.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 + export type _110 = '1-10' | '11-20'; 4 + 3 5 export const _110 = { 4 6 '1-10': '1-10', 5 7 '11-20': '11-20' 6 8 } as const; 7 9 8 - export type _110 = typeof _110[keyof typeof _110]; 10 + export type MyFoo = 'myFoo' | 'myBar'; 9 11 10 12 export const MyFoo = { 11 13 myFoo: 'myFoo', 12 14 myBar: 'myBar' 13 15 } as const; 14 16 15 - export type MyFoo = typeof MyFoo[keyof typeof MyFoo]; 17 + export type MyFoo2 = 'MyFoo' | 'MyBar'; 16 18 17 19 export const MyFoo2 = { 18 20 MyFoo: 'MyFoo', 19 21 MyBar: 'MyBar' 20 22 } as const; 21 23 22 - export type MyFoo2 = typeof MyFoo2[keyof typeof MyFoo2]; 24 + export type Foo = 'foo' | 'bar' | null | '' | true | false; 23 25 24 26 export const Foo = { 25 27 foo: 'foo', ··· 29 31 false: false 30 32 } as const; 31 33 32 - export type Foo = typeof Foo[keyof typeof Foo]; 34 + export type Numbers = 100 | 200 | 300 | -100 | -200 | -300; 33 35 34 36 export const Numbers = { 35 37 100: 100, ··· 40 42 '-300': -300 41 43 } as const; 42 44 43 - export type Numbers = typeof Numbers[keyof typeof Numbers]; 45 + export type Arrays = [ 46 + 'foo' 47 + ] | [ 48 + 'bar' 49 + ] | [ 50 + 'baz' 51 + ]; 44 52 45 53 export const Arrays = { 46 54 0: ['foo'], 47 55 1: ['bar'], 48 56 2: ['baz'] 49 57 } as const; 50 - 51 - export type Arrays = typeof Arrays[keyof typeof Arrays]; 52 58 53 59 export type ClientOptions = { 54 60 baseUrl: `${string}://${string}` | (string & {});
+13 -7
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/enum-names-values-javascript-preserve/types.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 + export type _110 = '1-10' | '11-20'; 4 + 3 5 export const _110 = { 4 6 '1-10': '1-10', 5 7 '11-20': '11-20' 6 8 } as const; 7 9 8 - export type _110 = typeof _110[keyof typeof _110]; 10 + export type MyFoo = 'myFoo' | 'myBar'; 9 11 10 12 export const MyFoo = { 11 13 myFoo: 'myFoo', 12 14 myBar: 'myBar' 13 15 } as const; 14 16 15 - export type MyFoo = typeof MyFoo[keyof typeof MyFoo]; 17 + export type MyFoo2 = 'MyFoo' | 'MyBar'; 16 18 17 19 export const MyFoo2 = { 18 20 MyFoo: 'MyFoo', 19 21 MyBar: 'MyBar' 20 22 } as const; 21 23 22 - export type MyFoo2 = typeof MyFoo2[keyof typeof MyFoo2]; 24 + export type Foo = 'foo' | 'bar' | null | '' | true | false; 23 25 24 26 export const Foo = { 25 27 foo: 'foo', ··· 30 32 false: false 31 33 } as const; 32 34 33 - export type Foo = typeof Foo[keyof typeof Foo]; 35 + export type Numbers = 100 | 200 | 300 | -100 | -200 | -300; 34 36 35 37 export const Numbers = { 36 38 100: 100, ··· 41 43 '-300': -300 42 44 } as const; 43 45 44 - export type Numbers = typeof Numbers[keyof typeof Numbers]; 46 + export type Arrays = [ 47 + 'foo' 48 + ] | [ 49 + 'bar' 50 + ] | [ 51 + 'baz' 52 + ]; 45 53 46 54 export const Arrays = { 47 55 0: ['foo'], 48 56 1: ['bar'], 49 57 2: ['baz'] 50 58 } as const; 51 - 52 - export type Arrays = typeof Arrays[keyof typeof Arrays]; 53 59 54 60 export type ClientOptions = { 55 61 baseUrl: `${string}://${string}` | (string & {});
+13 -7
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/enum-names-values-javascript-snake_case/types.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 + export type _110 = '1-10' | '11-20'; 4 + 3 5 export const _110 = { 4 6 '1_10': '1-10', 5 7 '11_20': '11-20' 6 8 } as const; 7 9 8 - export type _110 = typeof _110[keyof typeof _110]; 10 + export type MyFoo = 'myFoo' | 'myBar'; 9 11 10 12 export const MyFoo = { 11 13 my_foo: 'myFoo', 12 14 my_bar: 'myBar' 13 15 } as const; 14 16 15 - export type MyFoo = typeof MyFoo[keyof typeof MyFoo]; 17 + export type MyFoo2 = 'MyFoo' | 'MyBar'; 16 18 17 19 export const MyFoo2 = { 18 20 my_foo: 'MyFoo', 19 21 my_bar: 'MyBar' 20 22 } as const; 21 23 22 - export type MyFoo2 = typeof MyFoo2[keyof typeof MyFoo2]; 24 + export type Foo = 'foo' | 'bar' | null | '' | true | false; 23 25 24 26 export const Foo = { 25 27 foo: 'foo', ··· 30 32 false: false 31 33 } as const; 32 34 33 - export type Foo = typeof Foo[keyof typeof Foo]; 35 + export type Numbers = 100 | 200 | 300 | -100 | -200 | -300; 34 36 35 37 export const Numbers = { 36 38 100: 100, ··· 41 43 '-300': -300 42 44 } as const; 43 45 44 - export type Numbers = typeof Numbers[keyof typeof Numbers]; 46 + export type Arrays = [ 47 + 'foo' 48 + ] | [ 49 + 'bar' 50 + ] | [ 51 + 'baz' 52 + ]; 45 53 46 54 export const Arrays = { 47 55 0: ['foo'], 48 56 1: ['bar'], 49 57 2: ['baz'] 50 58 } as const; 51 - 52 - export type Arrays = typeof Arrays[keyof typeof Arrays]; 53 59 54 60 export type ClientOptions = { 55 61 baseUrl: `${string}://${string}` | (string & {});
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/internal-name-conflict/@tanstack/react-query.gen.ts
··· 15 15 const createQueryKey = <TOptions extends Options>(id: string, options?: TOptions, infinite?: boolean): [ 16 16 QueryKey<TOptions>[0] 17 17 ] => { 18 - const params: QueryKey<TOptions>[0] = { _id: id, baseUrl: options?.baseUrl || (options?.client ?? _heyApiClient).getConfig().baseUrl } as QueryKey<TOptions>[0]; 18 + const params: QueryKey<TOptions>[0] = { _id: id, baseUrl: (options?.client ?? _heyApiClient).getConfig().baseUrl } as QueryKey<TOptions>[0]; 19 19 if (infinite) { 20 20 params._infinite = infinite; 21 21 }
+2 -4
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/internal-name-conflict/client/client.ts
··· 143 143 }; 144 144 } 145 145 146 - const textError = await response.text(); 147 - let jsonError: unknown; 146 + let error = await response.text(); 148 147 149 148 try { 150 - jsonError = JSON.parse(textError); 149 + error = JSON.parse(error); 151 150 } catch { 152 151 // noop 153 152 } 154 153 155 - const error = jsonError ?? textError; 156 154 let finalError = error; 157 155 158 156 for (const fn of interceptors.error._fns) {
-10
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/internal-name-conflict/core/params.ts
··· 3 3 export type Field = 4 4 | { 5 5 in: Exclude<Slot, 'body'>; 6 - /** 7 - * Field name. This is the name we want the user to see and use. 8 - */ 9 6 key: string; 10 - /** 11 - * Field mapped name. This is the name we want to use in the request. 12 - * If omitted, we use the same value as `key`. 13 - */ 14 7 map?: string; 15 8 } 16 9 | { 17 10 in: Extract<Slot, 'body'>; 18 - /** 19 - * Key isn't required for bodies. 20 - */ 21 11 key?: string; 22 12 map?: string; 23 13 };
-14
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/internal-name-conflict/core/types.ts
··· 102 102 */ 103 103 responseValidator?: (data: unknown) => Promise<unknown>; 104 104 } 105 - 106 - type IsExactlyNeverOrNeverUndefined<T> = [T] extends [never] 107 - ? true 108 - : [T] extends [never | undefined] 109 - ? [undefined] extends [T] 110 - ? false 111 - : true 112 - : false; 113 - 114 - export type OmitNever<T extends Record<string, unknown>> = { 115 - [K in keyof T as IsExactlyNeverOrNeverUndefined<T[K]> extends true 116 - ? never 117 - : K]: T[K]; 118 - };
+4 -10
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/parameter-explode-false-axios/client/client.ts
··· 1 - import type { AxiosError, AxiosInstance, RawAxiosRequestHeaders } from 'axios'; 1 + import type { AxiosError, RawAxiosRequestHeaders } from 'axios'; 2 2 import axios from 'axios'; 3 3 4 4 import type { Client, Config } from './types'; ··· 13 13 export const createClient = (config: Config = {}): Client => { 14 14 let _config = mergeConfigs(createConfig(), config); 15 15 16 - let instance: AxiosInstance; 17 - 18 - if (_config.axios && !('Axios' in _config.axios)) { 19 - instance = _config.axios; 20 - } else { 21 - // eslint-disable-next-line @typescript-eslint/no-unused-vars 22 - const { auth, ...configWithoutAuth } = _config; 23 - instance = axios.create(configWithoutAuth); 24 - } 16 + // eslint-disable-next-line @typescript-eslint/no-unused-vars 17 + const { auth, ...configWithoutAuth } = _config; 18 + const instance = axios.create(configWithoutAuth); 25 19 26 20 const getConfig = (): Config => ({ ..._config }); 27 21
+4 -5
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/parameter-explode-false-axios/client/types.ts
··· 1 1 import type { 2 2 AxiosError, 3 3 AxiosInstance, 4 - AxiosRequestHeaders, 5 4 AxiosResponse, 6 5 AxiosStatic, 7 6 CreateAxiosDefaults, ··· 17 16 extends Omit<CreateAxiosDefaults, 'auth' | 'baseURL' | 'headers' | 'method'>, 18 17 CoreConfig { 19 18 /** 20 - * Axios implementation. You can use this option to provide either an 21 - * `AxiosStatic` or an `AxiosInstance`. 19 + * Axios implementation. You can use this option to provide a custom 20 + * Axios instance. 22 21 * 23 22 * @default axios 24 23 */ 25 - axios?: AxiosStatic | AxiosInstance; 24 + axios?: AxiosStatic; 26 25 /** 27 26 * Base URL for all requests made by this client. 28 27 */ ··· 34 33 * {@link https://developer.mozilla.org/docs/Web/API/Headers/Headers#init See more} 35 34 */ 36 35 headers?: 37 - | AxiosRequestHeaders 36 + | CreateAxiosDefaults['headers'] 38 37 | Record< 39 38 string, 40 39 | string
-10
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/parameter-explode-false-axios/core/params.ts
··· 3 3 export type Field = 4 4 | { 5 5 in: Exclude<Slot, 'body'>; 6 - /** 7 - * Field name. This is the name we want the user to see and use. 8 - */ 9 6 key: string; 10 - /** 11 - * Field mapped name. This is the name we want to use in the request. 12 - * If omitted, we use the same value as `key`. 13 - */ 14 7 map?: string; 15 8 } 16 9 | { 17 10 in: Extract<Slot, 'body'>; 18 - /** 19 - * Key isn't required for bodies. 20 - */ 21 11 key?: string; 22 12 map?: string; 23 13 };
-14
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/parameter-explode-false-axios/core/types.ts
··· 102 102 */ 103 103 responseValidator?: (data: unknown) => Promise<unknown>; 104 104 } 105 - 106 - type IsExactlyNeverOrNeverUndefined<T> = [T] extends [never] 107 - ? true 108 - : [T] extends [never | undefined] 109 - ? [undefined] extends [T] 110 - ? false 111 - : true 112 - : false; 113 - 114 - export type OmitNever<T extends Record<string, unknown>> = { 115 - [K in keyof T as IsExactlyNeverOrNeverUndefined<T[K]> extends true 116 - ? never 117 - : K]: T[K]; 118 - };
+2 -4
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/parameter-explode-false/client/client.ts
··· 143 143 }; 144 144 } 145 145 146 - const textError = await response.text(); 147 - let jsonError: unknown; 146 + let error = await response.text(); 148 147 149 148 try { 150 - jsonError = JSON.parse(textError); 149 + error = JSON.parse(error); 151 150 } catch { 152 151 // noop 153 152 } 154 153 155 - const error = jsonError ?? textError; 156 154 let finalError = error; 157 155 158 156 for (const fn of interceptors.error._fns) {
-10
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/parameter-explode-false/core/params.ts
··· 3 3 export type Field = 4 4 | { 5 5 in: Exclude<Slot, 'body'>; 6 - /** 7 - * Field name. This is the name we want the user to see and use. 8 - */ 9 6 key: string; 10 - /** 11 - * Field mapped name. This is the name we want to use in the request. 12 - * If omitted, we use the same value as `key`. 13 - */ 14 7 map?: string; 15 8 } 16 9 | { 17 10 in: Extract<Slot, 'body'>; 18 - /** 19 - * Key isn't required for bodies. 20 - */ 21 11 key?: string; 22 12 map?: string; 23 13 };
-14
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/parameter-explode-false/core/types.ts
··· 102 102 */ 103 103 responseValidator?: (data: unknown) => Promise<unknown>; 104 104 } 105 - 106 - type IsExactlyNeverOrNeverUndefined<T> = [T] extends [never] 107 - ? true 108 - : [T] extends [never | undefined] 109 - ? [undefined] extends [T] 110 - ? false 111 - : true 112 - : false; 113 - 114 - export type OmitNever<T extends Record<string, unknown>> = { 115 - [K in keyof T as IsExactlyNeverOrNeverUndefined<T[K]> extends true 116 - ? never 117 - : K]: T[K]; 118 - };
+2 -4
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-api-key/client/client.ts
··· 143 143 }; 144 144 } 145 145 146 - const textError = await response.text(); 147 - let jsonError: unknown; 146 + let error = await response.text(); 148 147 149 148 try { 150 - jsonError = JSON.parse(textError); 149 + error = JSON.parse(error); 151 150 } catch { 152 151 // noop 153 152 } 154 153 155 - const error = jsonError ?? textError; 156 154 let finalError = error; 157 155 158 156 for (const fn of interceptors.error._fns) {
-10
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-api-key/core/params.ts
··· 3 3 export type Field = 4 4 | { 5 5 in: Exclude<Slot, 'body'>; 6 - /** 7 - * Field name. This is the name we want the user to see and use. 8 - */ 9 6 key: string; 10 - /** 11 - * Field mapped name. This is the name we want to use in the request. 12 - * If omitted, we use the same value as `key`. 13 - */ 14 7 map?: string; 15 8 } 16 9 | { 17 10 in: Extract<Slot, 'body'>; 18 - /** 19 - * Key isn't required for bodies. 20 - */ 21 11 key?: string; 22 12 map?: string; 23 13 };
-14
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-api-key/core/types.ts
··· 102 102 */ 103 103 responseValidator?: (data: unknown) => Promise<unknown>; 104 104 } 105 - 106 - type IsExactlyNeverOrNeverUndefined<T> = [T] extends [never] 107 - ? true 108 - : [T] extends [never | undefined] 109 - ? [undefined] extends [T] 110 - ? false 111 - : true 112 - : false; 113 - 114 - export type OmitNever<T extends Record<string, unknown>> = { 115 - [K in keyof T as IsExactlyNeverOrNeverUndefined<T[K]> extends true 116 - ? never 117 - : K]: T[K]; 118 - };
+2 -4
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-false/client/client.ts
··· 143 143 }; 144 144 } 145 145 146 - const textError = await response.text(); 147 - let jsonError: unknown; 146 + let error = await response.text(); 148 147 149 148 try { 150 - jsonError = JSON.parse(textError); 149 + error = JSON.parse(error); 151 150 } catch { 152 151 // noop 153 152 } 154 153 155 - const error = jsonError ?? textError; 156 154 let finalError = error; 157 155 158 156 for (const fn of interceptors.error._fns) {
-10
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-false/core/params.ts
··· 3 3 export type Field = 4 4 | { 5 5 in: Exclude<Slot, 'body'>; 6 - /** 7 - * Field name. This is the name we want the user to see and use. 8 - */ 9 6 key: string; 10 - /** 11 - * Field mapped name. This is the name we want to use in the request. 12 - * If omitted, we use the same value as `key`. 13 - */ 14 7 map?: string; 15 8 } 16 9 | { 17 10 in: Extract<Slot, 'body'>; 18 - /** 19 - * Key isn't required for bodies. 20 - */ 21 11 key?: string; 22 12 map?: string; 23 13 };
-14
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-false/core/types.ts
··· 102 102 */ 103 103 responseValidator?: (data: unknown) => Promise<unknown>; 104 104 } 105 - 106 - type IsExactlyNeverOrNeverUndefined<T> = [T] extends [never] 107 - ? true 108 - : [T] extends [never | undefined] 109 - ? [undefined] extends [T] 110 - ? false 111 - : true 112 - : false; 113 - 114 - export type OmitNever<T extends Record<string, unknown>> = { 115 - [K in keyof T as IsExactlyNeverOrNeverUndefined<T[K]> extends true 116 - ? never 117 - : K]: T[K]; 118 - };
+2 -4
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-http-bearer/client/client.ts
··· 143 143 }; 144 144 } 145 145 146 - const textError = await response.text(); 147 - let jsonError: unknown; 146 + let error = await response.text(); 148 147 149 148 try { 150 - jsonError = JSON.parse(textError); 149 + error = JSON.parse(error); 151 150 } catch { 152 151 // noop 153 152 } 154 153 155 - const error = jsonError ?? textError; 156 154 let finalError = error; 157 155 158 156 for (const fn of interceptors.error._fns) {
-10
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-http-bearer/core/params.ts
··· 3 3 export type Field = 4 4 | { 5 5 in: Exclude<Slot, 'body'>; 6 - /** 7 - * Field name. This is the name we want the user to see and use. 8 - */ 9 6 key: string; 10 - /** 11 - * Field mapped name. This is the name we want to use in the request. 12 - * If omitted, we use the same value as `key`. 13 - */ 14 7 map?: string; 15 8 } 16 9 | { 17 10 in: Extract<Slot, 'body'>; 18 - /** 19 - * Key isn't required for bodies. 20 - */ 21 11 key?: string; 22 12 map?: string; 23 13 };
-14
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-http-bearer/core/types.ts
··· 102 102 */ 103 103 responseValidator?: (data: unknown) => Promise<unknown>; 104 104 } 105 - 106 - type IsExactlyNeverOrNeverUndefined<T> = [T] extends [never] 107 - ? true 108 - : [T] extends [never | undefined] 109 - ? [undefined] extends [T] 110 - ? false 111 - : true 112 - : false; 113 - 114 - export type OmitNever<T extends Record<string, unknown>> = { 115 - [K in keyof T as IsExactlyNeverOrNeverUndefined<T[K]> extends true 116 - ? never 117 - : K]: T[K]; 118 - };
+2 -4
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-oauth2/client/client.ts
··· 143 143 }; 144 144 } 145 145 146 - const textError = await response.text(); 147 - let jsonError: unknown; 146 + let error = await response.text(); 148 147 149 148 try { 150 - jsonError = JSON.parse(textError); 149 + error = JSON.parse(error); 151 150 } catch { 152 151 // noop 153 152 } 154 153 155 - const error = jsonError ?? textError; 156 154 let finalError = error; 157 155 158 156 for (const fn of interceptors.error._fns) {
-10
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-oauth2/core/params.ts
··· 3 3 export type Field = 4 4 | { 5 5 in: Exclude<Slot, 'body'>; 6 - /** 7 - * Field name. This is the name we want the user to see and use. 8 - */ 9 6 key: string; 10 - /** 11 - * Field mapped name. This is the name we want to use in the request. 12 - * If omitted, we use the same value as `key`. 13 - */ 14 7 map?: string; 15 8 } 16 9 | { 17 10 in: Extract<Slot, 'body'>; 18 - /** 19 - * Key isn't required for bodies. 20 - */ 21 11 key?: string; 22 12 map?: string; 23 13 };
-14
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-oauth2/core/types.ts
··· 102 102 */ 103 103 responseValidator?: (data: unknown) => Promise<unknown>; 104 104 } 105 - 106 - type IsExactlyNeverOrNeverUndefined<T> = [T] extends [never] 107 - ? true 108 - : [T] extends [never | undefined] 109 - ? [undefined] extends [T] 110 - ? false 111 - : true 112 - : false; 113 - 114 - export type OmitNever<T extends Record<string, unknown>> = { 115 - [K in keyof T as IsExactlyNeverOrNeverUndefined<T[K]> extends true 116 - ? never 117 - : K]: T[K]; 118 - };
+2 -4
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-open-id-connect/client/client.ts
··· 143 143 }; 144 144 } 145 145 146 - const textError = await response.text(); 147 - let jsonError: unknown; 146 + let error = await response.text(); 148 147 149 148 try { 150 - jsonError = JSON.parse(textError); 149 + error = JSON.parse(error); 151 150 } catch { 152 151 // noop 153 152 } 154 153 155 - const error = jsonError ?? textError; 156 154 let finalError = error; 157 155 158 156 for (const fn of interceptors.error._fns) {
-10
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-open-id-connect/core/params.ts
··· 3 3 export type Field = 4 4 | { 5 5 in: Exclude<Slot, 'body'>; 6 - /** 7 - * Field name. This is the name we want the user to see and use. 8 - */ 9 6 key: string; 10 - /** 11 - * Field mapped name. This is the name we want to use in the request. 12 - * If omitted, we use the same value as `key`. 13 - */ 14 7 map?: string; 15 8 } 16 9 | { 17 10 in: Extract<Slot, 'body'>; 18 - /** 19 - * Key isn't required for bodies. 20 - */ 21 11 key?: string; 22 12 map?: string; 23 13 };
-14
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-open-id-connect/core/types.ts
··· 102 102 */ 103 103 responseValidator?: (data: unknown) => Promise<unknown>; 104 104 } 105 - 106 - type IsExactlyNeverOrNeverUndefined<T> = [T] extends [never] 107 - ? true 108 - : [T] extends [never | undefined] 109 - ? [undefined] extends [T] 110 - ? false 111 - : true 112 - : false; 113 - 114 - export type OmitNever<T extends Record<string, unknown>> = { 115 - [K in keyof T as IsExactlyNeverOrNeverUndefined<T[K]> extends true 116 - ? never 117 - : K]: T[K]; 118 - };
+2 -4
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/servers/client/client.ts
··· 143 143 }; 144 144 } 145 145 146 - const textError = await response.text(); 147 - let jsonError: unknown; 146 + let error = await response.text(); 148 147 149 148 try { 150 - jsonError = JSON.parse(textError); 149 + error = JSON.parse(error); 151 150 } catch { 152 151 // noop 153 152 } 154 153 155 - const error = jsonError ?? textError; 156 154 let finalError = error; 157 155 158 156 for (const fn of interceptors.error._fns) {
-10
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/servers/core/params.ts
··· 3 3 export type Field = 4 4 | { 5 5 in: Exclude<Slot, 'body'>; 6 - /** 7 - * Field name. This is the name we want the user to see and use. 8 - */ 9 6 key: string; 10 - /** 11 - * Field mapped name. This is the name we want to use in the request. 12 - * If omitted, we use the same value as `key`. 13 - */ 14 7 map?: string; 15 8 } 16 9 | { 17 10 in: Extract<Slot, 'body'>; 18 - /** 19 - * Key isn't required for bodies. 20 - */ 21 11 key?: string; 22 12 map?: string; 23 13 };
-14
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/servers/core/types.ts
··· 102 102 */ 103 103 responseValidator?: (data: unknown) => Promise<unknown>; 104 104 } 105 - 106 - type IsExactlyNeverOrNeverUndefined<T> = [T] extends [never] 107 - ? true 108 - : [T] extends [never | undefined] 109 - ? [undefined] extends [T] 110 - ? false 111 - : true 112 - : false; 113 - 114 - export type OmitNever<T extends Record<string, unknown>> = { 115 - [K in keyof T as IsExactlyNeverOrNeverUndefined<T[K]> extends true 116 - ? never 117 - : K]: T[K]; 118 - };
+2 -4
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transformers-all-of/client/client.ts
··· 143 143 }; 144 144 } 145 145 146 - const textError = await response.text(); 147 - let jsonError: unknown; 146 + let error = await response.text(); 148 147 149 148 try { 150 - jsonError = JSON.parse(textError); 149 + error = JSON.parse(error); 151 150 } catch { 152 151 // noop 153 152 } 154 153 155 - const error = jsonError ?? textError; 156 154 let finalError = error; 157 155 158 156 for (const fn of interceptors.error._fns) {
-10
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transformers-all-of/core/params.ts
··· 3 3 export type Field = 4 4 | { 5 5 in: Exclude<Slot, 'body'>; 6 - /** 7 - * Field name. This is the name we want the user to see and use. 8 - */ 9 6 key: string; 10 - /** 11 - * Field mapped name. This is the name we want to use in the request. 12 - * If omitted, we use the same value as `key`. 13 - */ 14 7 map?: string; 15 8 } 16 9 | { 17 10 in: Extract<Slot, 'body'>; 18 - /** 19 - * Key isn't required for bodies. 20 - */ 21 11 key?: string; 22 12 map?: string; 23 13 };
-14
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transformers-all-of/core/types.ts
··· 102 102 */ 103 103 responseValidator?: (data: unknown) => Promise<unknown>; 104 104 } 105 - 106 - type IsExactlyNeverOrNeverUndefined<T> = [T] extends [never] 107 - ? true 108 - : [T] extends [never | undefined] 109 - ? [undefined] extends [T] 110 - ? false 111 - : true 112 - : false; 113 - 114 - export type OmitNever<T extends Record<string, unknown>> = { 115 - [K in keyof T as IsExactlyNeverOrNeverUndefined<T[K]> extends true 116 - ? never 117 - : K]: T[K]; 118 - };
+2 -4
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transformers-any-of-null/client/client.ts
··· 143 143 }; 144 144 } 145 145 146 - const textError = await response.text(); 147 - let jsonError: unknown; 146 + let error = await response.text(); 148 147 149 148 try { 150 - jsonError = JSON.parse(textError); 149 + error = JSON.parse(error); 151 150 } catch { 152 151 // noop 153 152 } 154 153 155 - const error = jsonError ?? textError; 156 154 let finalError = error; 157 155 158 156 for (const fn of interceptors.error._fns) {
-10
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transformers-any-of-null/core/params.ts
··· 3 3 export type Field = 4 4 | { 5 5 in: Exclude<Slot, 'body'>; 6 - /** 7 - * Field name. This is the name we want the user to see and use. 8 - */ 9 6 key: string; 10 - /** 11 - * Field mapped name. This is the name we want to use in the request. 12 - * If omitted, we use the same value as `key`. 13 - */ 14 7 map?: string; 15 8 } 16 9 | { 17 10 in: Extract<Slot, 'body'>; 18 - /** 19 - * Key isn't required for bodies. 20 - */ 21 11 key?: string; 22 12 map?: string; 23 13 };
-14
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transformers-any-of-null/core/types.ts
··· 102 102 */ 103 103 responseValidator?: (data: unknown) => Promise<unknown>; 104 104 } 105 - 106 - type IsExactlyNeverOrNeverUndefined<T> = [T] extends [never] 107 - ? true 108 - : [T] extends [never | undefined] 109 - ? [undefined] extends [T] 110 - ? false 111 - : true 112 - : false; 113 - 114 - export type OmitNever<T extends Record<string, unknown>> = { 115 - [K in keyof T as IsExactlyNeverOrNeverUndefined<T[K]> extends true 116 - ? never 117 - : K]: T[K]; 118 - };
+2 -4
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transformers-array/client/client.ts
··· 143 143 }; 144 144 } 145 145 146 - const textError = await response.text(); 147 - let jsonError: unknown; 146 + let error = await response.text(); 148 147 149 148 try { 150 - jsonError = JSON.parse(textError); 149 + error = JSON.parse(error); 151 150 } catch { 152 151 // noop 153 152 } 154 153 155 - const error = jsonError ?? textError; 156 154 let finalError = error; 157 155 158 156 for (const fn of interceptors.error._fns) {
-10
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transformers-array/core/params.ts
··· 3 3 export type Field = 4 4 | { 5 5 in: Exclude<Slot, 'body'>; 6 - /** 7 - * Field name. This is the name we want the user to see and use. 8 - */ 9 6 key: string; 10 - /** 11 - * Field mapped name. This is the name we want to use in the request. 12 - * If omitted, we use the same value as `key`. 13 - */ 14 7 map?: string; 15 8 } 16 9 | { 17 10 in: Extract<Slot, 'body'>; 18 - /** 19 - * Key isn't required for bodies. 20 - */ 21 11 key?: string; 22 12 map?: string; 23 13 };
-14
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transformers-array/core/types.ts
··· 102 102 */ 103 103 responseValidator?: (data: unknown) => Promise<unknown>; 104 104 } 105 - 106 - type IsExactlyNeverOrNeverUndefined<T> = [T] extends [never] 107 - ? true 108 - : [T] extends [never | undefined] 109 - ? [undefined] extends [T] 110 - ? false 111 - : true 112 - : false; 113 - 114 - export type OmitNever<T extends Record<string, unknown>> = { 115 - [K in keyof T as IsExactlyNeverOrNeverUndefined<T[K]> extends true 116 - ? never 117 - : K]: T[K]; 118 - };
+2 -4
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transforms-read-write/client/client.ts
··· 143 143 }; 144 144 } 145 145 146 - const textError = await response.text(); 147 - let jsonError: unknown; 146 + let error = await response.text(); 148 147 149 148 try { 150 - jsonError = JSON.parse(textError); 149 + error = JSON.parse(error); 151 150 } catch { 152 151 // noop 153 152 } 154 153 155 - const error = jsonError ?? textError; 156 154 let finalError = error; 157 155 158 156 for (const fn of interceptors.error._fns) {
-10
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transforms-read-write/core/params.ts
··· 3 3 export type Field = 4 4 | { 5 5 in: Exclude<Slot, 'body'>; 6 - /** 7 - * Field name. This is the name we want the user to see and use. 8 - */ 9 6 key: string; 10 - /** 11 - * Field mapped name. This is the name we want to use in the request. 12 - * If omitted, we use the same value as `key`. 13 - */ 14 7 map?: string; 15 8 } 16 9 | { 17 10 in: Extract<Slot, 'body'>; 18 - /** 19 - * Key isn't required for bodies. 20 - */ 21 11 key?: string; 22 12 map?: string; 23 13 };
-14
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transforms-read-write/core/types.ts
··· 102 102 */ 103 103 responseValidator?: (data: unknown) => Promise<unknown>; 104 104 } 105 - 106 - type IsExactlyNeverOrNeverUndefined<T> = [T] extends [never] 107 - ? true 108 - : [T] extends [never | undefined] 109 - ? [undefined] extends [T] 110 - ? false 111 - : true 112 - : false; 113 - 114 - export type OmitNever<T extends Record<string, unknown>> = { 115 - [K in keyof T as IsExactlyNeverOrNeverUndefined<T[K]> extends true 116 - ? never 117 - : K]: T[K]; 118 - };
+2 -4
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/body-response-text-plain/client/client.ts
··· 143 143 }; 144 144 } 145 145 146 - const textError = await response.text(); 147 - let jsonError: unknown; 146 + let error = await response.text(); 148 147 149 148 try { 150 - jsonError = JSON.parse(textError); 149 + error = JSON.parse(error); 151 150 } catch { 152 151 // noop 153 152 } 154 153 155 - const error = jsonError ?? textError; 156 154 let finalError = error; 157 155 158 156 for (const fn of interceptors.error._fns) {
-10
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/body-response-text-plain/core/params.ts
··· 3 3 export type Field = 4 4 | { 5 5 in: Exclude<Slot, 'body'>; 6 - /** 7 - * Field name. This is the name we want the user to see and use. 8 - */ 9 6 key: string; 10 - /** 11 - * Field mapped name. This is the name we want to use in the request. 12 - * If omitted, we use the same value as `key`. 13 - */ 14 7 map?: string; 15 8 } 16 9 | { 17 10 in: Extract<Slot, 'body'>; 18 - /** 19 - * Key isn't required for bodies. 20 - */ 21 11 key?: string; 22 12 map?: string; 23 13 };
-14
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/body-response-text-plain/core/types.ts
··· 102 102 */ 103 103 responseValidator?: (data: unknown) => Promise<unknown>; 104 104 } 105 - 106 - type IsExactlyNeverOrNeverUndefined<T> = [T] extends [never] 107 - ? true 108 - : [T] extends [never | undefined] 109 - ? [undefined] extends [T] 110 - ? false 111 - : true 112 - : false; 113 - 114 - export type OmitNever<T extends Record<string, unknown>> = { 115 - [K in keyof T as IsExactlyNeverOrNeverUndefined<T[K]> extends true 116 - ? never 117 - : K]: T[K]; 118 - };
+3 -3
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/case-preserve/types.gen.ts
··· 51 51 */ 52 52 export type FooBar = string; 53 53 54 - export type getFooData = { 54 + export type GetFooData = { 55 55 body: Foo; 56 56 path?: never; 57 57 query: { ··· 71 71 url: '/foo'; 72 72 }; 73 73 74 - export type getFooResponses = { 74 + export type GetFooResponses = { 75 75 /** 76 76 * OK 77 77 */ ··· 82 82 201: _201; 83 83 }; 84 84 85 - export type getFooResponse = getFooResponses[keyof getFooResponses]; 85 + export type GetFooResponse = GetFooResponses[keyof GetFooResponses]; 86 86 87 87 export type ClientOptions = { 88 88 baseUrl: `${string}://${string}` | (string & {});
+4 -10
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/content-types/client/client.ts
··· 1 - import type { AxiosError, AxiosInstance, RawAxiosRequestHeaders } from 'axios'; 1 + import type { AxiosError, RawAxiosRequestHeaders } from 'axios'; 2 2 import axios from 'axios'; 3 3 4 4 import type { Client, Config } from './types'; ··· 13 13 export const createClient = (config: Config = {}): Client => { 14 14 let _config = mergeConfigs(createConfig(), config); 15 15 16 - let instance: AxiosInstance; 17 - 18 - if (_config.axios && !('Axios' in _config.axios)) { 19 - instance = _config.axios; 20 - } else { 21 - // eslint-disable-next-line @typescript-eslint/no-unused-vars 22 - const { auth, ...configWithoutAuth } = _config; 23 - instance = axios.create(configWithoutAuth); 24 - } 16 + // eslint-disable-next-line @typescript-eslint/no-unused-vars 17 + const { auth, ...configWithoutAuth } = _config; 18 + const instance = axios.create(configWithoutAuth); 25 19 26 20 const getConfig = (): Config => ({ ..._config }); 27 21
+4 -5
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/content-types/client/types.ts
··· 1 1 import type { 2 2 AxiosError, 3 3 AxiosInstance, 4 - AxiosRequestHeaders, 5 4 AxiosResponse, 6 5 AxiosStatic, 7 6 CreateAxiosDefaults, ··· 17 16 extends Omit<CreateAxiosDefaults, 'auth' | 'baseURL' | 'headers' | 'method'>, 18 17 CoreConfig { 19 18 /** 20 - * Axios implementation. You can use this option to provide either an 21 - * `AxiosStatic` or an `AxiosInstance`. 19 + * Axios implementation. You can use this option to provide a custom 20 + * Axios instance. 22 21 * 23 22 * @default axios 24 23 */ 25 - axios?: AxiosStatic | AxiosInstance; 24 + axios?: AxiosStatic; 26 25 /** 27 26 * Base URL for all requests made by this client. 28 27 */ ··· 34 33 * {@link https://developer.mozilla.org/docs/Web/API/Headers/Headers#init See more} 35 34 */ 36 35 headers?: 37 - | AxiosRequestHeaders 36 + | CreateAxiosDefaults['headers'] 38 37 | Record< 39 38 string, 40 39 | string
-10
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/content-types/core/params.ts
··· 3 3 export type Field = 4 4 | { 5 5 in: Exclude<Slot, 'body'>; 6 - /** 7 - * Field name. This is the name we want the user to see and use. 8 - */ 9 6 key: string; 10 - /** 11 - * Field mapped name. This is the name we want to use in the request. 12 - * If omitted, we use the same value as `key`. 13 - */ 14 7 map?: string; 15 8 } 16 9 | { 17 10 in: Extract<Slot, 'body'>; 18 - /** 19 - * Key isn't required for bodies. 20 - */ 21 11 key?: string; 22 12 map?: string; 23 13 };
-14
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/content-types/core/types.ts
··· 102 102 */ 103 103 responseValidator?: (data: unknown) => Promise<unknown>; 104 104 } 105 - 106 - type IsExactlyNeverOrNeverUndefined<T> = [T] extends [never] 107 - ? true 108 - : [T] extends [never | undefined] 109 - ? [undefined] extends [T] 110 - ? false 111 - : true 112 - : false; 113 - 114 - export type OmitNever<T extends Record<string, unknown>> = { 115 - [K in keyof T as IsExactlyNeverOrNeverUndefined<T[K]> extends true 116 - ? never 117 - : K]: T[K]; 118 - };
+4 -4
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/enum-inline-javascript/types.gen.ts
··· 8 8 type?: Baz; 9 9 }; 10 10 11 + export type Baz = 'qux' | 'quux'; 12 + 11 13 export const Baz = { 12 14 QUX: 'qux', 13 15 QUUX: 'quux' 14 16 } as const; 15 17 16 - export type Baz = typeof Baz[keyof typeof Baz]; 18 + export type FooEnum = 'foo' | 'bar'; 17 19 18 20 export const FooEnum = { 19 21 FOO: 'foo', 20 22 BAR: 'bar' 21 23 } as const; 22 24 23 - export type FooEnum = typeof FooEnum[keyof typeof FooEnum]; 25 + export type FooEnum2 = 'baz'; 24 26 25 27 export const FooEnum2 = { 26 28 BAZ: 'baz' 27 29 } as const; 28 - 29 - export type FooEnum2 = typeof FooEnum2[keyof typeof FooEnum2]; 30 30 31 31 export type GetFooData = { 32 32 body?: never;
+13 -7
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/enum-names-values-javascript-PascalCase/types.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 + export type _110 = '1-10' | '11-20'; 4 + 3 5 export const _110 = { 4 6 110: '1-10', 5 7 1120: '11-20' 6 8 } as const; 7 9 8 - export type _110 = typeof _110[keyof typeof _110]; 10 + export type MyFoo = 'myFoo' | 'myBar'; 9 11 10 12 export const MyFoo = { 11 13 MyFoo: 'myFoo', 12 14 MyBar: 'myBar' 13 15 } as const; 14 16 15 - export type MyFoo = typeof MyFoo[keyof typeof MyFoo]; 17 + export type MyFoo2 = 'MyFoo' | 'MyBar'; 16 18 17 19 export const MyFoo2 = { 18 20 MyFoo: 'MyFoo', 19 21 MyBar: 'MyBar' 20 22 } as const; 21 23 22 - export type MyFoo2 = typeof MyFoo2[keyof typeof MyFoo2]; 24 + export type Foo = 'foo' | 'bar' | null | '' | true | false; 23 25 24 26 export const Foo = { 25 27 Foo: 'foo', ··· 30 32 False: false 31 33 } as const; 32 34 33 - export type Foo = typeof Foo[keyof typeof Foo]; 35 + export type Numbers = 100 | 200 | 300 | -100 | -200 | -300; 34 36 35 37 export const Numbers = { 36 38 100: 100, ··· 41 43 '-300': -300 42 44 } as const; 43 45 44 - export type Numbers = typeof Numbers[keyof typeof Numbers]; 46 + export type Arrays = [ 47 + 'foo' 48 + ] | [ 49 + 'bar' 50 + ] | [ 51 + 'baz' 52 + ]; 45 53 46 54 export const Arrays = { 47 55 0: ['foo'], 48 56 1: ['bar'], 49 57 2: ['baz'] 50 58 } as const; 51 - 52 - export type Arrays = typeof Arrays[keyof typeof Arrays]; 53 59 54 60 export type MyFooRef = { 55 61 foo?: Array<MyFoo2>;
+13 -7
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/enum-names-values-javascript-SCREAMING_SNAKE_CASE/types.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 + export type _110 = '1-10' | '11-20'; 4 + 3 5 export const _110 = { 4 6 '1_10': '1-10', 5 7 '11_20': '11-20' 6 8 } as const; 7 9 8 - export type _110 = typeof _110[keyof typeof _110]; 10 + export type MyFoo = 'myFoo' | 'myBar'; 9 11 10 12 export const MyFoo = { 11 13 MY_FOO: 'myFoo', 12 14 MY_BAR: 'myBar' 13 15 } as const; 14 16 15 - export type MyFoo = typeof MyFoo[keyof typeof MyFoo]; 17 + export type MyFoo2 = 'MyFoo' | 'MyBar'; 16 18 17 19 export const MyFoo2 = { 18 20 MY_FOO: 'MyFoo', 19 21 MY_BAR: 'MyBar' 20 22 } as const; 21 23 22 - export type MyFoo2 = typeof MyFoo2[keyof typeof MyFoo2]; 24 + export type Foo = 'foo' | 'bar' | null | '' | true | false; 23 25 24 26 export const Foo = { 25 27 FOO: 'foo', ··· 30 32 FALSE: false 31 33 } as const; 32 34 33 - export type Foo = typeof Foo[keyof typeof Foo]; 35 + export type Numbers = 100 | 200 | 300 | -100 | -200 | -300; 34 36 35 37 export const Numbers = { 36 38 100: 100, ··· 41 43 '-300': -300 42 44 } as const; 43 45 44 - export type Numbers = typeof Numbers[keyof typeof Numbers]; 46 + export type Arrays = [ 47 + 'foo' 48 + ] | [ 49 + 'bar' 50 + ] | [ 51 + 'baz' 52 + ]; 45 53 46 54 export const Arrays = { 47 55 0: ['foo'], 48 56 1: ['bar'], 49 57 2: ['baz'] 50 58 } as const; 51 - 52 - export type Arrays = typeof Arrays[keyof typeof Arrays]; 53 59 54 60 export type MyFooRef = { 55 61 foo?: Array<MyFoo2>;
+13 -7
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/enum-names-values-javascript-camelCase/types.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 + export type _110 = '1-10' | '11-20'; 4 + 3 5 export const _110 = { 4 6 110: '1-10', 5 7 1120: '11-20' 6 8 } as const; 7 9 8 - export type _110 = typeof _110[keyof typeof _110]; 10 + export type MyFoo = 'myFoo' | 'myBar'; 9 11 10 12 export const MyFoo = { 11 13 myFoo: 'myFoo', 12 14 myBar: 'myBar' 13 15 } as const; 14 16 15 - export type MyFoo = typeof MyFoo[keyof typeof MyFoo]; 17 + export type MyFoo2 = 'MyFoo' | 'MyBar'; 16 18 17 19 export const MyFoo2 = { 18 20 myFoo: 'MyFoo', 19 21 myBar: 'MyBar' 20 22 } as const; 21 23 22 - export type MyFoo2 = typeof MyFoo2[keyof typeof MyFoo2]; 24 + export type Foo = 'foo' | 'bar' | null | '' | true | false; 23 25 24 26 export const Foo = { 25 27 foo: 'foo', ··· 30 32 false: false 31 33 } as const; 32 34 33 - export type Foo = typeof Foo[keyof typeof Foo]; 35 + export type Numbers = 100 | 200 | 300 | -100 | -200 | -300; 34 36 35 37 export const Numbers = { 36 38 100: 100, ··· 41 43 '-300': -300 42 44 } as const; 43 45 44 - export type Numbers = typeof Numbers[keyof typeof Numbers]; 46 + export type Arrays = [ 47 + 'foo' 48 + ] | [ 49 + 'bar' 50 + ] | [ 51 + 'baz' 52 + ]; 45 53 46 54 export const Arrays = { 47 55 0: ['foo'], 48 56 1: ['bar'], 49 57 2: ['baz'] 50 58 } as const; 51 - 52 - export type Arrays = typeof Arrays[keyof typeof Arrays]; 53 59 54 60 export type MyFooRef = { 55 61 foo?: Array<MyFoo2>;
+13 -7
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/enum-names-values-javascript-ignore-null/types.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 + export type _110 = '1-10' | '11-20'; 4 + 3 5 export const _110 = { 4 6 '1-10': '1-10', 5 7 '11-20': '11-20' 6 8 } as const; 7 9 8 - export type _110 = typeof _110[keyof typeof _110]; 10 + export type MyFoo = 'myFoo' | 'myBar'; 9 11 10 12 export const MyFoo = { 11 13 myFoo: 'myFoo', 12 14 myBar: 'myBar' 13 15 } as const; 14 16 15 - export type MyFoo = typeof MyFoo[keyof typeof MyFoo]; 17 + export type MyFoo2 = 'MyFoo' | 'MyBar'; 16 18 17 19 export const MyFoo2 = { 18 20 MyFoo: 'MyFoo', 19 21 MyBar: 'MyBar' 20 22 } as const; 21 23 22 - export type MyFoo2 = typeof MyFoo2[keyof typeof MyFoo2]; 24 + export type Foo = 'foo' | 'bar' | null | '' | true | false; 23 25 24 26 export const Foo = { 25 27 foo: 'foo', ··· 29 31 false: false 30 32 } as const; 31 33 32 - export type Foo = typeof Foo[keyof typeof Foo]; 34 + export type Numbers = 100 | 200 | 300 | -100 | -200 | -300; 33 35 34 36 export const Numbers = { 35 37 100: 100, ··· 40 42 '-300': -300 41 43 } as const; 42 44 43 - export type Numbers = typeof Numbers[keyof typeof Numbers]; 45 + export type Arrays = [ 46 + 'foo' 47 + ] | [ 48 + 'bar' 49 + ] | [ 50 + 'baz' 51 + ]; 44 52 45 53 export const Arrays = { 46 54 0: ['foo'], 47 55 1: ['bar'], 48 56 2: ['baz'] 49 57 } as const; 50 - 51 - export type Arrays = typeof Arrays[keyof typeof Arrays]; 52 58 53 59 export type MyFooRef = { 54 60 foo?: Array<MyFoo2>;
+13 -7
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/enum-names-values-javascript-preserve/types.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 + export type _110 = '1-10' | '11-20'; 4 + 3 5 export const _110 = { 4 6 '1-10': '1-10', 5 7 '11-20': '11-20' 6 8 } as const; 7 9 8 - export type _110 = typeof _110[keyof typeof _110]; 10 + export type MyFoo = 'myFoo' | 'myBar'; 9 11 10 12 export const MyFoo = { 11 13 myFoo: 'myFoo', 12 14 myBar: 'myBar' 13 15 } as const; 14 16 15 - export type MyFoo = typeof MyFoo[keyof typeof MyFoo]; 17 + export type MyFoo2 = 'MyFoo' | 'MyBar'; 16 18 17 19 export const MyFoo2 = { 18 20 MyFoo: 'MyFoo', 19 21 MyBar: 'MyBar' 20 22 } as const; 21 23 22 - export type MyFoo2 = typeof MyFoo2[keyof typeof MyFoo2]; 24 + export type Foo = 'foo' | 'bar' | null | '' | true | false; 23 25 24 26 export const Foo = { 25 27 foo: 'foo', ··· 30 32 false: false 31 33 } as const; 32 34 33 - export type Foo = typeof Foo[keyof typeof Foo]; 35 + export type Numbers = 100 | 200 | 300 | -100 | -200 | -300; 34 36 35 37 export const Numbers = { 36 38 100: 100, ··· 41 43 '-300': -300 42 44 } as const; 43 45 44 - export type Numbers = typeof Numbers[keyof typeof Numbers]; 46 + export type Arrays = [ 47 + 'foo' 48 + ] | [ 49 + 'bar' 50 + ] | [ 51 + 'baz' 52 + ]; 45 53 46 54 export const Arrays = { 47 55 0: ['foo'], 48 56 1: ['bar'], 49 57 2: ['baz'] 50 58 } as const; 51 - 52 - export type Arrays = typeof Arrays[keyof typeof Arrays]; 53 59 54 60 export type MyFooRef = { 55 61 foo?: Array<MyFoo2>;
+13 -7
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/enum-names-values-javascript-snake_case/types.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 + export type _110 = '1-10' | '11-20'; 4 + 3 5 export const _110 = { 4 6 '1_10': '1-10', 5 7 '11_20': '11-20' 6 8 } as const; 7 9 8 - export type _110 = typeof _110[keyof typeof _110]; 10 + export type MyFoo = 'myFoo' | 'myBar'; 9 11 10 12 export const MyFoo = { 11 13 my_foo: 'myFoo', 12 14 my_bar: 'myBar' 13 15 } as const; 14 16 15 - export type MyFoo = typeof MyFoo[keyof typeof MyFoo]; 17 + export type MyFoo2 = 'MyFoo' | 'MyBar'; 16 18 17 19 export const MyFoo2 = { 18 20 my_foo: 'MyFoo', 19 21 my_bar: 'MyBar' 20 22 } as const; 21 23 22 - export type MyFoo2 = typeof MyFoo2[keyof typeof MyFoo2]; 24 + export type Foo = 'foo' | 'bar' | null | '' | true | false; 23 25 24 26 export const Foo = { 25 27 foo: 'foo', ··· 30 32 false: false 31 33 } as const; 32 34 33 - export type Foo = typeof Foo[keyof typeof Foo]; 35 + export type Numbers = 100 | 200 | 300 | -100 | -200 | -300; 34 36 35 37 export const Numbers = { 36 38 100: 100, ··· 41 43 '-300': -300 42 44 } as const; 43 45 44 - export type Numbers = typeof Numbers[keyof typeof Numbers]; 46 + export type Arrays = [ 47 + 'foo' 48 + ] | [ 49 + 'bar' 50 + ] | [ 51 + 'baz' 52 + ]; 45 53 46 54 export const Arrays = { 47 55 0: ['foo'], 48 56 1: ['bar'], 49 57 2: ['baz'] 50 58 } as const; 51 - 52 - export type Arrays = typeof Arrays[keyof typeof Arrays]; 53 59 54 60 export type MyFooRef = { 55 61 foo?: Array<MyFoo2>;
+2 -4
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/headers/client/client.ts
··· 143 143 }; 144 144 } 145 145 146 - const textError = await response.text(); 147 - let jsonError: unknown; 146 + let error = await response.text(); 148 147 149 148 try { 150 - jsonError = JSON.parse(textError); 149 + error = JSON.parse(error); 151 150 } catch { 152 151 // noop 153 152 } 154 153 155 - const error = jsonError ?? textError; 156 154 let finalError = error; 157 155 158 156 for (const fn of interceptors.error._fns) {
-10
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/headers/core/params.ts
··· 3 3 export type Field = 4 4 | { 5 5 in: Exclude<Slot, 'body'>; 6 - /** 7 - * Field name. This is the name we want the user to see and use. 8 - */ 9 6 key: string; 10 - /** 11 - * Field mapped name. This is the name we want to use in the request. 12 - * If omitted, we use the same value as `key`. 13 - */ 14 7 map?: string; 15 8 } 16 9 | { 17 10 in: Extract<Slot, 'body'>; 18 - /** 19 - * Key isn't required for bodies. 20 - */ 21 11 key?: string; 22 12 map?: string; 23 13 };
-14
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/headers/core/types.ts
··· 102 102 */ 103 103 responseValidator?: (data: unknown) => Promise<unknown>; 104 104 } 105 - 106 - type IsExactlyNeverOrNeverUndefined<T> = [T] extends [never] 107 - ? true 108 - : [T] extends [never | undefined] 109 - ? [undefined] extends [T] 110 - ? false 111 - : true 112 - : false; 113 - 114 - export type OmitNever<T extends Record<string, unknown>> = { 115 - [K in keyof T as IsExactlyNeverOrNeverUndefined<T[K]> extends true 116 - ? never 117 - : K]: T[K]; 118 - };
+18 -42
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/integer-formats/valibot.gen.ts
··· 4 4 5 5 export const vIntegerFormats = v.object({ 6 6 numberNoFormat: v.optional(v.number()), 7 - 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'))), 8 - 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'))), 9 - 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'))), 10 - numberInt64: v.optional(v.pipe(v.union([ 11 - v.number(), 12 - v.string(), 13 - v.bigint() 14 - ]), 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'))), 15 - 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'))), 16 - 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'))), 17 - 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'))), 18 - numberUint64: v.optional(v.pipe(v.union([ 19 - v.number(), 20 - v.string(), 21 - v.bigint() 22 - ]), 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'))), 7 + numberInt8: v.optional(v.number()), 8 + numberInt16: v.optional(v.number()), 9 + numberInt32: v.optional(v.number()), 10 + numberInt64: v.optional(v.number()), 11 + numberUint8: v.optional(v.number()), 12 + numberUint16: v.optional(v.number()), 13 + numberUint32: v.optional(v.number()), 14 + numberUint64: v.optional(v.number()), 23 15 integerNoFormat: v.optional(v.pipe(v.number(), v.integer())), 24 - 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'))), 25 - 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'))), 26 - 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'))), 27 - integerInt64: v.optional(v.pipe(v.union([ 28 - v.number(), 29 - v.string(), 30 - v.bigint() 31 - ]), 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'))), 32 - 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'))), 33 - 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'))), 34 - 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'))), 35 - integerUint64: v.optional(v.pipe(v.union([ 36 - v.number(), 37 - v.string(), 38 - v.bigint() 39 - ]), 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'))), 40 - stringInt64: v.optional(v.pipe(v.union([ 41 - v.number(), 42 - v.string(), 43 - v.bigint() 44 - ]), 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'))), 45 - stringUint64: v.optional(v.pipe(v.union([ 46 - v.number(), 47 - v.string(), 48 - v.bigint() 49 - ]), 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'))) 16 + integerInt8: v.optional(v.pipe(v.number(), v.integer())), 17 + integerInt16: v.optional(v.pipe(v.number(), v.integer())), 18 + integerInt32: v.optional(v.pipe(v.number(), v.integer())), 19 + integerInt64: v.optional(v.bigint()), 20 + integerUint8: v.optional(v.pipe(v.number(), v.integer())), 21 + integerUint16: v.optional(v.pipe(v.number(), v.integer())), 22 + integerUint32: v.optional(v.pipe(v.number(), v.integer())), 23 + integerUint64: v.optional(v.pipe(v.number(), v.integer())), 24 + stringInt64: v.optional(v.string()), 25 + stringUint64: v.optional(v.string()) 50 26 });
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/internal-name-conflict/@tanstack/react-query.gen.ts
··· 15 15 const createQueryKey = <TOptions extends Options>(id: string, options?: TOptions, infinite?: boolean): [ 16 16 QueryKey<TOptions>[0] 17 17 ] => { 18 - const params: QueryKey<TOptions>[0] = { _id: id, baseUrl: options?.baseUrl || (options?.client ?? _heyApiClient).getConfig().baseUrl } as QueryKey<TOptions>[0]; 18 + const params: QueryKey<TOptions>[0] = { _id: id, baseUrl: (options?.client ?? _heyApiClient).getConfig().baseUrl } as QueryKey<TOptions>[0]; 19 19 if (infinite) { 20 20 params._infinite = infinite; 21 21 }
+2 -4
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/internal-name-conflict/client/client.ts
··· 143 143 }; 144 144 } 145 145 146 - const textError = await response.text(); 147 - let jsonError: unknown; 146 + let error = await response.text(); 148 147 149 148 try { 150 - jsonError = JSON.parse(textError); 149 + error = JSON.parse(error); 151 150 } catch { 152 151 // noop 153 152 } 154 153 155 - const error = jsonError ?? textError; 156 154 let finalError = error; 157 155 158 156 for (const fn of interceptors.error._fns) {
-10
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/internal-name-conflict/core/params.ts
··· 3 3 export type Field = 4 4 | { 5 5 in: Exclude<Slot, 'body'>; 6 - /** 7 - * Field name. This is the name we want the user to see and use. 8 - */ 9 6 key: string; 10 - /** 11 - * Field mapped name. This is the name we want to use in the request. 12 - * If omitted, we use the same value as `key`. 13 - */ 14 7 map?: string; 15 8 } 16 9 | { 17 10 in: Extract<Slot, 'body'>; 18 - /** 19 - * Key isn't required for bodies. 20 - */ 21 11 key?: string; 22 12 map?: string; 23 13 };
-14
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/internal-name-conflict/core/types.ts
··· 102 102 */ 103 103 responseValidator?: (data: unknown) => Promise<unknown>; 104 104 } 105 - 106 - type IsExactlyNeverOrNeverUndefined<T> = [T] extends [never] 107 - ? true 108 - : [T] extends [never | undefined] 109 - ? [undefined] extends [T] 110 - ? false 111 - : true 112 - : false; 113 - 114 - export type OmitNever<T extends Record<string, unknown>> = { 115 - [K in keyof T as IsExactlyNeverOrNeverUndefined<T[K]> extends true 116 - ? never 117 - : K]: T[K]; 118 - };
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/pagination-ref/@tanstack/react-query.gen.ts
··· 15 15 const createQueryKey = <TOptions extends Options>(id: string, options?: TOptions, infinite?: boolean): [ 16 16 QueryKey<TOptions>[0] 17 17 ] => { 18 - const params: QueryKey<TOptions>[0] = { _id: id, baseUrl: options?.baseUrl || (options?.client ?? _heyApiClient).getConfig().baseUrl } as QueryKey<TOptions>[0]; 18 + const params: QueryKey<TOptions>[0] = { _id: id, baseUrl: (options?.client ?? _heyApiClient).getConfig().baseUrl } as QueryKey<TOptions>[0]; 19 19 if (infinite) { 20 20 params._infinite = infinite; 21 21 }
+2 -4
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/pagination-ref/client/client.ts
··· 143 143 }; 144 144 } 145 145 146 - const textError = await response.text(); 147 - let jsonError: unknown; 146 + let error = await response.text(); 148 147 149 148 try { 150 - jsonError = JSON.parse(textError); 149 + error = JSON.parse(error); 151 150 } catch { 152 151 // noop 153 152 } 154 153 155 - const error = jsonError ?? textError; 156 154 let finalError = error; 157 155 158 156 for (const fn of interceptors.error._fns) {
-10
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/pagination-ref/core/params.ts
··· 3 3 export type Field = 4 4 | { 5 5 in: Exclude<Slot, 'body'>; 6 - /** 7 - * Field name. This is the name we want the user to see and use. 8 - */ 9 6 key: string; 10 - /** 11 - * Field mapped name. This is the name we want to use in the request. 12 - * If omitted, we use the same value as `key`. 13 - */ 14 7 map?: string; 15 8 } 16 9 | { 17 10 in: Extract<Slot, 'body'>; 18 - /** 19 - * Key isn't required for bodies. 20 - */ 21 11 key?: string; 22 12 map?: string; 23 13 };
-14
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/pagination-ref/core/types.ts
··· 102 102 */ 103 103 responseValidator?: (data: unknown) => Promise<unknown>; 104 104 } 105 - 106 - type IsExactlyNeverOrNeverUndefined<T> = [T] extends [never] 107 - ? true 108 - : [T] extends [never | undefined] 109 - ? [undefined] extends [T] 110 - ? false 111 - : true 112 - : false; 113 - 114 - export type OmitNever<T extends Record<string, unknown>> = { 115 - [K in keyof T as IsExactlyNeverOrNeverUndefined<T[K]> extends true 116 - ? never 117 - : K]: T[K]; 118 - };
+4 -10
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/parameter-explode-false-axios/client/client.ts
··· 1 - import type { AxiosError, AxiosInstance, RawAxiosRequestHeaders } from 'axios'; 1 + import type { AxiosError, RawAxiosRequestHeaders } from 'axios'; 2 2 import axios from 'axios'; 3 3 4 4 import type { Client, Config } from './types'; ··· 13 13 export const createClient = (config: Config = {}): Client => { 14 14 let _config = mergeConfigs(createConfig(), config); 15 15 16 - let instance: AxiosInstance; 17 - 18 - if (_config.axios && !('Axios' in _config.axios)) { 19 - instance = _config.axios; 20 - } else { 21 - // eslint-disable-next-line @typescript-eslint/no-unused-vars 22 - const { auth, ...configWithoutAuth } = _config; 23 - instance = axios.create(configWithoutAuth); 24 - } 16 + // eslint-disable-next-line @typescript-eslint/no-unused-vars 17 + const { auth, ...configWithoutAuth } = _config; 18 + const instance = axios.create(configWithoutAuth); 25 19 26 20 const getConfig = (): Config => ({ ..._config }); 27 21
+4 -5
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/parameter-explode-false-axios/client/types.ts
··· 1 1 import type { 2 2 AxiosError, 3 3 AxiosInstance, 4 - AxiosRequestHeaders, 5 4 AxiosResponse, 6 5 AxiosStatic, 7 6 CreateAxiosDefaults, ··· 17 16 extends Omit<CreateAxiosDefaults, 'auth' | 'baseURL' | 'headers' | 'method'>, 18 17 CoreConfig { 19 18 /** 20 - * Axios implementation. You can use this option to provide either an 21 - * `AxiosStatic` or an `AxiosInstance`. 19 + * Axios implementation. You can use this option to provide a custom 20 + * Axios instance. 22 21 * 23 22 * @default axios 24 23 */ 25 - axios?: AxiosStatic | AxiosInstance; 24 + axios?: AxiosStatic; 26 25 /** 27 26 * Base URL for all requests made by this client. 28 27 */ ··· 34 33 * {@link https://developer.mozilla.org/docs/Web/API/Headers/Headers#init See more} 35 34 */ 36 35 headers?: 37 - | AxiosRequestHeaders 36 + | CreateAxiosDefaults['headers'] 38 37 | Record< 39 38 string, 40 39 | string
-10
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/parameter-explode-false-axios/core/params.ts
··· 3 3 export type Field = 4 4 | { 5 5 in: Exclude<Slot, 'body'>; 6 - /** 7 - * Field name. This is the name we want the user to see and use. 8 - */ 9 6 key: string; 10 - /** 11 - * Field mapped name. This is the name we want to use in the request. 12 - * If omitted, we use the same value as `key`. 13 - */ 14 7 map?: string; 15 8 } 16 9 | { 17 10 in: Extract<Slot, 'body'>; 18 - /** 19 - * Key isn't required for bodies. 20 - */ 21 11 key?: string; 22 12 map?: string; 23 13 };
-14
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/parameter-explode-false-axios/core/types.ts
··· 102 102 */ 103 103 responseValidator?: (data: unknown) => Promise<unknown>; 104 104 } 105 - 106 - type IsExactlyNeverOrNeverUndefined<T> = [T] extends [never] 107 - ? true 108 - : [T] extends [never | undefined] 109 - ? [undefined] extends [T] 110 - ? false 111 - : true 112 - : false; 113 - 114 - export type OmitNever<T extends Record<string, unknown>> = { 115 - [K in keyof T as IsExactlyNeverOrNeverUndefined<T[K]> extends true 116 - ? never 117 - : K]: T[K]; 118 - };
+2 -4
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/parameter-explode-false/client/client.ts
··· 143 143 }; 144 144 } 145 145 146 - const textError = await response.text(); 147 - let jsonError: unknown; 146 + let error = await response.text(); 148 147 149 148 try { 150 - jsonError = JSON.parse(textError); 149 + error = JSON.parse(error); 151 150 } catch { 152 151 // noop 153 152 } 154 153 155 - const error = jsonError ?? textError; 156 154 let finalError = error; 157 155 158 156 for (const fn of interceptors.error._fns) {
-10
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/parameter-explode-false/core/params.ts
··· 3 3 export type Field = 4 4 | { 5 5 in: Exclude<Slot, 'body'>; 6 - /** 7 - * Field name. This is the name we want the user to see and use. 8 - */ 9 6 key: string; 10 - /** 11 - * Field mapped name. This is the name we want to use in the request. 12 - * If omitted, we use the same value as `key`. 13 - */ 14 7 map?: string; 15 8 } 16 9 | { 17 10 in: Extract<Slot, 'body'>; 18 - /** 19 - * Key isn't required for bodies. 20 - */ 21 11 key?: string; 22 12 map?: string; 23 13 };
-14
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/parameter-explode-false/core/types.ts
··· 102 102 */ 103 103 responseValidator?: (data: unknown) => Promise<unknown>; 104 104 } 105 - 106 - type IsExactlyNeverOrNeverUndefined<T> = [T] extends [never] 107 - ? true 108 - : [T] extends [never | undefined] 109 - ? [undefined] extends [T] 110 - ? false 111 - : true 112 - : false; 113 - 114 - export type OmitNever<T extends Record<string, unknown>> = { 115 - [K in keyof T as IsExactlyNeverOrNeverUndefined<T[K]> extends true 116 - ? never 117 - : K]: T[K]; 118 - };
+7 -7
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/schema-const/valibot.gen.ts
··· 15 15 v.literal(true) 16 16 ])), 17 17 corge: v.optional(v.object({})), 18 - garply: v.optional(v.literal(BigInt('10'))), 18 + garply: v.optional(v.bigint()), 19 19 numberInt8: v.optional(v.literal(100)), 20 20 numberInt16: v.optional(v.literal(1000)), 21 21 numberInt32: v.optional(v.literal(100000)), 22 - numberInt64: v.optional(v.literal(BigInt('1000000000000'))), 22 + numberInt64: v.optional(v.literal(1000000000000)), 23 23 numberUint8: v.optional(v.literal(200)), 24 24 numberUint16: v.optional(v.literal(50000)), 25 25 numberUint32: v.optional(v.literal(3000000000)), 26 - numberUint64: v.optional(v.literal(BigInt('18000000000000000000'))), 26 + numberUint64: v.optional(v.literal(18000000000000000000)), 27 27 integerInt8: v.optional(v.literal(-100)), 28 28 integerInt16: v.optional(v.literal(-1000)), 29 29 integerInt32: v.optional(v.literal(-100000)), 30 - integerInt64: v.optional(v.literal(BigInt('-1000000000000'))), 30 + integerInt64: v.optional(v.literal(-1000000000000)), 31 31 integerUint8: v.optional(v.literal(255)), 32 32 integerUint16: v.optional(v.literal(65535)), 33 33 integerUint32: v.optional(v.literal(4294967295)), 34 - integerUint64: v.optional(v.literal(BigInt('18446744073709551615'))), 35 - stringInt64: v.optional(v.literal(BigInt('-9223372036854775808'))), 36 - stringUint64: v.optional(v.literal(BigInt('18446744073709551615'))) 34 + integerUint64: v.optional(v.pipe(v.number(), v.integer())), 35 + stringInt64: v.optional(v.literal('-9223372036854775808')), 36 + stringUint64: v.optional(v.literal('18446744073709551615')) 37 37 });
+2 -4
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-api-key/client/client.ts
··· 143 143 }; 144 144 } 145 145 146 - const textError = await response.text(); 147 - let jsonError: unknown; 146 + let error = await response.text(); 148 147 149 148 try { 150 - jsonError = JSON.parse(textError); 149 + error = JSON.parse(error); 151 150 } catch { 152 151 // noop 153 152 } 154 153 155 - const error = jsonError ?? textError; 156 154 let finalError = error; 157 155 158 156 for (const fn of interceptors.error._fns) {
-10
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-api-key/core/params.ts
··· 3 3 export type Field = 4 4 | { 5 5 in: Exclude<Slot, 'body'>; 6 - /** 7 - * Field name. This is the name we want the user to see and use. 8 - */ 9 6 key: string; 10 - /** 11 - * Field mapped name. This is the name we want to use in the request. 12 - * If omitted, we use the same value as `key`. 13 - */ 14 7 map?: string; 15 8 } 16 9 | { 17 10 in: Extract<Slot, 'body'>; 18 - /** 19 - * Key isn't required for bodies. 20 - */ 21 11 key?: string; 22 12 map?: string; 23 13 };
-14
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-api-key/core/types.ts
··· 102 102 */ 103 103 responseValidator?: (data: unknown) => Promise<unknown>; 104 104 } 105 - 106 - type IsExactlyNeverOrNeverUndefined<T> = [T] extends [never] 107 - ? true 108 - : [T] extends [never | undefined] 109 - ? [undefined] extends [T] 110 - ? false 111 - : true 112 - : false; 113 - 114 - export type OmitNever<T extends Record<string, unknown>> = { 115 - [K in keyof T as IsExactlyNeverOrNeverUndefined<T[K]> extends true 116 - ? never 117 - : K]: T[K]; 118 - };
+2 -4
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-false/client/client.ts
··· 143 143 }; 144 144 } 145 145 146 - const textError = await response.text(); 147 - let jsonError: unknown; 146 + let error = await response.text(); 148 147 149 148 try { 150 - jsonError = JSON.parse(textError); 149 + error = JSON.parse(error); 151 150 } catch { 152 151 // noop 153 152 } 154 153 155 - const error = jsonError ?? textError; 156 154 let finalError = error; 157 155 158 156 for (const fn of interceptors.error._fns) {
-10
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-false/core/params.ts
··· 3 3 export type Field = 4 4 | { 5 5 in: Exclude<Slot, 'body'>; 6 - /** 7 - * Field name. This is the name we want the user to see and use. 8 - */ 9 6 key: string; 10 - /** 11 - * Field mapped name. This is the name we want to use in the request. 12 - * If omitted, we use the same value as `key`. 13 - */ 14 7 map?: string; 15 8 } 16 9 | { 17 10 in: Extract<Slot, 'body'>; 18 - /** 19 - * Key isn't required for bodies. 20 - */ 21 11 key?: string; 22 12 map?: string; 23 13 };
-14
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-false/core/types.ts
··· 102 102 */ 103 103 responseValidator?: (data: unknown) => Promise<unknown>; 104 104 } 105 - 106 - type IsExactlyNeverOrNeverUndefined<T> = [T] extends [never] 107 - ? true 108 - : [T] extends [never | undefined] 109 - ? [undefined] extends [T] 110 - ? false 111 - : true 112 - : false; 113 - 114 - export type OmitNever<T extends Record<string, unknown>> = { 115 - [K in keyof T as IsExactlyNeverOrNeverUndefined<T[K]> extends true 116 - ? never 117 - : K]: T[K]; 118 - };
+2 -4
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-http-bearer/client/client.ts
··· 143 143 }; 144 144 } 145 145 146 - const textError = await response.text(); 147 - let jsonError: unknown; 146 + let error = await response.text(); 148 147 149 148 try { 150 - jsonError = JSON.parse(textError); 149 + error = JSON.parse(error); 151 150 } catch { 152 151 // noop 153 152 } 154 153 155 - const error = jsonError ?? textError; 156 154 let finalError = error; 157 155 158 156 for (const fn of interceptors.error._fns) {
-10
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-http-bearer/core/params.ts
··· 3 3 export type Field = 4 4 | { 5 5 in: Exclude<Slot, 'body'>; 6 - /** 7 - * Field name. This is the name we want the user to see and use. 8 - */ 9 6 key: string; 10 - /** 11 - * Field mapped name. This is the name we want to use in the request. 12 - * If omitted, we use the same value as `key`. 13 - */ 14 7 map?: string; 15 8 } 16 9 | { 17 10 in: Extract<Slot, 'body'>; 18 - /** 19 - * Key isn't required for bodies. 20 - */ 21 11 key?: string; 22 12 map?: string; 23 13 };
-14
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-http-bearer/core/types.ts
··· 102 102 */ 103 103 responseValidator?: (data: unknown) => Promise<unknown>; 104 104 } 105 - 106 - type IsExactlyNeverOrNeverUndefined<T> = [T] extends [never] 107 - ? true 108 - : [T] extends [never | undefined] 109 - ? [undefined] extends [T] 110 - ? false 111 - : true 112 - : false; 113 - 114 - export type OmitNever<T extends Record<string, unknown>> = { 115 - [K in keyof T as IsExactlyNeverOrNeverUndefined<T[K]> extends true 116 - ? never 117 - : K]: T[K]; 118 - };
+2 -4
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-oauth2/client/client.ts
··· 143 143 }; 144 144 } 145 145 146 - const textError = await response.text(); 147 - let jsonError: unknown; 146 + let error = await response.text(); 148 147 149 148 try { 150 - jsonError = JSON.parse(textError); 149 + error = JSON.parse(error); 151 150 } catch { 152 151 // noop 153 152 } 154 153 155 - const error = jsonError ?? textError; 156 154 let finalError = error; 157 155 158 156 for (const fn of interceptors.error._fns) {
-10
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-oauth2/core/params.ts
··· 3 3 export type Field = 4 4 | { 5 5 in: Exclude<Slot, 'body'>; 6 - /** 7 - * Field name. This is the name we want the user to see and use. 8 - */ 9 6 key: string; 10 - /** 11 - * Field mapped name. This is the name we want to use in the request. 12 - * If omitted, we use the same value as `key`. 13 - */ 14 7 map?: string; 15 8 } 16 9 | { 17 10 in: Extract<Slot, 'body'>; 18 - /** 19 - * Key isn't required for bodies. 20 - */ 21 11 key?: string; 22 12 map?: string; 23 13 };
-14
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-oauth2/core/types.ts
··· 102 102 */ 103 103 responseValidator?: (data: unknown) => Promise<unknown>; 104 104 } 105 - 106 - type IsExactlyNeverOrNeverUndefined<T> = [T] extends [never] 107 - ? true 108 - : [T] extends [never | undefined] 109 - ? [undefined] extends [T] 110 - ? false 111 - : true 112 - : false; 113 - 114 - export type OmitNever<T extends Record<string, unknown>> = { 115 - [K in keyof T as IsExactlyNeverOrNeverUndefined<T[K]> extends true 116 - ? never 117 - : K]: T[K]; 118 - };
+2 -4
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-open-id-connect/client/client.ts
··· 143 143 }; 144 144 } 145 145 146 - const textError = await response.text(); 147 - let jsonError: unknown; 146 + let error = await response.text(); 148 147 149 148 try { 150 - jsonError = JSON.parse(textError); 149 + error = JSON.parse(error); 151 150 } catch { 152 151 // noop 153 152 } 154 153 155 - const error = jsonError ?? textError; 156 154 let finalError = error; 157 155 158 156 for (const fn of interceptors.error._fns) {
-10
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-open-id-connect/core/params.ts
··· 3 3 export type Field = 4 4 | { 5 5 in: Exclude<Slot, 'body'>; 6 - /** 7 - * Field name. This is the name we want the user to see and use. 8 - */ 9 6 key: string; 10 - /** 11 - * Field mapped name. This is the name we want to use in the request. 12 - * If omitted, we use the same value as `key`. 13 - */ 14 7 map?: string; 15 8 } 16 9 | { 17 10 in: Extract<Slot, 'body'>; 18 - /** 19 - * Key isn't required for bodies. 20 - */ 21 11 key?: string; 22 12 map?: string; 23 13 };
-14
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-open-id-connect/core/types.ts
··· 102 102 */ 103 103 responseValidator?: (data: unknown) => Promise<unknown>; 104 104 } 105 - 106 - type IsExactlyNeverOrNeverUndefined<T> = [T] extends [never] 107 - ? true 108 - : [T] extends [never | undefined] 109 - ? [undefined] extends [T] 110 - ? false 111 - : true 112 - : false; 113 - 114 - export type OmitNever<T extends Record<string, unknown>> = { 115 - [K in keyof T as IsExactlyNeverOrNeverUndefined<T[K]> extends true 116 - ? never 117 - : K]: T[K]; 118 - };
+2 -4
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/servers/client/client.ts
··· 143 143 }; 144 144 } 145 145 146 - const textError = await response.text(); 147 - let jsonError: unknown; 146 + let error = await response.text(); 148 147 149 148 try { 150 - jsonError = JSON.parse(textError); 149 + error = JSON.parse(error); 151 150 } catch { 152 151 // noop 153 152 } 154 153 155 - const error = jsonError ?? textError; 156 154 let finalError = error; 157 155 158 156 for (const fn of interceptors.error._fns) {
-10
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/servers/core/params.ts
··· 3 3 export type Field = 4 4 | { 5 5 in: Exclude<Slot, 'body'>; 6 - /** 7 - * Field name. This is the name we want the user to see and use. 8 - */ 9 6 key: string; 10 - /** 11 - * Field mapped name. This is the name we want to use in the request. 12 - * If omitted, we use the same value as `key`. 13 - */ 14 7 map?: string; 15 8 } 16 9 | { 17 10 in: Extract<Slot, 'body'>; 18 - /** 19 - * Key isn't required for bodies. 20 - */ 21 11 key?: string; 22 12 map?: string; 23 13 };
-14
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/servers/core/types.ts
··· 102 102 */ 103 103 responseValidator?: (data: unknown) => Promise<unknown>; 104 104 } 105 - 106 - type IsExactlyNeverOrNeverUndefined<T> = [T] extends [never] 107 - ? true 108 - : [T] extends [never | undefined] 109 - ? [undefined] extends [T] 110 - ? false 111 - : true 112 - : false; 113 - 114 - export type OmitNever<T extends Record<string, unknown>> = { 115 - [K in keyof T as IsExactlyNeverOrNeverUndefined<T[K]> extends true 116 - ? never 117 - : K]: T[K]; 118 - };
+2 -4
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-all-of/client/client.ts
··· 143 143 }; 144 144 } 145 145 146 - const textError = await response.text(); 147 - let jsonError: unknown; 146 + let error = await response.text(); 148 147 149 148 try { 150 - jsonError = JSON.parse(textError); 149 + error = JSON.parse(error); 151 150 } catch { 152 151 // noop 153 152 } 154 153 155 - const error = jsonError ?? textError; 156 154 let finalError = error; 157 155 158 156 for (const fn of interceptors.error._fns) {
-10
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-all-of/core/params.ts
··· 3 3 export type Field = 4 4 | { 5 5 in: Exclude<Slot, 'body'>; 6 - /** 7 - * Field name. This is the name we want the user to see and use. 8 - */ 9 6 key: string; 10 - /** 11 - * Field mapped name. This is the name we want to use in the request. 12 - * If omitted, we use the same value as `key`. 13 - */ 14 7 map?: string; 15 8 } 16 9 | { 17 10 in: Extract<Slot, 'body'>; 18 - /** 19 - * Key isn't required for bodies. 20 - */ 21 11 key?: string; 22 12 map?: string; 23 13 };
-14
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-all-of/core/types.ts
··· 102 102 */ 103 103 responseValidator?: (data: unknown) => Promise<unknown>; 104 104 } 105 - 106 - type IsExactlyNeverOrNeverUndefined<T> = [T] extends [never] 107 - ? true 108 - : [T] extends [never | undefined] 109 - ? [undefined] extends [T] 110 - ? false 111 - : true 112 - : false; 113 - 114 - export type OmitNever<T extends Record<string, unknown>> = { 115 - [K in keyof T as IsExactlyNeverOrNeverUndefined<T[K]> extends true 116 - ? never 117 - : K]: T[K]; 118 - };
+2 -4
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-any-of-null/client/client.ts
··· 143 143 }; 144 144 } 145 145 146 - const textError = await response.text(); 147 - let jsonError: unknown; 146 + let error = await response.text(); 148 147 149 148 try { 150 - jsonError = JSON.parse(textError); 149 + error = JSON.parse(error); 151 150 } catch { 152 151 // noop 153 152 } 154 153 155 - const error = jsonError ?? textError; 156 154 let finalError = error; 157 155 158 156 for (const fn of interceptors.error._fns) {
-10
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-any-of-null/core/params.ts
··· 3 3 export type Field = 4 4 | { 5 5 in: Exclude<Slot, 'body'>; 6 - /** 7 - * Field name. This is the name we want the user to see and use. 8 - */ 9 6 key: string; 10 - /** 11 - * Field mapped name. This is the name we want to use in the request. 12 - * If omitted, we use the same value as `key`. 13 - */ 14 7 map?: string; 15 8 } 16 9 | { 17 10 in: Extract<Slot, 'body'>; 18 - /** 19 - * Key isn't required for bodies. 20 - */ 21 11 key?: string; 22 12 map?: string; 23 13 };
-14
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-any-of-null/core/types.ts
··· 102 102 */ 103 103 responseValidator?: (data: unknown) => Promise<unknown>; 104 104 } 105 - 106 - type IsExactlyNeverOrNeverUndefined<T> = [T] extends [never] 107 - ? true 108 - : [T] extends [never | undefined] 109 - ? [undefined] extends [T] 110 - ? false 111 - : true 112 - : false; 113 - 114 - export type OmitNever<T extends Record<string, unknown>> = { 115 - [K in keyof T as IsExactlyNeverOrNeverUndefined<T[K]> extends true 116 - ? never 117 - : K]: T[K]; 118 - };
+2 -4
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-array/client/client.ts
··· 143 143 }; 144 144 } 145 145 146 - const textError = await response.text(); 147 - let jsonError: unknown; 146 + let error = await response.text(); 148 147 149 148 try { 150 - jsonError = JSON.parse(textError); 149 + error = JSON.parse(error); 151 150 } catch { 152 151 // noop 153 152 } 154 153 155 - const error = jsonError ?? textError; 156 154 let finalError = error; 157 155 158 156 for (const fn of interceptors.error._fns) {
-10
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-array/core/params.ts
··· 3 3 export type Field = 4 4 | { 5 5 in: Exclude<Slot, 'body'>; 6 - /** 7 - * Field name. This is the name we want the user to see and use. 8 - */ 9 6 key: string; 10 - /** 11 - * Field mapped name. This is the name we want to use in the request. 12 - * If omitted, we use the same value as `key`. 13 - */ 14 7 map?: string; 15 8 } 16 9 | { 17 10 in: Extract<Slot, 'body'>; 18 - /** 19 - * Key isn't required for bodies. 20 - */ 21 11 key?: string; 22 12 map?: string; 23 13 };
-14
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-array/core/types.ts
··· 102 102 */ 103 103 responseValidator?: (data: unknown) => Promise<unknown>; 104 104 } 105 - 106 - type IsExactlyNeverOrNeverUndefined<T> = [T] extends [never] 107 - ? true 108 - : [T] extends [never | undefined] 109 - ? [undefined] extends [T] 110 - ? false 111 - : true 112 - : false; 113 - 114 - export type OmitNever<T extends Record<string, unknown>> = { 115 - [K in keyof T as IsExactlyNeverOrNeverUndefined<T[K]> extends true 116 - ? never 117 - : K]: T[K]; 118 - };
+2 -4
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transforms-read-write/client/client.ts
··· 143 143 }; 144 144 } 145 145 146 - const textError = await response.text(); 147 - let jsonError: unknown; 146 + let error = await response.text(); 148 147 149 148 try { 150 - jsonError = JSON.parse(textError); 149 + error = JSON.parse(error); 151 150 } catch { 152 151 // noop 153 152 } 154 153 155 - const error = jsonError ?? textError; 156 154 let finalError = error; 157 155 158 156 for (const fn of interceptors.error._fns) {
-10
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transforms-read-write/core/params.ts
··· 3 3 export type Field = 4 4 | { 5 5 in: Exclude<Slot, 'body'>; 6 - /** 7 - * Field name. This is the name we want the user to see and use. 8 - */ 9 6 key: string; 10 - /** 11 - * Field mapped name. This is the name we want to use in the request. 12 - * If omitted, we use the same value as `key`. 13 - */ 14 7 map?: string; 15 8 } 16 9 | { 17 10 in: Extract<Slot, 'body'>; 18 - /** 19 - * Key isn't required for bodies. 20 - */ 21 11 key?: string; 22 12 map?: string; 23 13 };
-14
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transforms-read-write/core/types.ts
··· 102 102 */ 103 103 responseValidator?: (data: unknown) => Promise<unknown>; 104 104 } 105 - 106 - type IsExactlyNeverOrNeverUndefined<T> = [T] extends [never] 107 - ? true 108 - : [T] extends [never | undefined] 109 - ? [undefined] extends [T] 110 - ? false 111 - : true 112 - : false; 113 - 114 - export type OmitNever<T extends Record<string, unknown>> = { 115 - [K in keyof T as IsExactlyNeverOrNeverUndefined<T[K]> extends true 116 - ? never 117 - : K]: T[K]; 118 - };
+1 -5
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/validators-bigint-min-max/valibot.gen.ts
··· 3 3 import * as v from 'valibot'; 4 4 5 5 export const vFoo = v.object({ 6 - foo: v.optional(v.pipe(v.union([ 7 - v.number(), 8 - v.string(), 9 - v.bigint() 10 - ]), 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)))) 6 + foo: v.optional(v.pipe(v.bigint(), v.minValue(BigInt(0)), v.maxValue(BigInt(100)))) 11 7 });
+2 -2
packages/openapi-ts-tests/zod/v3/__snapshots__/3.0.x/mini/array-items-one-of-length-1/zod.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 - import * as z from 'zod/v4-mini'; 3 + import { z } from 'zod'; 4 4 5 5 export const zBar = z.string(); 6 6 7 7 export const zFoo = z.object({ 8 - foo: z.optional(z.array(zBar).check(z.minLength(1), z.maxLength(2147483647))) 8 + foo: z.array(zBar).min(1).max(2147483647).optional() 9 9 });
+3 -3
packages/openapi-ts-tests/zod/v3/__snapshots__/3.0.x/mini/enum-null/zod.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 - import * as z from 'zod/v4-mini'; 3 + import { z } from 'zod'; 4 4 5 - export const zFoo = z.nullable(z.enum([ 5 + export const zFoo = z.enum([ 6 6 'foo', 7 7 'bar' 8 - ])); 8 + ]).nullable(); 9 9 10 10 export const zBar = z.enum([ 11 11 'foo',
+14 -16
packages/openapi-ts-tests/zod/v3/__snapshots__/3.0.x/mini/validators/zod.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 - import * as z from 'zod/v4-mini'; 3 + import { z } from 'zod'; 4 4 5 - export const zBar = z.object({ 6 - get foo(): z.ZodMiniOptional { 7 - return z.optional(zFoo); 8 - } 5 + export const zBar: z.AnyZodObject = z.object({ 6 + foo: z.lazy(() => { 7 + return zFoo; 8 + }).optional() 9 9 }); 10 10 11 - export const zFoo = z._default(z.union([ 11 + export const zFoo: z.ZodTypeAny = z.union([ 12 12 z.object({ 13 - foo: z.optional(z.string().check(z.regex(/^\d{3}-\d{2}-\d{4}$/))), 14 - bar: z.optional(zBar), 15 - get baz(): z.ZodMiniOptional { 16 - return z.optional(z.array(z.lazy((): any => { 17 - return zFoo; 18 - }))); 19 - }, 20 - qux: z._default(z.optional(z.int().check(z.gt(0))), 0) 13 + foo: z.string().regex(/^\d{3}-\d{2}-\d{4}$/).optional(), 14 + bar: zBar.optional(), 15 + baz: z.array(z.lazy(() => { 16 + return zFoo; 17 + })).optional(), 18 + qux: z.number().int().gt(0).optional().default(0) 21 19 }), 22 20 z.null() 23 - ]), null); 21 + ]).default(null); 24 22 25 - export const zBaz = z._default(z.readonly(z.string().check(z.regex(/foo\nbar/))), 'baz'); 23 + export const zBaz = z.string().regex(/foo\nbar/).readonly().default('baz');
+2 -2
packages/openapi-ts-tests/zod/v3/__snapshots__/3.0.x/v4/array-items-one-of-length-1/zod.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 - import { z } from 'zod/v4'; 3 + import { z } from 'zod'; 4 4 5 5 export const zBar = z.string(); 6 6 7 7 export const zFoo = z.object({ 8 - foo: z.optional(z.array(zBar).min(1).max(2147483647)) 8 + foo: z.array(zBar).min(1).max(2147483647).optional() 9 9 });
+3 -3
packages/openapi-ts-tests/zod/v3/__snapshots__/3.0.x/v4/enum-null/zod.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 - import { z } from 'zod/v4'; 3 + import { z } from 'zod'; 4 4 5 - export const zFoo = z.nullable(z.enum([ 5 + export const zFoo = z.enum([ 6 6 'foo', 7 7 'bar' 8 - ])); 8 + ]).nullable(); 9 9 10 10 export const zBar = z.enum([ 11 11 'foo',
+12 -14
packages/openapi-ts-tests/zod/v3/__snapshots__/3.0.x/v4/validators/zod.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 - import { z } from 'zod/v4'; 3 + import { z } from 'zod'; 4 4 5 - export const zBar = z.object({ 6 - get foo(): z.ZodOptional { 7 - return z.optional(zFoo); 8 - } 5 + export const zBar: z.AnyZodObject = z.object({ 6 + foo: z.lazy(() => { 7 + return zFoo; 8 + }).optional() 9 9 }); 10 10 11 - export const zFoo = z.union([ 11 + export const zFoo: z.ZodTypeAny = z.union([ 12 12 z.object({ 13 - foo: z.optional(z.string().regex(/^\d{3}-\d{2}-\d{4}$/)), 14 - bar: z.optional(zBar), 15 - get baz(): z.ZodOptional { 16 - return z.optional(z.array(z.lazy((): any => { 17 - return zFoo; 18 - }))); 19 - }, 20 - qux: z.optional(z.int().gt(0)).default(0) 13 + foo: z.string().regex(/^\d{3}-\d{2}-\d{4}$/).optional(), 14 + bar: zBar.optional(), 15 + baz: z.array(z.lazy(() => { 16 + return zFoo; 17 + })).optional(), 18 + qux: z.number().int().gt(0).optional().default(0) 21 19 }), 22 20 z.null() 23 21 ]).default(null);
+2 -2
packages/openapi-ts-tests/zod/v3/__snapshots__/3.1.x/mini/array-items-one-of-length-1/zod.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 - import * as z from 'zod/v4-mini'; 3 + import { z } from 'zod'; 4 4 5 5 export const zBar = z.string(); 6 6 7 7 export const zFoo = z.object({ 8 - foo: z.optional(z.array(zBar).check(z.minLength(1), z.maxLength(2147483647))) 8 + foo: z.array(zBar).min(1).max(2147483647).optional() 9 9 });
+3 -3
packages/openapi-ts-tests/zod/v3/__snapshots__/3.1.x/mini/enum-null/zod.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 - import * as z from 'zod/v4-mini'; 3 + import { z } from 'zod'; 4 4 5 - export const zFoo = z.nullable(z.enum([ 5 + export const zFoo = z.enum([ 6 6 'foo', 7 7 'bar' 8 - ])); 8 + ]).nullable(); 9 9 10 10 export const zBar = z.enum([ 11 11 'foo',
+27 -27
packages/openapi-ts-tests/zod/v3/__snapshots__/3.1.x/mini/schema-const/zod.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 - import * as z from 'zod/v4-mini'; 3 + import { z } from 'zod'; 4 4 5 5 export const zFoo = z.object({ 6 - foo: z.optional(z.literal('foo')), 7 - bar: z.optional(z.literal(3.2)), 8 - baz: z.optional(z.literal(-1)), 9 - qux: z.optional(z.literal(true)), 10 - quux: z.optional(z.tuple([ 6 + foo: z.literal('foo').optional(), 7 + bar: z.literal(3.2).optional(), 8 + baz: z.literal(-1).optional(), 9 + qux: z.literal(true).optional(), 10 + quux: z.tuple([ 11 11 z.literal(1), 12 12 z.literal(2), 13 13 z.literal(3), 14 14 z.literal('foo'), 15 15 z.literal(true) 16 - ])), 17 - corge: z.optional(z.object({})), 18 - garply: z.optional(z.coerce.bigint()), 19 - numberInt8: z.optional(z.literal(100)), 20 - numberInt16: z.optional(z.literal(1000)), 21 - numberInt32: z.optional(z.literal(100000)), 22 - numberInt64: z.optional(z.literal(1000000000000)), 23 - numberUint8: z.optional(z.literal(200)), 24 - numberUint16: z.optional(z.literal(50000)), 25 - numberUint32: z.optional(z.literal(3000000000)), 26 - numberUint64: z.optional(z.literal(18000000000000000000)), 27 - integerInt8: z.optional(z.literal(-100)), 28 - integerInt16: z.optional(z.literal(-1000)), 29 - integerInt32: z.optional(z.literal(-100000)), 30 - integerInt64: z.optional(z.literal(-1000000000000)), 31 - integerUint8: z.optional(z.literal(255)), 32 - integerUint16: z.optional(z.literal(65535)), 33 - integerUint32: z.optional(z.literal(4294967295)), 34 - integerUint64: z.optional(z.int()), 35 - stringInt64: z.optional(z.literal('-9223372036854775808')), 36 - stringUint64: z.optional(z.literal('18446744073709551615')) 16 + ]).optional(), 17 + corge: z.object({}).optional(), 18 + garply: z.coerce.bigint().optional(), 19 + numberInt8: z.literal(100).optional(), 20 + numberInt16: z.literal(1000).optional(), 21 + numberInt32: z.literal(100000).optional(), 22 + numberInt64: z.literal(1000000000000).optional(), 23 + numberUint8: z.literal(200).optional(), 24 + numberUint16: z.literal(50000).optional(), 25 + numberUint32: z.literal(3000000000).optional(), 26 + numberUint64: z.literal(18000000000000000000).optional(), 27 + integerInt8: z.literal(-100).optional(), 28 + integerInt16: z.literal(-1000).optional(), 29 + integerInt32: z.literal(-100000).optional(), 30 + integerInt64: z.literal(-1000000000000).optional(), 31 + integerUint8: z.literal(255).optional(), 32 + integerUint16: z.literal(65535).optional(), 33 + integerUint32: z.literal(4294967295).optional(), 34 + integerUint64: z.number().int().optional(), 35 + stringInt64: z.literal('-9223372036854775808').optional(), 36 + stringUint64: z.literal('18446744073709551615').optional() 37 37 });
+2 -2
packages/openapi-ts-tests/zod/v3/__snapshots__/3.1.x/mini/validators-bigint-min-max/zod.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 - import * as z from 'zod/v4-mini'; 3 + import { z } from 'zod'; 4 4 5 5 export const zFoo = z.object({ 6 - foo: z.optional(z.coerce.bigint().check(z.gte(BigInt(0)), z.lte(BigInt(100)))) 6 + foo: z.coerce.bigint().gte(BigInt(0)).lte(BigInt(100)).optional() 7 7 });
+4 -4
packages/openapi-ts-tests/zod/v3/__snapshots__/3.1.x/mini/validators-circular-ref-2/zod.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 - import * as z from 'zod/v4-mini'; 3 + import { z } from 'zod'; 4 4 5 - export const zBar = z.object({ 5 + export const zBar: z.AnyZodObject = z.object({ 6 6 bar: z.union([ 7 - z.array(z.lazy((): any => { 7 + z.array(z.lazy(() => { 8 8 return zBar; 9 9 })), 10 10 z.null() 11 11 ]) 12 12 }); 13 13 14 - export const zFoo = z.object({ 14 + export const zFoo: z.AnyZodObject = z.object({ 15 15 foo: zBar 16 16 });
+9 -11
packages/openapi-ts-tests/zod/v3/__snapshots__/3.1.x/mini/validators-circular-ref/zod.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 - import * as z from 'zod/v4-mini'; 3 + import { z } from 'zod'; 4 4 5 - export const zBar = z.object({ 6 - get bar(): z.ZodMiniOptional { 7 - return z.optional(z.array(z.lazy((): any => { 8 - return zBar; 9 - }))); 10 - } 5 + export const zBar: z.AnyZodObject = z.object({ 6 + bar: z.array(z.lazy(() => { 7 + return zBar; 8 + })).optional() 11 9 }); 12 10 13 - export const zFoo = z.object({ 14 - foo: z.optional(zBar) 11 + export const zFoo: z.AnyZodObject = z.object({ 12 + foo: zBar.optional() 15 13 }); 16 14 17 15 /** 18 16 * description caused circular reference error 19 17 */ 20 - export const zQux = z.lazy((): any => { 18 + export const zQux: z.ZodTypeAny = z.lazy(() => { 21 19 return zQux; 22 20 }); 23 21 24 - export const zBaz = zQux; 22 + export const zBaz: z.ZodTypeAny = zQux;
+31 -33
packages/openapi-ts-tests/zod/v3/__snapshots__/3.1.x/mini/validators-dates/zod.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 - import * as z from 'zod/v4-mini'; 3 + import { z } from 'zod'; 4 4 5 5 /** 6 6 * This is Bar schema. 7 7 */ 8 - export const zBar = z.object({ 9 - get foo(): z.ZodMiniOptional { 10 - return z.optional(zFoo); 11 - } 8 + export const zBar: z.AnyZodObject = z.object({ 9 + foo: z.lazy(() => { 10 + return zFoo; 11 + }).optional() 12 12 }); 13 13 14 14 /** 15 15 * This is Foo schema. 16 16 */ 17 - export const zFoo = z._default(z.union([ 17 + export const zFoo: z.ZodTypeAny = z.union([ 18 18 z.object({ 19 - foo: z.optional(z.string().check(z.regex(/^\d{3}-\d{2}-\d{4}$/))), 20 - bar: z.optional(zBar), 21 - get baz(): z.ZodMiniOptional { 22 - return z.optional(z.array(z.lazy((): any => { 23 - return zFoo; 24 - }))); 25 - }, 26 - qux: z._default(z.optional(z.int().check(z.gt(0))), 0) 19 + foo: z.string().regex(/^\d{3}-\d{2}-\d{4}$/).optional(), 20 + bar: zBar.optional(), 21 + baz: z.array(z.lazy(() => { 22 + return zFoo; 23 + })).optional(), 24 + qux: z.number().int().gt(0).optional().default(0) 27 25 }), 28 26 z.null() 29 - ]), null); 27 + ]).default(null); 30 28 31 - export const zBaz = z._default(z.readonly(z.string().check(z.regex(/foo\nbar/))), 'baz'); 29 + export const zBaz = z.string().regex(/foo\nbar/).readonly().default('baz'); 32 30 33 - export const zQux = z.record(z.string(), z.object({ 34 - qux: z.optional(z.string()) 31 + export const zQux = z.record(z.object({ 32 + qux: z.string().optional() 35 33 })); 36 34 37 35 /** ··· 40 38 export const zFoo2 = z.string(); 41 39 42 40 export const zFoo3 = z.object({ 43 - foo: z.optional(zBar) 41 + foo: zBar.optional() 44 42 }); 45 43 46 44 export const zPatchFooData = z.object({ 47 45 body: z.object({ 48 - foo: z.optional(z.string()) 46 + foo: z.string().optional() 49 47 }), 50 - path: z.optional(z.never()), 51 - query: z.optional(z.object({ 52 - foo: z.optional(z.string()), 53 - bar: z.optional(zBar), 54 - baz: z.optional(z.object({ 55 - baz: z.optional(z.string()) 56 - })), 57 - qux: z.optional(z.iso.date()), 58 - quux: z.optional(z.iso.datetime({ 48 + path: z.never().optional(), 49 + query: z.object({ 50 + foo: z.string().optional(), 51 + bar: zBar.optional(), 52 + baz: z.object({ 53 + baz: z.string().optional() 54 + }).optional(), 55 + qux: z.string().date().optional(), 56 + quux: z.string().datetime({ 59 57 offset: true 60 - })) 61 - })) 58 + }).optional() 59 + }).optional() 62 60 }); 63 61 64 62 export const zPostFooData = z.object({ 65 63 body: zFoo3, 66 - path: z.optional(z.never()), 67 - query: z.optional(z.never()) 64 + path: z.never().optional(), 65 + query: z.never().optional() 68 66 });
+32 -46
packages/openapi-ts-tests/zod/v3/__snapshots__/3.1.x/mini/validators-metadata/zod.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 - import * as z from 'zod/v4-mini'; 3 + import { z } from 'zod'; 4 4 5 5 /** 6 6 * This is Bar schema. 7 7 */ 8 - export const zBar = z.object({ 9 - get foo(): z.ZodMiniOptional { 10 - return z.optional(zFoo); 11 - } 12 - }).register(z.globalRegistry, { 13 - description: 'This is Bar schema.' 14 - }); 8 + export const zBar: z.AnyZodObject = z.object({ 9 + foo: z.lazy(() => { 10 + return zFoo; 11 + }).optional() 12 + }).describe('This is Bar schema.'); 15 13 16 14 /** 17 15 * This is Foo schema. 18 16 */ 19 - export const zFoo = z._default(z.union([ 17 + export const zFoo: z.ZodTypeAny = z.union([ 20 18 z.object({ 21 - foo: z.optional(z.string().check(z.regex(/^\d{3}-\d{2}-\d{4}$/)).register(z.globalRegistry, { 22 - description: 'This is foo property.' 23 - })), 24 - bar: z.optional(zBar), 25 - get baz(): z.ZodMiniOptional { 26 - return z.optional(z.array(z.lazy((): any => { 27 - return zFoo; 28 - })).register(z.globalRegistry, { 29 - description: 'This is baz property.' 30 - })); 31 - }, 32 - qux: z._default(z.optional(z.int().check(z.gt(0)).register(z.globalRegistry, { 33 - description: 'This is qux property.' 34 - })), 0) 19 + foo: z.string().regex(/^\d{3}-\d{2}-\d{4}$/).describe('This is foo property.').optional(), 20 + bar: zBar.optional(), 21 + baz: z.array(z.lazy(() => { 22 + return zFoo; 23 + })).describe('This is baz property.').optional(), 24 + qux: z.number().int().gt(0).describe('This is qux property.').optional().default(0) 35 25 }), 36 26 z.null() 37 - ]), null); 27 + ]).default(null); 38 28 39 - export const zBaz = z._default(z.readonly(z.string().check(z.regex(/foo\nbar/))), 'baz'); 29 + export const zBaz = z.string().regex(/foo\nbar/).readonly().default('baz'); 40 30 41 - export const zQux = z.record(z.string(), z.object({ 42 - qux: z.optional(z.string()) 31 + export const zQux = z.record(z.object({ 32 + qux: z.string().optional() 43 33 })); 44 34 45 35 /** 46 36 * This is Foo parameter. 47 37 */ 48 - export const zFoo2 = z.string().register(z.globalRegistry, { 49 - description: 'This is Foo parameter.' 50 - }); 38 + export const zFoo2 = z.string().describe('This is Foo parameter.'); 51 39 52 40 export const zFoo3 = z.object({ 53 - foo: z.optional(zBar) 41 + foo: zBar.optional() 54 42 }); 55 43 56 44 export const zPatchFooData = z.object({ 57 45 body: z.object({ 58 - foo: z.optional(z.string()) 46 + foo: z.string().optional() 59 47 }), 60 - path: z.optional(z.never()), 61 - query: z.optional(z.object({ 62 - foo: z.optional(z.string().register(z.globalRegistry, { 63 - description: 'This is Foo parameter.' 64 - })), 65 - bar: z.optional(zBar), 66 - baz: z.optional(z.object({ 67 - baz: z.optional(z.string()) 68 - })), 69 - qux: z.optional(z.iso.date()), 70 - quux: z.optional(z.iso.datetime()) 71 - })) 48 + path: z.never().optional(), 49 + query: z.object({ 50 + foo: z.string().describe('This is Foo parameter.').optional(), 51 + bar: zBar.optional(), 52 + baz: z.object({ 53 + baz: z.string().optional() 54 + }).optional(), 55 + qux: z.string().date().optional(), 56 + quux: z.string().datetime().optional() 57 + }).optional() 72 58 }); 73 59 74 60 export const zPostFooData = z.object({ 75 61 body: zFoo3, 76 - path: z.optional(z.never()), 77 - query: z.optional(z.never()) 62 + path: z.never().optional(), 63 + query: z.never().optional() 78 64 });
+31 -49
packages/openapi-ts-tests/zod/v3/__snapshots__/3.1.x/mini/validators-types/zod.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 - import * as z from 'zod/v4-mini'; 3 + import { z } from 'zod'; 4 4 5 5 /** 6 6 * This is Bar schema. 7 7 */ 8 - export const zBar = z.object({ 9 - get foo(): z.ZodMiniOptional { 10 - return z.optional(zFoo); 11 - } 8 + export const zBar: z.AnyZodObject = z.object({ 9 + foo: z.lazy(() => { 10 + return zFoo; 11 + }).optional() 12 12 }); 13 13 14 - export type BarZodType = z.infer<typeof zBar>; 15 - 16 14 /** 17 15 * This is Foo schema. 18 16 */ 19 - export const zFoo = z._default(z.union([ 17 + export const zFoo: z.ZodTypeAny = z.union([ 20 18 z.object({ 21 - foo: z.optional(z.string().check(z.regex(/^\d{3}-\d{2}-\d{4}$/))), 22 - bar: z.optional(zBar), 23 - get baz(): z.ZodMiniOptional { 24 - return z.optional(z.array(z.lazy((): any => { 25 - return zFoo; 26 - }))); 27 - }, 28 - qux: z._default(z.optional(z.int().check(z.gt(0))), 0) 19 + foo: z.string().regex(/^\d{3}-\d{2}-\d{4}$/).optional(), 20 + bar: zBar.optional(), 21 + baz: z.array(z.lazy(() => { 22 + return zFoo; 23 + })).optional(), 24 + qux: z.number().int().gt(0).optional().default(0) 29 25 }), 30 26 z.null() 31 - ]), null); 32 - 33 - export type FooZodType = z.infer<typeof zFoo>; 27 + ]).default(null); 34 28 35 - export const zBaz = z._default(z.readonly(z.string().check(z.regex(/foo\nbar/))), 'baz'); 36 - 37 - export type BazZodType = z.infer<typeof zBaz>; 29 + export const zBaz = z.string().regex(/foo\nbar/).readonly().default('baz'); 38 30 39 - export const zQux = z.record(z.string(), z.object({ 40 - qux: z.optional(z.string()) 31 + export const zQux = z.record(z.object({ 32 + qux: z.string().optional() 41 33 })); 42 34 43 - export type QuxZodType = z.infer<typeof zQux>; 44 - 45 35 /** 46 36 * This is Foo parameter. 47 37 */ 48 38 export const zFoo2 = z.string(); 49 39 50 - export type FooZodType2 = z.infer<typeof zFoo2>; 51 - 52 40 export const zFoo3 = z.object({ 53 - foo: z.optional(zBar) 41 + foo: zBar.optional() 54 42 }); 55 - 56 - export type FooZodType3 = z.infer<typeof zFoo3>; 57 43 58 44 export const zPatchFooData = z.object({ 59 45 body: z.object({ 60 - foo: z.optional(z.string()) 46 + foo: z.string().optional() 61 47 }), 62 - path: z.optional(z.never()), 63 - query: z.optional(z.object({ 64 - foo: z.optional(z.string()), 65 - bar: z.optional(zBar), 66 - baz: z.optional(z.object({ 67 - baz: z.optional(z.string()) 68 - })), 69 - qux: z.optional(z.iso.date()), 70 - quux: z.optional(z.iso.datetime()) 71 - })) 48 + path: z.never().optional(), 49 + query: z.object({ 50 + foo: z.string().optional(), 51 + bar: zBar.optional(), 52 + baz: z.object({ 53 + baz: z.string().optional() 54 + }).optional(), 55 + qux: z.string().date().optional(), 56 + quux: z.string().datetime().optional() 57 + }).optional() 72 58 }); 73 59 74 - export type PatchFooDataZodType = z.infer<typeof zPatchFooData>; 75 - 76 60 export const zPostFooData = z.object({ 77 61 body: zFoo3, 78 - path: z.optional(z.never()), 79 - query: z.optional(z.never()) 80 - }); 81 - 82 - export type PostFooDataZodType = z.infer<typeof zPostFooData>; 62 + path: z.never().optional(), 63 + query: z.never().optional() 64 + });
+5 -5
packages/openapi-ts-tests/zod/v3/__snapshots__/3.1.x/mini/validators-union-merge/zod.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 - import * as z from 'zod/v4-mini'; 3 + import { z } from 'zod'; 4 4 5 5 export const zContact = z.union([ 6 6 z.object({ ··· 11 11 }) 12 12 ]); 13 13 14 - export const zUser = z.intersection(zContact, z.object({ 14 + export const zUser = zContact.and(z.object({ 15 15 username: z.string() 16 16 })); 17 17 18 18 export const zDogDetails = z.object({ 19 19 breed: z.string(), 20 - barkVolume: z.int().check(z.gte(1), z.lte(10)) 20 + barkVolume: z.number().int().gte(1).lte(10) 21 21 }); 22 22 23 23 export const zCatDetails = z.object({ ··· 32 32 export const zPetStore = z.object({ 33 33 animals: z.array(z.object({ 34 34 name: z.string(), 35 - type: z.optional(z.enum([ 35 + type: z.enum([ 36 36 'dog', 37 37 'cat' 38 - ])), 38 + ]).optional(), 39 39 details: z.union([ 40 40 zDogDetails, 41 41 zCatDetails
+30 -32
packages/openapi-ts-tests/zod/v3/__snapshots__/3.1.x/mini/validators/zod.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 - import * as z from 'zod/v4-mini'; 3 + import { z } from 'zod'; 4 4 5 5 /** 6 6 * This is Bar schema. 7 7 */ 8 - export const zBar = z.object({ 9 - get foo(): z.ZodMiniOptional { 10 - return z.optional(zFoo); 11 - } 8 + export const zBar: z.AnyZodObject = z.object({ 9 + foo: z.lazy(() => { 10 + return zFoo; 11 + }).optional() 12 12 }); 13 13 14 14 /** 15 15 * This is Foo schema. 16 16 */ 17 - export const zFoo = z._default(z.union([ 17 + export const zFoo: z.ZodTypeAny = z.union([ 18 18 z.object({ 19 - foo: z.optional(z.string().check(z.regex(/^\d{3}-\d{2}-\d{4}$/))), 20 - bar: z.optional(zBar), 21 - get baz(): z.ZodMiniOptional { 22 - return z.optional(z.array(z.lazy((): any => { 23 - return zFoo; 24 - }))); 25 - }, 26 - qux: z._default(z.optional(z.int().check(z.gt(0))), 0) 19 + foo: z.string().regex(/^\d{3}-\d{2}-\d{4}$/).optional(), 20 + bar: zBar.optional(), 21 + baz: z.array(z.lazy(() => { 22 + return zFoo; 23 + })).optional(), 24 + qux: z.number().int().gt(0).optional().default(0) 27 25 }), 28 26 z.null() 29 - ]), null); 27 + ]).default(null); 30 28 31 - export const zBaz = z._default(z.readonly(z.string().check(z.regex(/foo\nbar/))), 'baz'); 29 + export const zBaz = z.string().regex(/foo\nbar/).readonly().default('baz'); 32 30 33 - export const zQux = z.record(z.string(), z.object({ 34 - qux: z.optional(z.string()) 31 + export const zQux = z.record(z.object({ 32 + qux: z.string().optional() 35 33 })); 36 34 37 35 /** ··· 40 38 export const zFoo2 = z.string(); 41 39 42 40 export const zFoo3 = z.object({ 43 - foo: z.optional(zBar) 41 + foo: zBar.optional() 44 42 }); 45 43 46 44 export const zPatchFooData = z.object({ 47 45 body: z.object({ 48 - foo: z.optional(z.string()) 46 + foo: z.string().optional() 49 47 }), 50 - path: z.optional(z.never()), 51 - query: z.optional(z.object({ 52 - foo: z.optional(z.string()), 53 - bar: z.optional(zBar), 54 - baz: z.optional(z.object({ 55 - baz: z.optional(z.string()) 56 - })), 57 - qux: z.optional(z.iso.date()), 58 - quux: z.optional(z.iso.datetime()) 59 - })) 48 + path: z.never().optional(), 49 + query: z.object({ 50 + foo: z.string().optional(), 51 + bar: zBar.optional(), 52 + baz: z.object({ 53 + baz: z.string().optional() 54 + }).optional(), 55 + qux: z.string().date().optional(), 56 + quux: z.string().datetime().optional() 57 + }).optional() 60 58 }); 61 59 62 60 export const zPostFooData = z.object({ 63 61 body: zFoo3, 64 - path: z.optional(z.never()), 65 - query: z.optional(z.never()) 62 + path: z.never().optional(), 63 + query: z.never().optional() 66 64 });
+1 -17
packages/openapi-ts-tests/zod/v3/__snapshots__/3.1.x/v3/validators-types/zod.gen.ts
··· 11 11 }).optional() 12 12 }); 13 13 14 - export type BarZodType = z.infer<typeof zBar>; 15 - 16 14 /** 17 15 * This is Foo schema. 18 16 */ ··· 28 26 z.null() 29 27 ]).default(null); 30 28 31 - export type FooZodType = z.infer<typeof zFoo>; 32 - 33 29 export const zBaz = z.string().regex(/foo\nbar/).readonly().default('baz'); 34 30 35 - export type BazZodType = z.infer<typeof zBaz>; 36 - 37 31 export const zQux = z.record(z.object({ 38 32 qux: z.string().optional() 39 33 })); 40 34 41 - export type QuxZodType = z.infer<typeof zQux>; 42 - 43 35 /** 44 36 * This is Foo parameter. 45 37 */ 46 38 export const zFoo2 = z.string(); 47 39 48 - export type FooZodType2 = z.infer<typeof zFoo2>; 49 - 50 40 export const zFoo3 = z.object({ 51 41 foo: zBar.optional() 52 42 }); 53 - 54 - export type FooZodType3 = z.infer<typeof zFoo3>; 55 43 56 44 export const zPatchFooData = z.object({ 57 45 body: z.object({ ··· 69 57 }).optional() 70 58 }); 71 59 72 - export type PatchFooDataZodType = z.infer<typeof zPatchFooData>; 73 - 74 60 export const zPostFooData = z.object({ 75 61 body: zFoo3, 76 62 path: z.never().optional(), 77 63 query: z.never().optional() 78 - }); 79 - 80 - export type PostFooDataZodType = z.infer<typeof zPostFooData>; 64 + });
+2 -2
packages/openapi-ts-tests/zod/v3/__snapshots__/3.1.x/v4/array-items-one-of-length-1/zod.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 - import { z } from 'zod/v4'; 3 + import { z } from 'zod'; 4 4 5 5 export const zBar = z.string(); 6 6 7 7 export const zFoo = z.object({ 8 - foo: z.optional(z.array(zBar).min(1).max(2147483647)) 8 + foo: z.array(zBar).min(1).max(2147483647).optional() 9 9 });
+3 -3
packages/openapi-ts-tests/zod/v3/__snapshots__/3.1.x/v4/enum-null/zod.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 - import { z } from 'zod/v4'; 3 + import { z } from 'zod'; 4 4 5 - export const zFoo = z.nullable(z.enum([ 5 + export const zFoo = z.enum([ 6 6 'foo', 7 7 'bar' 8 - ])); 8 + ]).nullable(); 9 9 10 10 export const zBar = z.enum([ 11 11 'foo',
+27 -27
packages/openapi-ts-tests/zod/v3/__snapshots__/3.1.x/v4/schema-const/zod.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 - import { z } from 'zod/v4'; 3 + import { z } from 'zod'; 4 4 5 5 export const zFoo = z.object({ 6 - foo: z.optional(z.literal('foo')), 7 - bar: z.optional(z.literal(3.2)), 8 - baz: z.optional(z.literal(-1)), 9 - qux: z.optional(z.literal(true)), 10 - quux: z.optional(z.tuple([ 6 + foo: z.literal('foo').optional(), 7 + bar: z.literal(3.2).optional(), 8 + baz: z.literal(-1).optional(), 9 + qux: z.literal(true).optional(), 10 + quux: z.tuple([ 11 11 z.literal(1), 12 12 z.literal(2), 13 13 z.literal(3), 14 14 z.literal('foo'), 15 15 z.literal(true) 16 - ])), 17 - corge: z.optional(z.object({})), 18 - garply: z.optional(z.coerce.bigint()), 19 - numberInt8: z.optional(z.literal(100)), 20 - numberInt16: z.optional(z.literal(1000)), 21 - numberInt32: z.optional(z.literal(100000)), 22 - numberInt64: z.optional(z.literal(1000000000000)), 23 - numberUint8: z.optional(z.literal(200)), 24 - numberUint16: z.optional(z.literal(50000)), 25 - numberUint32: z.optional(z.literal(3000000000)), 26 - numberUint64: z.optional(z.literal(18000000000000000000)), 27 - integerInt8: z.optional(z.literal(-100)), 28 - integerInt16: z.optional(z.literal(-1000)), 29 - integerInt32: z.optional(z.literal(-100000)), 30 - integerInt64: z.optional(z.literal(-1000000000000)), 31 - integerUint8: z.optional(z.literal(255)), 32 - integerUint16: z.optional(z.literal(65535)), 33 - integerUint32: z.optional(z.literal(4294967295)), 34 - integerUint64: z.optional(z.int()), 35 - stringInt64: z.optional(z.literal('-9223372036854775808')), 36 - stringUint64: z.optional(z.literal('18446744073709551615')) 16 + ]).optional(), 17 + corge: z.object({}).optional(), 18 + garply: z.coerce.bigint().optional(), 19 + numberInt8: z.literal(100).optional(), 20 + numberInt16: z.literal(1000).optional(), 21 + numberInt32: z.literal(100000).optional(), 22 + numberInt64: z.literal(1000000000000).optional(), 23 + numberUint8: z.literal(200).optional(), 24 + numberUint16: z.literal(50000).optional(), 25 + numberUint32: z.literal(3000000000).optional(), 26 + numberUint64: z.literal(18000000000000000000).optional(), 27 + integerInt8: z.literal(-100).optional(), 28 + integerInt16: z.literal(-1000).optional(), 29 + integerInt32: z.literal(-100000).optional(), 30 + integerInt64: z.literal(-1000000000000).optional(), 31 + integerUint8: z.literal(255).optional(), 32 + integerUint16: z.literal(65535).optional(), 33 + integerUint32: z.literal(4294967295).optional(), 34 + integerUint64: z.number().int().optional(), 35 + stringInt64: z.literal('-9223372036854775808').optional(), 36 + stringUint64: z.literal('18446744073709551615').optional() 37 37 });
+2 -2
packages/openapi-ts-tests/zod/v3/__snapshots__/3.1.x/v4/validators-bigint-min-max/zod.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 - import { z } from 'zod/v4'; 3 + import { z } from 'zod'; 4 4 5 5 export const zFoo = z.object({ 6 - foo: z.optional(z.coerce.bigint().gte(BigInt(0)).lte(BigInt(100))) 6 + foo: z.coerce.bigint().gte(BigInt(0)).lte(BigInt(100)).optional() 7 7 });
+4 -4
packages/openapi-ts-tests/zod/v3/__snapshots__/3.1.x/v4/validators-circular-ref-2/zod.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 - import { z } from 'zod/v4'; 3 + import { z } from 'zod'; 4 4 5 - export const zBar = z.object({ 5 + export const zBar: z.AnyZodObject = z.object({ 6 6 bar: z.union([ 7 - z.array(z.lazy((): any => { 7 + z.array(z.lazy(() => { 8 8 return zBar; 9 9 })), 10 10 z.null() 11 11 ]) 12 12 }); 13 13 14 - export const zFoo = z.object({ 14 + export const zFoo: z.AnyZodObject = z.object({ 15 15 foo: zBar 16 16 });
+9 -11
packages/openapi-ts-tests/zod/v3/__snapshots__/3.1.x/v4/validators-circular-ref/zod.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 - import { z } from 'zod/v4'; 3 + import { z } from 'zod'; 4 4 5 - export const zBar = z.object({ 6 - get bar(): z.ZodOptional { 7 - return z.optional(z.array(z.lazy((): any => { 8 - return zBar; 9 - }))); 10 - } 5 + export const zBar: z.AnyZodObject = z.object({ 6 + bar: z.array(z.lazy(() => { 7 + return zBar; 8 + })).optional() 11 9 }); 12 10 13 - export const zFoo = z.object({ 14 - foo: z.optional(zBar) 11 + export const zFoo: z.AnyZodObject = z.object({ 12 + foo: zBar.optional() 15 13 }); 16 14 17 15 /** 18 16 * description caused circular reference error 19 17 */ 20 - export const zQux = z.lazy((): any => { 18 + export const zQux: z.ZodTypeAny = z.lazy(() => { 21 19 return zQux; 22 20 }); 23 21 24 - export const zBaz = zQux; 22 + export const zBaz: z.ZodTypeAny = zQux;
+29 -31
packages/openapi-ts-tests/zod/v3/__snapshots__/3.1.x/v4/validators-dates/zod.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 - import { z } from 'zod/v4'; 3 + import { z } from 'zod'; 4 4 5 5 /** 6 6 * This is Bar schema. 7 7 */ 8 - export const zBar = z.object({ 9 - get foo(): z.ZodOptional { 10 - return z.optional(zFoo); 11 - } 8 + export const zBar: z.AnyZodObject = z.object({ 9 + foo: z.lazy(() => { 10 + return zFoo; 11 + }).optional() 12 12 }); 13 13 14 14 /** 15 15 * This is Foo schema. 16 16 */ 17 - export const zFoo = z.union([ 17 + export const zFoo: z.ZodTypeAny = z.union([ 18 18 z.object({ 19 - foo: z.optional(z.string().regex(/^\d{3}-\d{2}-\d{4}$/)), 20 - bar: z.optional(zBar), 21 - get baz(): z.ZodOptional { 22 - return z.optional(z.array(z.lazy((): any => { 23 - return zFoo; 24 - }))); 25 - }, 26 - qux: z.optional(z.int().gt(0)).default(0) 19 + foo: z.string().regex(/^\d{3}-\d{2}-\d{4}$/).optional(), 20 + bar: zBar.optional(), 21 + baz: z.array(z.lazy(() => { 22 + return zFoo; 23 + })).optional(), 24 + qux: z.number().int().gt(0).optional().default(0) 27 25 }), 28 26 z.null() 29 27 ]).default(null); 30 28 31 29 export const zBaz = z.string().regex(/foo\nbar/).readonly().default('baz'); 32 30 33 - export const zQux = z.record(z.string(), z.object({ 34 - qux: z.optional(z.string()) 31 + export const zQux = z.record(z.object({ 32 + qux: z.string().optional() 35 33 })); 36 34 37 35 /** ··· 40 38 export const zFoo2 = z.string(); 41 39 42 40 export const zFoo3 = z.object({ 43 - foo: z.optional(zBar) 41 + foo: zBar.optional() 44 42 }); 45 43 46 44 export const zPatchFooData = z.object({ 47 45 body: z.object({ 48 - foo: z.optional(z.string()) 46 + foo: z.string().optional() 49 47 }), 50 - path: z.optional(z.never()), 51 - query: z.optional(z.object({ 52 - foo: z.optional(z.string()), 53 - bar: z.optional(zBar), 54 - baz: z.optional(z.object({ 55 - baz: z.optional(z.string()) 56 - })), 57 - qux: z.optional(z.iso.date()), 58 - quux: z.optional(z.iso.datetime({ 48 + path: z.never().optional(), 49 + query: z.object({ 50 + foo: z.string().optional(), 51 + bar: zBar.optional(), 52 + baz: z.object({ 53 + baz: z.string().optional() 54 + }).optional(), 55 + qux: z.string().date().optional(), 56 + quux: z.string().datetime({ 59 57 offset: true 60 - })) 61 - })) 58 + }).optional() 59 + }).optional() 62 60 }); 63 61 64 62 export const zPostFooData = z.object({ 65 63 body: zFoo3, 66 - path: z.optional(z.never()), 67 - query: z.optional(z.never()) 64 + path: z.never().optional(), 65 + query: z.never().optional() 68 66 });
+30 -44
packages/openapi-ts-tests/zod/v3/__snapshots__/3.1.x/v4/validators-metadata/zod.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 - import { z } from 'zod/v4'; 3 + import { z } from 'zod'; 4 4 5 5 /** 6 6 * This is Bar schema. 7 7 */ 8 - export const zBar = z.object({ 9 - get foo(): z.ZodOptional { 10 - return z.optional(zFoo); 11 - } 12 - }).register(z.globalRegistry, { 13 - description: 'This is Bar schema.' 14 - }); 8 + export const zBar: z.AnyZodObject = z.object({ 9 + foo: z.lazy(() => { 10 + return zFoo; 11 + }).optional() 12 + }).describe('This is Bar schema.'); 15 13 16 14 /** 17 15 * This is Foo schema. 18 16 */ 19 - export const zFoo = z.union([ 17 + export const zFoo: z.ZodTypeAny = z.union([ 20 18 z.object({ 21 - foo: z.optional(z.string().regex(/^\d{3}-\d{2}-\d{4}$/).register(z.globalRegistry, { 22 - description: 'This is foo property.' 23 - })), 24 - bar: z.optional(zBar), 25 - get baz(): z.ZodOptional { 26 - return z.optional(z.array(z.lazy((): any => { 27 - return zFoo; 28 - })).register(z.globalRegistry, { 29 - description: 'This is baz property.' 30 - })); 31 - }, 32 - qux: z.optional(z.int().gt(0).register(z.globalRegistry, { 33 - description: 'This is qux property.' 34 - })).default(0) 19 + foo: z.string().regex(/^\d{3}-\d{2}-\d{4}$/).describe('This is foo property.').optional(), 20 + bar: zBar.optional(), 21 + baz: z.array(z.lazy(() => { 22 + return zFoo; 23 + })).describe('This is baz property.').optional(), 24 + qux: z.number().int().gt(0).describe('This is qux property.').optional().default(0) 35 25 }), 36 26 z.null() 37 27 ]).default(null); 38 28 39 29 export const zBaz = z.string().regex(/foo\nbar/).readonly().default('baz'); 40 30 41 - export const zQux = z.record(z.string(), z.object({ 42 - qux: z.optional(z.string()) 31 + export const zQux = z.record(z.object({ 32 + qux: z.string().optional() 43 33 })); 44 34 45 35 /** 46 36 * This is Foo parameter. 47 37 */ 48 - export const zFoo2 = z.string().register(z.globalRegistry, { 49 - description: 'This is Foo parameter.' 50 - }); 38 + export const zFoo2 = z.string().describe('This is Foo parameter.'); 51 39 52 40 export const zFoo3 = z.object({ 53 - foo: z.optional(zBar) 41 + foo: zBar.optional() 54 42 }); 55 43 56 44 export const zPatchFooData = z.object({ 57 45 body: z.object({ 58 - foo: z.optional(z.string()) 46 + foo: z.string().optional() 59 47 }), 60 - path: z.optional(z.never()), 61 - query: z.optional(z.object({ 62 - foo: z.optional(z.string().register(z.globalRegistry, { 63 - description: 'This is Foo parameter.' 64 - })), 65 - bar: z.optional(zBar), 66 - baz: z.optional(z.object({ 67 - baz: z.optional(z.string()) 68 - })), 69 - qux: z.optional(z.iso.date()), 70 - quux: z.optional(z.iso.datetime()) 71 - })) 48 + path: z.never().optional(), 49 + query: z.object({ 50 + foo: z.string().describe('This is Foo parameter.').optional(), 51 + bar: zBar.optional(), 52 + baz: z.object({ 53 + baz: z.string().optional() 54 + }).optional(), 55 + qux: z.string().date().optional(), 56 + quux: z.string().datetime().optional() 57 + }).optional() 72 58 }); 73 59 74 60 export const zPostFooData = z.object({ 75 61 body: zFoo3, 76 - path: z.optional(z.never()), 77 - query: z.optional(z.never()) 62 + path: z.never().optional(), 63 + query: z.never().optional() 78 64 });
+29 -47
packages/openapi-ts-tests/zod/v3/__snapshots__/3.1.x/v4/validators-types/zod.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 - import { z } from 'zod/v4'; 3 + import { z } from 'zod'; 4 4 5 5 /** 6 6 * This is Bar schema. 7 7 */ 8 - export const zBar = z.object({ 9 - get foo(): z.ZodOptional { 10 - return z.optional(zFoo); 11 - } 8 + export const zBar: z.AnyZodObject = z.object({ 9 + foo: z.lazy(() => { 10 + return zFoo; 11 + }).optional() 12 12 }); 13 13 14 - export type BarZodType = z.infer<typeof zBar>; 15 - 16 14 /** 17 15 * This is Foo schema. 18 16 */ 19 - export const zFoo = z.union([ 17 + export const zFoo: z.ZodTypeAny = z.union([ 20 18 z.object({ 21 - foo: z.optional(z.string().regex(/^\d{3}-\d{2}-\d{4}$/)), 22 - bar: z.optional(zBar), 23 - get baz(): z.ZodOptional { 24 - return z.optional(z.array(z.lazy((): any => { 25 - return zFoo; 26 - }))); 27 - }, 28 - qux: z.optional(z.int().gt(0)).default(0) 19 + foo: z.string().regex(/^\d{3}-\d{2}-\d{4}$/).optional(), 20 + bar: zBar.optional(), 21 + baz: z.array(z.lazy(() => { 22 + return zFoo; 23 + })).optional(), 24 + qux: z.number().int().gt(0).optional().default(0) 29 25 }), 30 26 z.null() 31 27 ]).default(null); 32 28 33 - export type FooZodType = z.infer<typeof zFoo>; 34 - 35 29 export const zBaz = z.string().regex(/foo\nbar/).readonly().default('baz'); 36 30 37 - export type BazZodType = z.infer<typeof zBaz>; 38 - 39 - export const zQux = z.record(z.string(), z.object({ 40 - qux: z.optional(z.string()) 31 + export const zQux = z.record(z.object({ 32 + qux: z.string().optional() 41 33 })); 42 - 43 - export type QuxZodType = z.infer<typeof zQux>; 44 34 45 35 /** 46 36 * This is Foo parameter. 47 37 */ 48 38 export const zFoo2 = z.string(); 49 39 50 - export type FooZodType2 = z.infer<typeof zFoo2>; 51 - 52 40 export const zFoo3 = z.object({ 53 - foo: z.optional(zBar) 41 + foo: zBar.optional() 54 42 }); 55 43 56 - export type FooZodType3 = z.infer<typeof zFoo3>; 57 - 58 44 export const zPatchFooData = z.object({ 59 45 body: z.object({ 60 - foo: z.optional(z.string()) 46 + foo: z.string().optional() 61 47 }), 62 - path: z.optional(z.never()), 63 - query: z.optional(z.object({ 64 - foo: z.optional(z.string()), 65 - bar: z.optional(zBar), 66 - baz: z.optional(z.object({ 67 - baz: z.optional(z.string()) 68 - })), 69 - qux: z.optional(z.iso.date()), 70 - quux: z.optional(z.iso.datetime()) 71 - })) 48 + path: z.never().optional(), 49 + query: z.object({ 50 + foo: z.string().optional(), 51 + bar: zBar.optional(), 52 + baz: z.object({ 53 + baz: z.string().optional() 54 + }).optional(), 55 + qux: z.string().date().optional(), 56 + quux: z.string().datetime().optional() 57 + }).optional() 72 58 }); 73 59 74 - export type PatchFooDataZodType = z.infer<typeof zPatchFooData>; 75 - 76 60 export const zPostFooData = z.object({ 77 61 body: zFoo3, 78 - path: z.optional(z.never()), 79 - query: z.optional(z.never()) 80 - }); 81 - 82 - export type PostFooDataZodType = z.infer<typeof zPostFooData>; 62 + path: z.never().optional(), 63 + query: z.never().optional() 64 + });
+4 -4
packages/openapi-ts-tests/zod/v3/__snapshots__/3.1.x/v4/validators-union-merge/zod.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 - import { z } from 'zod/v4'; 3 + import { z } from 'zod'; 4 4 5 5 export const zContact = z.union([ 6 6 z.object({ ··· 17 17 18 18 export const zDogDetails = z.object({ 19 19 breed: z.string(), 20 - barkVolume: z.int().gte(1).lte(10) 20 + barkVolume: z.number().int().gte(1).lte(10) 21 21 }); 22 22 23 23 export const zCatDetails = z.object({ ··· 32 32 export const zPetStore = z.object({ 33 33 animals: z.array(z.object({ 34 34 name: z.string(), 35 - type: z.optional(z.enum([ 35 + type: z.enum([ 36 36 'dog', 37 37 'cat' 38 - ])), 38 + ]).optional(), 39 39 details: z.union([ 40 40 zDogDetails, 41 41 zCatDetails
+28 -30
packages/openapi-ts-tests/zod/v3/__snapshots__/3.1.x/v4/validators/zod.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 - import { z } from 'zod/v4'; 3 + import { z } from 'zod'; 4 4 5 5 /** 6 6 * This is Bar schema. 7 7 */ 8 - export const zBar = z.object({ 9 - get foo(): z.ZodOptional { 10 - return z.optional(zFoo); 11 - } 8 + export const zBar: z.AnyZodObject = z.object({ 9 + foo: z.lazy(() => { 10 + return zFoo; 11 + }).optional() 12 12 }); 13 13 14 14 /** 15 15 * This is Foo schema. 16 16 */ 17 - export const zFoo = z.union([ 17 + export const zFoo: z.ZodTypeAny = z.union([ 18 18 z.object({ 19 - foo: z.optional(z.string().regex(/^\d{3}-\d{2}-\d{4}$/)), 20 - bar: z.optional(zBar), 21 - get baz(): z.ZodOptional { 22 - return z.optional(z.array(z.lazy((): any => { 23 - return zFoo; 24 - }))); 25 - }, 26 - qux: z.optional(z.int().gt(0)).default(0) 19 + foo: z.string().regex(/^\d{3}-\d{2}-\d{4}$/).optional(), 20 + bar: zBar.optional(), 21 + baz: z.array(z.lazy(() => { 22 + return zFoo; 23 + })).optional(), 24 + qux: z.number().int().gt(0).optional().default(0) 27 25 }), 28 26 z.null() 29 27 ]).default(null); 30 28 31 29 export const zBaz = z.string().regex(/foo\nbar/).readonly().default('baz'); 32 30 33 - export const zQux = z.record(z.string(), z.object({ 34 - qux: z.optional(z.string()) 31 + export const zQux = z.record(z.object({ 32 + qux: z.string().optional() 35 33 })); 36 34 37 35 /** ··· 40 38 export const zFoo2 = z.string(); 41 39 42 40 export const zFoo3 = z.object({ 43 - foo: z.optional(zBar) 41 + foo: zBar.optional() 44 42 }); 45 43 46 44 export const zPatchFooData = z.object({ 47 45 body: z.object({ 48 - foo: z.optional(z.string()) 46 + foo: z.string().optional() 49 47 }), 50 - path: z.optional(z.never()), 51 - query: z.optional(z.object({ 52 - foo: z.optional(z.string()), 53 - bar: z.optional(zBar), 54 - baz: z.optional(z.object({ 55 - baz: z.optional(z.string()) 56 - })), 57 - qux: z.optional(z.iso.date()), 58 - quux: z.optional(z.iso.datetime()) 59 - })) 48 + path: z.never().optional(), 49 + query: z.object({ 50 + foo: z.string().optional(), 51 + bar: zBar.optional(), 52 + baz: z.object({ 53 + baz: z.string().optional() 54 + }).optional(), 55 + qux: z.string().date().optional(), 56 + quux: z.string().datetime().optional() 57 + }).optional() 60 58 }); 61 59 62 60 export const zPostFooData = z.object({ 63 61 body: zFoo3, 64 - path: z.optional(z.never()), 65 - query: z.optional(z.never()) 62 + path: z.never().optional(), 63 + query: z.never().optional() 66 64 });
+2 -2
packages/openapi-ts-tests/zod/v4/__snapshots__/3.0.x/mini/array-items-one-of-length-1/zod.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 - import * as z from 'zod/mini'; 3 + import { z } from 'zod'; 4 4 5 5 export const zBar = z.string(); 6 6 7 7 export const zFoo = z.object({ 8 - foo: z.optional(z.array(zBar).check(z.minLength(1), z.maxLength(2147483647))) 8 + foo: z.array(zBar).min(1).max(2147483647).optional() 9 9 });
+3 -3
packages/openapi-ts-tests/zod/v4/__snapshots__/3.0.x/mini/enum-null/zod.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 - import * as z from 'zod/mini'; 3 + import { z } from 'zod'; 4 4 5 - export const zFoo = z.nullable(z.enum([ 5 + export const zFoo = z.enum([ 6 6 'foo', 7 7 'bar' 8 - ])); 8 + ]).nullable(); 9 9 10 10 export const zBar = z.enum([ 11 11 'foo',
+14 -16
packages/openapi-ts-tests/zod/v4/__snapshots__/3.0.x/mini/validators/zod.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 - import * as z from 'zod/mini'; 3 + import { z } from 'zod'; 4 4 5 - export const zBar = z.object({ 6 - get foo(): z.ZodMiniOptional { 7 - return z.optional(zFoo); 8 - } 5 + export const zBar: z.AnyZodObject = z.object({ 6 + foo: z.lazy(() => { 7 + return zFoo; 8 + }).optional() 9 9 }); 10 10 11 - export const zFoo = z._default(z.union([ 11 + export const zFoo: z.ZodTypeAny = z.union([ 12 12 z.object({ 13 - foo: z.optional(z.string().check(z.regex(/^\d{3}-\d{2}-\d{4}$/))), 14 - bar: z.optional(zBar), 15 - get baz(): z.ZodMiniOptional { 16 - return z.optional(z.array(z.lazy((): any => { 17 - return zFoo; 18 - }))); 19 - }, 20 - qux: z._default(z.optional(z.int().check(z.gt(0))), 0) 13 + foo: z.string().regex(/^\d{3}-\d{2}-\d{4}$/).optional(), 14 + bar: zBar.optional(), 15 + baz: z.array(z.lazy(() => { 16 + return zFoo; 17 + })).optional(), 18 + qux: z.number().int().gt(0).optional().default(0) 21 19 }), 22 20 z.null() 23 - ]), null); 21 + ]).default(null); 24 22 25 - export const zBaz = z._default(z.readonly(z.string().check(z.regex(/foo\nbar/))), 'baz'); 23 + export const zBaz = z.string().regex(/foo\nbar/).readonly().default('baz');
+1 -1
packages/openapi-ts-tests/zod/v4/__snapshots__/3.0.x/v3/array-items-one-of-length-1/zod.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 - import { z } from 'zod/v3'; 3 + import { z } from 'zod'; 4 4 5 5 export const zBar = z.string(); 6 6
+1 -1
packages/openapi-ts-tests/zod/v4/__snapshots__/3.0.x/v3/enum-null/zod.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 - import { z } from 'zod/v3'; 3 + import { z } from 'zod'; 4 4 5 5 export const zFoo = z.enum([ 6 6 'foo',
+1 -1
packages/openapi-ts-tests/zod/v4/__snapshots__/3.0.x/v3/validators/zod.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 - import { z } from 'zod/v3'; 3 + import { z } from 'zod'; 4 4 5 5 export const zBar: z.AnyZodObject = z.object({ 6 6 foo: z.lazy(() => {
+1 -1
packages/openapi-ts-tests/zod/v4/__snapshots__/3.0.x/v4/array-items-one-of-length-1/zod.gen.ts
··· 5 5 export const zBar = z.string(); 6 6 7 7 export const zFoo = z.object({ 8 - foo: z.optional(z.array(zBar).min(1).max(2147483647)) 8 + foo: z.array(zBar).min(1).max(2147483647).optional() 9 9 });
+2 -2
packages/openapi-ts-tests/zod/v4/__snapshots__/3.0.x/v4/enum-null/zod.gen.ts
··· 2 2 3 3 import { z } from 'zod'; 4 4 5 - export const zFoo = z.nullable(z.enum([ 5 + export const zFoo = z.enum([ 6 6 'foo', 7 7 'bar' 8 - ])); 8 + ]).nullable(); 9 9 10 10 export const zBar = z.enum([ 11 11 'foo',
+11 -13
packages/openapi-ts-tests/zod/v4/__snapshots__/3.0.x/v4/validators/zod.gen.ts
··· 2 2 3 3 import { z } from 'zod'; 4 4 5 - export const zBar = z.object({ 6 - get foo(): z.ZodOptional { 7 - return z.optional(zFoo); 8 - } 5 + export const zBar: z.AnyZodObject = z.object({ 6 + foo: z.lazy(() => { 7 + return zFoo; 8 + }).optional() 9 9 }); 10 10 11 - export const zFoo = z.union([ 11 + export const zFoo: z.ZodTypeAny = z.union([ 12 12 z.object({ 13 - foo: z.optional(z.string().regex(/^\d{3}-\d{2}-\d{4}$/)), 14 - bar: z.optional(zBar), 15 - get baz(): z.ZodOptional { 16 - return z.optional(z.array(z.lazy((): any => { 17 - return zFoo; 18 - }))); 19 - }, 20 - qux: z.optional(z.int().gt(0)).default(0) 13 + foo: z.string().regex(/^\d{3}-\d{2}-\d{4}$/).optional(), 14 + bar: zBar.optional(), 15 + baz: z.array(z.lazy(() => { 16 + return zFoo; 17 + })).optional(), 18 + qux: z.number().int().gt(0).optional().default(0) 21 19 }), 22 20 z.null() 23 21 ]).default(null);
+2 -2
packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/mini/array-items-one-of-length-1/zod.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 - import * as z from 'zod/mini'; 3 + import { z } from 'zod'; 4 4 5 5 export const zBar = z.string(); 6 6 7 7 export const zFoo = z.object({ 8 - foo: z.optional(z.array(zBar).check(z.minLength(1), z.maxLength(2147483647))) 8 + foo: z.array(zBar).min(1).max(2147483647).optional() 9 9 });
+3 -3
packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/mini/enum-null/zod.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 - import * as z from 'zod/mini'; 3 + import { z } from 'zod'; 4 4 5 - export const zFoo = z.nullable(z.enum([ 5 + export const zFoo = z.enum([ 6 6 'foo', 7 7 'bar' 8 - ])); 8 + ]).nullable(); 9 9 10 10 export const zBar = z.enum([ 11 11 'foo',
+27 -27
packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/mini/schema-const/zod.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 - import * as z from 'zod/mini'; 3 + import { z } from 'zod'; 4 4 5 5 export const zFoo = z.object({ 6 - foo: z.optional(z.literal('foo')), 7 - bar: z.optional(z.literal(3.2)), 8 - baz: z.optional(z.literal(-1)), 9 - qux: z.optional(z.literal(true)), 10 - quux: z.optional(z.tuple([ 6 + foo: z.literal('foo').optional(), 7 + bar: z.literal(3.2).optional(), 8 + baz: z.literal(-1).optional(), 9 + qux: z.literal(true).optional(), 10 + quux: z.tuple([ 11 11 z.literal(1), 12 12 z.literal(2), 13 13 z.literal(3), 14 14 z.literal('foo'), 15 15 z.literal(true) 16 - ])), 17 - corge: z.optional(z.object({})), 18 - garply: z.optional(z.coerce.bigint()), 19 - numberInt8: z.optional(z.literal(100)), 20 - numberInt16: z.optional(z.literal(1000)), 21 - numberInt32: z.optional(z.literal(100000)), 22 - numberInt64: z.optional(z.literal(1000000000000)), 23 - numberUint8: z.optional(z.literal(200)), 24 - numberUint16: z.optional(z.literal(50000)), 25 - numberUint32: z.optional(z.literal(3000000000)), 26 - numberUint64: z.optional(z.literal(18000000000000000000)), 27 - integerInt8: z.optional(z.literal(-100)), 28 - integerInt16: z.optional(z.literal(-1000)), 29 - integerInt32: z.optional(z.literal(-100000)), 30 - integerInt64: z.optional(z.literal(-1000000000000)), 31 - integerUint8: z.optional(z.literal(255)), 32 - integerUint16: z.optional(z.literal(65535)), 33 - integerUint32: z.optional(z.literal(4294967295)), 34 - integerUint64: z.optional(z.int()), 35 - stringInt64: z.optional(z.literal('-9223372036854775808')), 36 - stringUint64: z.optional(z.literal('18446744073709551615')) 16 + ]).optional(), 17 + corge: z.object({}).optional(), 18 + garply: z.coerce.bigint().optional(), 19 + numberInt8: z.literal(100).optional(), 20 + numberInt16: z.literal(1000).optional(), 21 + numberInt32: z.literal(100000).optional(), 22 + numberInt64: z.literal(1000000000000).optional(), 23 + numberUint8: z.literal(200).optional(), 24 + numberUint16: z.literal(50000).optional(), 25 + numberUint32: z.literal(3000000000).optional(), 26 + numberUint64: z.literal(18000000000000000000).optional(), 27 + integerInt8: z.literal(-100).optional(), 28 + integerInt16: z.literal(-1000).optional(), 29 + integerInt32: z.literal(-100000).optional(), 30 + integerInt64: z.literal(-1000000000000).optional(), 31 + integerUint8: z.literal(255).optional(), 32 + integerUint16: z.literal(65535).optional(), 33 + integerUint32: z.literal(4294967295).optional(), 34 + integerUint64: z.number().int().optional(), 35 + stringInt64: z.literal('-9223372036854775808').optional(), 36 + stringUint64: z.literal('18446744073709551615').optional() 37 37 });
+2 -2
packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/mini/validators-bigint-min-max/zod.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 - import * as z from 'zod/mini'; 3 + import { z } from 'zod'; 4 4 5 5 export const zFoo = z.object({ 6 - foo: z.optional(z.coerce.bigint().check(z.gte(BigInt(0)), z.lte(BigInt(100)))) 6 + foo: z.coerce.bigint().gte(BigInt(0)).lte(BigInt(100)).optional() 7 7 });
+4 -4
packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/mini/validators-circular-ref-2/zod.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 - import * as z from 'zod/mini'; 3 + import { z } from 'zod'; 4 4 5 - export const zBar = z.object({ 5 + export const zBar: z.AnyZodObject = z.object({ 6 6 bar: z.union([ 7 - z.array(z.lazy((): any => { 7 + z.array(z.lazy(() => { 8 8 return zBar; 9 9 })), 10 10 z.null() 11 11 ]) 12 12 }); 13 13 14 - export const zFoo = z.object({ 14 + export const zFoo: z.AnyZodObject = z.object({ 15 15 foo: zBar 16 16 });
+9 -11
packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/mini/validators-circular-ref/zod.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 - import * as z from 'zod/mini'; 3 + import { z } from 'zod'; 4 4 5 - export const zBar = z.object({ 6 - get bar(): z.ZodMiniOptional { 7 - return z.optional(z.array(z.lazy((): any => { 8 - return zBar; 9 - }))); 10 - } 5 + export const zBar: z.AnyZodObject = z.object({ 6 + bar: z.array(z.lazy(() => { 7 + return zBar; 8 + })).optional() 11 9 }); 12 10 13 - export const zFoo = z.object({ 14 - foo: z.optional(zBar) 11 + export const zFoo: z.AnyZodObject = z.object({ 12 + foo: zBar.optional() 15 13 }); 16 14 17 15 /** 18 16 * description caused circular reference error 19 17 */ 20 - export const zQux = z.lazy((): any => { 18 + export const zQux: z.ZodTypeAny = z.lazy(() => { 21 19 return zQux; 22 20 }); 23 21 24 - export const zBaz = zQux; 22 + export const zBaz: z.ZodTypeAny = zQux;
+31 -33
packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/mini/validators-dates/zod.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 - import * as z from 'zod/mini'; 3 + import { z } from 'zod'; 4 4 5 5 /** 6 6 * This is Bar schema. 7 7 */ 8 - export const zBar = z.object({ 9 - get foo(): z.ZodMiniOptional { 10 - return z.optional(zFoo); 11 - } 8 + export const zBar: z.AnyZodObject = z.object({ 9 + foo: z.lazy(() => { 10 + return zFoo; 11 + }).optional() 12 12 }); 13 13 14 14 /** 15 15 * This is Foo schema. 16 16 */ 17 - export const zFoo = z._default(z.union([ 17 + export const zFoo: z.ZodTypeAny = z.union([ 18 18 z.object({ 19 - foo: z.optional(z.string().check(z.regex(/^\d{3}-\d{2}-\d{4}$/))), 20 - bar: z.optional(zBar), 21 - get baz(): z.ZodMiniOptional { 22 - return z.optional(z.array(z.lazy((): any => { 23 - return zFoo; 24 - }))); 25 - }, 26 - qux: z._default(z.optional(z.int().check(z.gt(0))), 0) 19 + foo: z.string().regex(/^\d{3}-\d{2}-\d{4}$/).optional(), 20 + bar: zBar.optional(), 21 + baz: z.array(z.lazy(() => { 22 + return zFoo; 23 + })).optional(), 24 + qux: z.number().int().gt(0).optional().default(0) 27 25 }), 28 26 z.null() 29 - ]), null); 27 + ]).default(null); 30 28 31 - export const zBaz = z._default(z.readonly(z.string().check(z.regex(/foo\nbar/))), 'baz'); 29 + export const zBaz = z.string().regex(/foo\nbar/).readonly().default('baz'); 32 30 33 - export const zQux = z.record(z.string(), z.object({ 34 - qux: z.optional(z.string()) 31 + export const zQux = z.record(z.object({ 32 + qux: z.string().optional() 35 33 })); 36 34 37 35 /** ··· 40 38 export const zFoo2 = z.string(); 41 39 42 40 export const zFoo3 = z.object({ 43 - foo: z.optional(zBar) 41 + foo: zBar.optional() 44 42 }); 45 43 46 44 export const zPatchFooData = z.object({ 47 45 body: z.object({ 48 - foo: z.optional(z.string()) 46 + foo: z.string().optional() 49 47 }), 50 - path: z.optional(z.never()), 51 - query: z.optional(z.object({ 52 - foo: z.optional(z.string()), 53 - bar: z.optional(zBar), 54 - baz: z.optional(z.object({ 55 - baz: z.optional(z.string()) 56 - })), 57 - qux: z.optional(z.iso.date()), 58 - quux: z.optional(z.iso.datetime({ 48 + path: z.never().optional(), 49 + query: z.object({ 50 + foo: z.string().optional(), 51 + bar: zBar.optional(), 52 + baz: z.object({ 53 + baz: z.string().optional() 54 + }).optional(), 55 + qux: z.string().date().optional(), 56 + quux: z.string().datetime({ 59 57 offset: true 60 - })) 61 - })) 58 + }).optional() 59 + }).optional() 62 60 }); 63 61 64 62 export const zPostFooData = z.object({ 65 63 body: zFoo3, 66 - path: z.optional(z.never()), 67 - query: z.optional(z.never()) 64 + path: z.never().optional(), 65 + query: z.never().optional() 68 66 });
+32 -46
packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/mini/validators-metadata/zod.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 - import * as z from 'zod/mini'; 3 + import { z } from 'zod'; 4 4 5 5 /** 6 6 * This is Bar schema. 7 7 */ 8 - export const zBar = z.object({ 9 - get foo(): z.ZodMiniOptional { 10 - return z.optional(zFoo); 11 - } 12 - }).register(z.globalRegistry, { 13 - description: 'This is Bar schema.' 14 - }); 8 + export const zBar: z.AnyZodObject = z.object({ 9 + foo: z.lazy(() => { 10 + return zFoo; 11 + }).optional() 12 + }).describe('This is Bar schema.'); 15 13 16 14 /** 17 15 * This is Foo schema. 18 16 */ 19 - export const zFoo = z._default(z.union([ 17 + export const zFoo: z.ZodTypeAny = z.union([ 20 18 z.object({ 21 - foo: z.optional(z.string().check(z.regex(/^\d{3}-\d{2}-\d{4}$/)).register(z.globalRegistry, { 22 - description: 'This is foo property.' 23 - })), 24 - bar: z.optional(zBar), 25 - get baz(): z.ZodMiniOptional { 26 - return z.optional(z.array(z.lazy((): any => { 27 - return zFoo; 28 - })).register(z.globalRegistry, { 29 - description: 'This is baz property.' 30 - })); 31 - }, 32 - qux: z._default(z.optional(z.int().check(z.gt(0)).register(z.globalRegistry, { 33 - description: 'This is qux property.' 34 - })), 0) 19 + foo: z.string().regex(/^\d{3}-\d{2}-\d{4}$/).describe('This is foo property.').optional(), 20 + bar: zBar.optional(), 21 + baz: z.array(z.lazy(() => { 22 + return zFoo; 23 + })).describe('This is baz property.').optional(), 24 + qux: z.number().int().gt(0).describe('This is qux property.').optional().default(0) 35 25 }), 36 26 z.null() 37 - ]), null); 27 + ]).default(null); 38 28 39 - export const zBaz = z._default(z.readonly(z.string().check(z.regex(/foo\nbar/))), 'baz'); 29 + export const zBaz = z.string().regex(/foo\nbar/).readonly().default('baz'); 40 30 41 - export const zQux = z.record(z.string(), z.object({ 42 - qux: z.optional(z.string()) 31 + export const zQux = z.record(z.object({ 32 + qux: z.string().optional() 43 33 })); 44 34 45 35 /** 46 36 * This is Foo parameter. 47 37 */ 48 - export const zFoo2 = z.string().register(z.globalRegistry, { 49 - description: 'This is Foo parameter.' 50 - }); 38 + export const zFoo2 = z.string().describe('This is Foo parameter.'); 51 39 52 40 export const zFoo3 = z.object({ 53 - foo: z.optional(zBar) 41 + foo: zBar.optional() 54 42 }); 55 43 56 44 export const zPatchFooData = z.object({ 57 45 body: z.object({ 58 - foo: z.optional(z.string()) 46 + foo: z.string().optional() 59 47 }), 60 - path: z.optional(z.never()), 61 - query: z.optional(z.object({ 62 - foo: z.optional(z.string().register(z.globalRegistry, { 63 - description: 'This is Foo parameter.' 64 - })), 65 - bar: z.optional(zBar), 66 - baz: z.optional(z.object({ 67 - baz: z.optional(z.string()) 68 - })), 69 - qux: z.optional(z.iso.date()), 70 - quux: z.optional(z.iso.datetime()) 71 - })) 48 + path: z.never().optional(), 49 + query: z.object({ 50 + foo: z.string().describe('This is Foo parameter.').optional(), 51 + bar: zBar.optional(), 52 + baz: z.object({ 53 + baz: z.string().optional() 54 + }).optional(), 55 + qux: z.string().date().optional(), 56 + quux: z.string().datetime().optional() 57 + }).optional() 72 58 }); 73 59 74 60 export const zPostFooData = z.object({ 75 61 body: zFoo3, 76 - path: z.optional(z.never()), 77 - query: z.optional(z.never()) 62 + path: z.never().optional(), 63 + query: z.never().optional() 78 64 });
+31 -49
packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/mini/validators-types/zod.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 - import * as z from 'zod/mini'; 3 + import { z } from 'zod'; 4 4 5 5 /** 6 6 * This is Bar schema. 7 7 */ 8 - export const zBar = z.object({ 9 - get foo(): z.ZodMiniOptional { 10 - return z.optional(zFoo); 11 - } 8 + export const zBar: z.AnyZodObject = z.object({ 9 + foo: z.lazy(() => { 10 + return zFoo; 11 + }).optional() 12 12 }); 13 13 14 - export type BarZodType = z.infer<typeof zBar>; 15 - 16 14 /** 17 15 * This is Foo schema. 18 16 */ 19 - export const zFoo = z._default(z.union([ 17 + export const zFoo: z.ZodTypeAny = z.union([ 20 18 z.object({ 21 - foo: z.optional(z.string().check(z.regex(/^\d{3}-\d{2}-\d{4}$/))), 22 - bar: z.optional(zBar), 23 - get baz(): z.ZodMiniOptional { 24 - return z.optional(z.array(z.lazy((): any => { 25 - return zFoo; 26 - }))); 27 - }, 28 - qux: z._default(z.optional(z.int().check(z.gt(0))), 0) 19 + foo: z.string().regex(/^\d{3}-\d{2}-\d{4}$/).optional(), 20 + bar: zBar.optional(), 21 + baz: z.array(z.lazy(() => { 22 + return zFoo; 23 + })).optional(), 24 + qux: z.number().int().gt(0).optional().default(0) 29 25 }), 30 26 z.null() 31 - ]), null); 32 - 33 - export type FooZodType = z.infer<typeof zFoo>; 27 + ]).default(null); 34 28 35 - export const zBaz = z._default(z.readonly(z.string().check(z.regex(/foo\nbar/))), 'baz'); 36 - 37 - export type BazZodType = z.infer<typeof zBaz>; 29 + export const zBaz = z.string().regex(/foo\nbar/).readonly().default('baz'); 38 30 39 - export const zQux = z.record(z.string(), z.object({ 40 - qux: z.optional(z.string()) 31 + export const zQux = z.record(z.object({ 32 + qux: z.string().optional() 41 33 })); 42 34 43 - export type QuxZodType = z.infer<typeof zQux>; 44 - 45 35 /** 46 36 * This is Foo parameter. 47 37 */ 48 38 export const zFoo2 = z.string(); 49 39 50 - export type FooZodType2 = z.infer<typeof zFoo2>; 51 - 52 40 export const zFoo3 = z.object({ 53 - foo: z.optional(zBar) 41 + foo: zBar.optional() 54 42 }); 55 - 56 - export type FooZodType3 = z.infer<typeof zFoo3>; 57 43 58 44 export const zPatchFooData = z.object({ 59 45 body: z.object({ 60 - foo: z.optional(z.string()) 46 + foo: z.string().optional() 61 47 }), 62 - path: z.optional(z.never()), 63 - query: z.optional(z.object({ 64 - foo: z.optional(z.string()), 65 - bar: z.optional(zBar), 66 - baz: z.optional(z.object({ 67 - baz: z.optional(z.string()) 68 - })), 69 - qux: z.optional(z.iso.date()), 70 - quux: z.optional(z.iso.datetime()) 71 - })) 48 + path: z.never().optional(), 49 + query: z.object({ 50 + foo: z.string().optional(), 51 + bar: zBar.optional(), 52 + baz: z.object({ 53 + baz: z.string().optional() 54 + }).optional(), 55 + qux: z.string().date().optional(), 56 + quux: z.string().datetime().optional() 57 + }).optional() 72 58 }); 73 59 74 - export type PatchFooDataZodType = z.infer<typeof zPatchFooData>; 75 - 76 60 export const zPostFooData = z.object({ 77 61 body: zFoo3, 78 - path: z.optional(z.never()), 79 - query: z.optional(z.never()) 80 - }); 81 - 82 - export type PostFooDataZodType = z.infer<typeof zPostFooData>; 62 + path: z.never().optional(), 63 + query: z.never().optional() 64 + });
+5 -5
packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/mini/validators-union-merge/zod.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 - import * as z from 'zod/mini'; 3 + import { z } from 'zod'; 4 4 5 5 export const zContact = z.union([ 6 6 z.object({ ··· 11 11 }) 12 12 ]); 13 13 14 - export const zUser = z.intersection(zContact, z.object({ 14 + export const zUser = zContact.and(z.object({ 15 15 username: z.string() 16 16 })); 17 17 18 18 export const zDogDetails = z.object({ 19 19 breed: z.string(), 20 - barkVolume: z.int().check(z.gte(1), z.lte(10)) 20 + barkVolume: z.number().int().gte(1).lte(10) 21 21 }); 22 22 23 23 export const zCatDetails = z.object({ ··· 32 32 export const zPetStore = z.object({ 33 33 animals: z.array(z.object({ 34 34 name: z.string(), 35 - type: z.optional(z.enum([ 35 + type: z.enum([ 36 36 'dog', 37 37 'cat' 38 - ])), 38 + ]).optional(), 39 39 details: z.union([ 40 40 zDogDetails, 41 41 zCatDetails
+30 -32
packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/mini/validators/zod.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 - import * as z from 'zod/mini'; 3 + import { z } from 'zod'; 4 4 5 5 /** 6 6 * This is Bar schema. 7 7 */ 8 - export const zBar = z.object({ 9 - get foo(): z.ZodMiniOptional { 10 - return z.optional(zFoo); 11 - } 8 + export const zBar: z.AnyZodObject = z.object({ 9 + foo: z.lazy(() => { 10 + return zFoo; 11 + }).optional() 12 12 }); 13 13 14 14 /** 15 15 * This is Foo schema. 16 16 */ 17 - export const zFoo = z._default(z.union([ 17 + export const zFoo: z.ZodTypeAny = z.union([ 18 18 z.object({ 19 - foo: z.optional(z.string().check(z.regex(/^\d{3}-\d{2}-\d{4}$/))), 20 - bar: z.optional(zBar), 21 - get baz(): z.ZodMiniOptional { 22 - return z.optional(z.array(z.lazy((): any => { 23 - return zFoo; 24 - }))); 25 - }, 26 - qux: z._default(z.optional(z.int().check(z.gt(0))), 0) 19 + foo: z.string().regex(/^\d{3}-\d{2}-\d{4}$/).optional(), 20 + bar: zBar.optional(), 21 + baz: z.array(z.lazy(() => { 22 + return zFoo; 23 + })).optional(), 24 + qux: z.number().int().gt(0).optional().default(0) 27 25 }), 28 26 z.null() 29 - ]), null); 27 + ]).default(null); 30 28 31 - export const zBaz = z._default(z.readonly(z.string().check(z.regex(/foo\nbar/))), 'baz'); 29 + export const zBaz = z.string().regex(/foo\nbar/).readonly().default('baz'); 32 30 33 - export const zQux = z.record(z.string(), z.object({ 34 - qux: z.optional(z.string()) 31 + export const zQux = z.record(z.object({ 32 + qux: z.string().optional() 35 33 })); 36 34 37 35 /** ··· 40 38 export const zFoo2 = z.string(); 41 39 42 40 export const zFoo3 = z.object({ 43 - foo: z.optional(zBar) 41 + foo: zBar.optional() 44 42 }); 45 43 46 44 export const zPatchFooData = z.object({ 47 45 body: z.object({ 48 - foo: z.optional(z.string()) 46 + foo: z.string().optional() 49 47 }), 50 - path: z.optional(z.never()), 51 - query: z.optional(z.object({ 52 - foo: z.optional(z.string()), 53 - bar: z.optional(zBar), 54 - baz: z.optional(z.object({ 55 - baz: z.optional(z.string()) 56 - })), 57 - qux: z.optional(z.iso.date()), 58 - quux: z.optional(z.iso.datetime()) 59 - })) 48 + path: z.never().optional(), 49 + query: z.object({ 50 + foo: z.string().optional(), 51 + bar: zBar.optional(), 52 + baz: z.object({ 53 + baz: z.string().optional() 54 + }).optional(), 55 + qux: z.string().date().optional(), 56 + quux: z.string().datetime().optional() 57 + }).optional() 60 58 }); 61 59 62 60 export const zPostFooData = z.object({ 63 61 body: zFoo3, 64 - path: z.optional(z.never()), 65 - query: z.optional(z.never()) 62 + path: z.never().optional(), 63 + query: z.never().optional() 66 64 });
+1 -1
packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/v3/array-items-one-of-length-1/zod.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 - import { z } from 'zod/v3'; 3 + import { z } from 'zod'; 4 4 5 5 export const zBar = z.string(); 6 6
+1 -1
packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/v3/enum-null/zod.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 - import { z } from 'zod/v3'; 3 + import { z } from 'zod'; 4 4 5 5 export const zFoo = z.enum([ 6 6 'foo',
+1 -1
packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/v3/schema-const/zod.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 - import { z } from 'zod/v3'; 3 + import { z } from 'zod'; 4 4 5 5 export const zFoo = z.object({ 6 6 foo: z.literal('foo').optional(),
+1 -1
packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/v3/validators-bigint-min-max/zod.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 - import { z } from 'zod/v3'; 3 + import { z } from 'zod'; 4 4 5 5 export const zFoo = z.object({ 6 6 foo: z.coerce.bigint().gte(BigInt(0)).lte(BigInt(100)).optional()
+1 -1
packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/v3/validators-circular-ref-2/zod.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 - import { z } from 'zod/v3'; 3 + import { z } from 'zod'; 4 4 5 5 export const zBar: z.AnyZodObject = z.object({ 6 6 bar: z.union([
+1 -1
packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/v3/validators-circular-ref/zod.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 - import { z } from 'zod/v3'; 3 + import { z } from 'zod'; 4 4 5 5 export const zBar: z.AnyZodObject = z.object({ 6 6 bar: z.array(z.lazy(() => {
+1 -1
packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/v3/validators-dates/zod.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 - import { z } from 'zod/v3'; 3 + import { z } from 'zod'; 4 4 5 5 /** 6 6 * This is Bar schema.
+1 -1
packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/v3/validators-metadata/zod.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 - import { z } from 'zod/v3'; 3 + import { z } from 'zod'; 4 4 5 5 /** 6 6 * This is Bar schema.
+2 -18
packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/v3/validators-types/zod.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 - import { z } from 'zod/v3'; 3 + import { z } from 'zod'; 4 4 5 5 /** 6 6 * This is Bar schema. ··· 10 10 return zFoo; 11 11 }).optional() 12 12 }); 13 - 14 - export type BarZodType = z.infer<typeof zBar>; 15 13 16 14 /** 17 15 * This is Foo schema. ··· 28 26 z.null() 29 27 ]).default(null); 30 28 31 - export type FooZodType = z.infer<typeof zFoo>; 32 - 33 29 export const zBaz = z.string().regex(/foo\nbar/).readonly().default('baz'); 34 - 35 - export type BazZodType = z.infer<typeof zBaz>; 36 30 37 31 export const zQux = z.record(z.object({ 38 32 qux: z.string().optional() 39 33 })); 40 - 41 - export type QuxZodType = z.infer<typeof zQux>; 42 34 43 35 /** 44 36 * This is Foo parameter. 45 37 */ 46 38 export const zFoo2 = z.string(); 47 39 48 - export type FooZodType2 = z.infer<typeof zFoo2>; 49 - 50 40 export const zFoo3 = z.object({ 51 41 foo: zBar.optional() 52 42 }); 53 - 54 - export type FooZodType3 = z.infer<typeof zFoo3>; 55 43 56 44 export const zPatchFooData = z.object({ 57 45 body: z.object({ ··· 69 57 }).optional() 70 58 }); 71 59 72 - export type PatchFooDataZodType = z.infer<typeof zPatchFooData>; 73 - 74 60 export const zPostFooData = z.object({ 75 61 body: zFoo3, 76 62 path: z.never().optional(), 77 63 query: z.never().optional() 78 - }); 79 - 80 - export type PostFooDataZodType = z.infer<typeof zPostFooData>; 64 + });
+1 -1
packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/v3/validators-union-merge/zod.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 - import { z } from 'zod/v3'; 3 + import { z } from 'zod'; 4 4 5 5 export const zContact = z.union([ 6 6 z.object({
+1 -1
packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/v3/validators/zod.gen.ts
··· 1 1 // This file is auto-generated by @hey-api/openapi-ts 2 2 3 - import { z } from 'zod/v3'; 3 + import { z } from 'zod'; 4 4 5 5 /** 6 6 * This is Bar schema.
+1 -1
packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/v4/array-items-one-of-length-1/zod.gen.ts
··· 5 5 export const zBar = z.string(); 6 6 7 7 export const zFoo = z.object({ 8 - foo: z.optional(z.array(zBar).min(1).max(2147483647)) 8 + foo: z.array(zBar).min(1).max(2147483647).optional() 9 9 });
+2 -2
packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/v4/enum-null/zod.gen.ts
··· 2 2 3 3 import { z } from 'zod'; 4 4 5 - export const zFoo = z.nullable(z.enum([ 5 + export const zFoo = z.enum([ 6 6 'foo', 7 7 'bar' 8 - ])); 8 + ]).nullable(); 9 9 10 10 export const zBar = z.enum([ 11 11 'foo',
+26 -26
packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/v4/schema-const/zod.gen.ts
··· 3 3 import { z } from 'zod'; 4 4 5 5 export const zFoo = z.object({ 6 - foo: z.optional(z.literal('foo')), 7 - bar: z.optional(z.literal(3.2)), 8 - baz: z.optional(z.literal(-1)), 9 - qux: z.optional(z.literal(true)), 10 - quux: z.optional(z.tuple([ 6 + foo: z.literal('foo').optional(), 7 + bar: z.literal(3.2).optional(), 8 + baz: z.literal(-1).optional(), 9 + qux: z.literal(true).optional(), 10 + quux: z.tuple([ 11 11 z.literal(1), 12 12 z.literal(2), 13 13 z.literal(3), 14 14 z.literal('foo'), 15 15 z.literal(true) 16 - ])), 17 - corge: z.optional(z.object({})), 18 - garply: z.optional(z.coerce.bigint()), 19 - numberInt8: z.optional(z.literal(100)), 20 - numberInt16: z.optional(z.literal(1000)), 21 - numberInt32: z.optional(z.literal(100000)), 22 - numberInt64: z.optional(z.literal(1000000000000)), 23 - numberUint8: z.optional(z.literal(200)), 24 - numberUint16: z.optional(z.literal(50000)), 25 - numberUint32: z.optional(z.literal(3000000000)), 26 - numberUint64: z.optional(z.literal(18000000000000000000)), 27 - integerInt8: z.optional(z.literal(-100)), 28 - integerInt16: z.optional(z.literal(-1000)), 29 - integerInt32: z.optional(z.literal(-100000)), 30 - integerInt64: z.optional(z.literal(-1000000000000)), 31 - integerUint8: z.optional(z.literal(255)), 32 - integerUint16: z.optional(z.literal(65535)), 33 - integerUint32: z.optional(z.literal(4294967295)), 34 - integerUint64: z.optional(z.int()), 35 - stringInt64: z.optional(z.literal('-9223372036854775808')), 36 - stringUint64: z.optional(z.literal('18446744073709551615')) 16 + ]).optional(), 17 + corge: z.object({}).optional(), 18 + garply: z.coerce.bigint().optional(), 19 + numberInt8: z.literal(100).optional(), 20 + numberInt16: z.literal(1000).optional(), 21 + numberInt32: z.literal(100000).optional(), 22 + numberInt64: z.literal(1000000000000).optional(), 23 + numberUint8: z.literal(200).optional(), 24 + numberUint16: z.literal(50000).optional(), 25 + numberUint32: z.literal(3000000000).optional(), 26 + numberUint64: z.literal(18000000000000000000).optional(), 27 + integerInt8: z.literal(-100).optional(), 28 + integerInt16: z.literal(-1000).optional(), 29 + integerInt32: z.literal(-100000).optional(), 30 + integerInt64: z.literal(-1000000000000).optional(), 31 + integerUint8: z.literal(255).optional(), 32 + integerUint16: z.literal(65535).optional(), 33 + integerUint32: z.literal(4294967295).optional(), 34 + integerUint64: z.number().int().optional(), 35 + stringInt64: z.literal('-9223372036854775808').optional(), 36 + stringUint64: z.literal('18446744073709551615').optional() 37 37 });
+1 -1
packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/v4/validators-bigint-min-max/zod.gen.ts
··· 3 3 import { z } from 'zod'; 4 4 5 5 export const zFoo = z.object({ 6 - foo: z.optional(z.coerce.bigint().gte(BigInt(0)).lte(BigInt(100))) 6 + foo: z.coerce.bigint().gte(BigInt(0)).lte(BigInt(100)).optional() 7 7 });
+3 -3
packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/v4/validators-circular-ref-2/zod.gen.ts
··· 2 2 3 3 import { z } from 'zod'; 4 4 5 - export const zBar = z.object({ 5 + export const zBar: z.AnyZodObject = z.object({ 6 6 bar: z.union([ 7 - z.array(z.lazy((): any => { 7 + z.array(z.lazy(() => { 8 8 return zBar; 9 9 })), 10 10 z.null() 11 11 ]) 12 12 }); 13 13 14 - export const zFoo = z.object({ 14 + export const zFoo: z.AnyZodObject = z.object({ 15 15 foo: zBar 16 16 });
+8 -10
packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/v4/validators-circular-ref/zod.gen.ts
··· 2 2 3 3 import { z } from 'zod'; 4 4 5 - export const zBar = z.object({ 6 - get bar(): z.ZodOptional { 7 - return z.optional(z.array(z.lazy((): any => { 8 - return zBar; 9 - }))); 10 - } 5 + export const zBar: z.AnyZodObject = z.object({ 6 + bar: z.array(z.lazy(() => { 7 + return zBar; 8 + })).optional() 11 9 }); 12 10 13 - export const zFoo = z.object({ 14 - foo: z.optional(zBar) 11 + export const zFoo: z.AnyZodObject = z.object({ 12 + foo: zBar.optional() 15 13 }); 16 14 17 15 /** 18 16 * description caused circular reference error 19 17 */ 20 - export const zQux = z.lazy((): any => { 18 + export const zQux: z.ZodTypeAny = z.lazy(() => { 21 19 return zQux; 22 20 }); 23 21 24 - export const zBaz = zQux; 22 + export const zBaz: z.ZodTypeAny = zQux;
+28 -30
packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/v4/validators-dates/zod.gen.ts
··· 5 5 /** 6 6 * This is Bar schema. 7 7 */ 8 - export const zBar = z.object({ 9 - get foo(): z.ZodOptional { 10 - return z.optional(zFoo); 11 - } 8 + export const zBar: z.AnyZodObject = z.object({ 9 + foo: z.lazy(() => { 10 + return zFoo; 11 + }).optional() 12 12 }); 13 13 14 14 /** 15 15 * This is Foo schema. 16 16 */ 17 - export const zFoo = z.union([ 17 + export const zFoo: z.ZodTypeAny = z.union([ 18 18 z.object({ 19 - foo: z.optional(z.string().regex(/^\d{3}-\d{2}-\d{4}$/)), 20 - bar: z.optional(zBar), 21 - get baz(): z.ZodOptional { 22 - return z.optional(z.array(z.lazy((): any => { 23 - return zFoo; 24 - }))); 25 - }, 26 - qux: z.optional(z.int().gt(0)).default(0) 19 + foo: z.string().regex(/^\d{3}-\d{2}-\d{4}$/).optional(), 20 + bar: zBar.optional(), 21 + baz: z.array(z.lazy(() => { 22 + return zFoo; 23 + })).optional(), 24 + qux: z.number().int().gt(0).optional().default(0) 27 25 }), 28 26 z.null() 29 27 ]).default(null); 30 28 31 29 export const zBaz = z.string().regex(/foo\nbar/).readonly().default('baz'); 32 30 33 - export const zQux = z.record(z.string(), z.object({ 34 - qux: z.optional(z.string()) 31 + export const zQux = z.record(z.object({ 32 + qux: z.string().optional() 35 33 })); 36 34 37 35 /** ··· 40 38 export const zFoo2 = z.string(); 41 39 42 40 export const zFoo3 = z.object({ 43 - foo: z.optional(zBar) 41 + foo: zBar.optional() 44 42 }); 45 43 46 44 export const zPatchFooData = z.object({ 47 45 body: z.object({ 48 - foo: z.optional(z.string()) 46 + foo: z.string().optional() 49 47 }), 50 - path: z.optional(z.never()), 51 - query: z.optional(z.object({ 52 - foo: z.optional(z.string()), 53 - bar: z.optional(zBar), 54 - baz: z.optional(z.object({ 55 - baz: z.optional(z.string()) 56 - })), 57 - qux: z.optional(z.iso.date()), 58 - quux: z.optional(z.iso.datetime({ 48 + path: z.never().optional(), 49 + query: z.object({ 50 + foo: z.string().optional(), 51 + bar: zBar.optional(), 52 + baz: z.object({ 53 + baz: z.string().optional() 54 + }).optional(), 55 + qux: z.string().date().optional(), 56 + quux: z.string().datetime({ 59 57 offset: true 60 - })) 61 - })) 58 + }).optional() 59 + }).optional() 62 60 }); 63 61 64 62 export const zPostFooData = z.object({ 65 63 body: zFoo3, 66 - path: z.optional(z.never()), 67 - query: z.optional(z.never()) 64 + path: z.never().optional(), 65 + query: z.never().optional() 68 66 });
+29 -43
packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/v4/validators-metadata/zod.gen.ts
··· 5 5 /** 6 6 * This is Bar schema. 7 7 */ 8 - export const zBar = z.object({ 9 - get foo(): z.ZodOptional { 10 - return z.optional(zFoo); 11 - } 12 - }).register(z.globalRegistry, { 13 - description: 'This is Bar schema.' 14 - }); 8 + export const zBar: z.AnyZodObject = z.object({ 9 + foo: z.lazy(() => { 10 + return zFoo; 11 + }).optional() 12 + }).describe('This is Bar schema.'); 15 13 16 14 /** 17 15 * This is Foo schema. 18 16 */ 19 - export const zFoo = z.union([ 17 + export const zFoo: z.ZodTypeAny = z.union([ 20 18 z.object({ 21 - foo: z.optional(z.string().regex(/^\d{3}-\d{2}-\d{4}$/).register(z.globalRegistry, { 22 - description: 'This is foo property.' 23 - })), 24 - bar: z.optional(zBar), 25 - get baz(): z.ZodOptional { 26 - return z.optional(z.array(z.lazy((): any => { 27 - return zFoo; 28 - })).register(z.globalRegistry, { 29 - description: 'This is baz property.' 30 - })); 31 - }, 32 - qux: z.optional(z.int().gt(0).register(z.globalRegistry, { 33 - description: 'This is qux property.' 34 - })).default(0) 19 + foo: z.string().regex(/^\d{3}-\d{2}-\d{4}$/).describe('This is foo property.').optional(), 20 + bar: zBar.optional(), 21 + baz: z.array(z.lazy(() => { 22 + return zFoo; 23 + })).describe('This is baz property.').optional(), 24 + qux: z.number().int().gt(0).describe('This is qux property.').optional().default(0) 35 25 }), 36 26 z.null() 37 27 ]).default(null); 38 28 39 29 export const zBaz = z.string().regex(/foo\nbar/).readonly().default('baz'); 40 30 41 - export const zQux = z.record(z.string(), z.object({ 42 - qux: z.optional(z.string()) 31 + export const zQux = z.record(z.object({ 32 + qux: z.string().optional() 43 33 })); 44 34 45 35 /** 46 36 * This is Foo parameter. 47 37 */ 48 - export const zFoo2 = z.string().register(z.globalRegistry, { 49 - description: 'This is Foo parameter.' 50 - }); 38 + export const zFoo2 = z.string().describe('This is Foo parameter.'); 51 39 52 40 export const zFoo3 = z.object({ 53 - foo: z.optional(zBar) 41 + foo: zBar.optional() 54 42 }); 55 43 56 44 export const zPatchFooData = z.object({ 57 45 body: z.object({ 58 - foo: z.optional(z.string()) 46 + foo: z.string().optional() 59 47 }), 60 - path: z.optional(z.never()), 61 - query: z.optional(z.object({ 62 - foo: z.optional(z.string().register(z.globalRegistry, { 63 - description: 'This is Foo parameter.' 64 - })), 65 - bar: z.optional(zBar), 66 - baz: z.optional(z.object({ 67 - baz: z.optional(z.string()) 68 - })), 69 - qux: z.optional(z.iso.date()), 70 - quux: z.optional(z.iso.datetime()) 71 - })) 48 + path: z.never().optional(), 49 + query: z.object({ 50 + foo: z.string().describe('This is Foo parameter.').optional(), 51 + bar: zBar.optional(), 52 + baz: z.object({ 53 + baz: z.string().optional() 54 + }).optional(), 55 + qux: z.string().date().optional(), 56 + quux: z.string().datetime().optional() 57 + }).optional() 72 58 }); 73 59 74 60 export const zPostFooData = z.object({ 75 61 body: zFoo3, 76 - path: z.optional(z.never()), 77 - query: z.optional(z.never()) 62 + path: z.never().optional(), 63 + query: z.never().optional() 78 64 });
+28 -46
packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/v4/validators-types/zod.gen.ts
··· 5 5 /** 6 6 * This is Bar schema. 7 7 */ 8 - export const zBar = z.object({ 9 - get foo(): z.ZodOptional { 10 - return z.optional(zFoo); 11 - } 8 + export const zBar: z.AnyZodObject = z.object({ 9 + foo: z.lazy(() => { 10 + return zFoo; 11 + }).optional() 12 12 }); 13 - 14 - export type BarZodType = z.infer<typeof zBar>; 15 13 16 14 /** 17 15 * This is Foo schema. 18 16 */ 19 - export const zFoo = z.union([ 17 + export const zFoo: z.ZodTypeAny = z.union([ 20 18 z.object({ 21 - foo: z.optional(z.string().regex(/^\d{3}-\d{2}-\d{4}$/)), 22 - bar: z.optional(zBar), 23 - get baz(): z.ZodOptional { 24 - return z.optional(z.array(z.lazy((): any => { 25 - return zFoo; 26 - }))); 27 - }, 28 - qux: z.optional(z.int().gt(0)).default(0) 19 + foo: z.string().regex(/^\d{3}-\d{2}-\d{4}$/).optional(), 20 + bar: zBar.optional(), 21 + baz: z.array(z.lazy(() => { 22 + return zFoo; 23 + })).optional(), 24 + qux: z.number().int().gt(0).optional().default(0) 29 25 }), 30 26 z.null() 31 27 ]).default(null); 32 - 33 - export type FooZodType = z.infer<typeof zFoo>; 34 28 35 29 export const zBaz = z.string().regex(/foo\nbar/).readonly().default('baz'); 36 30 37 - export type BazZodType = z.infer<typeof zBaz>; 38 - 39 - export const zQux = z.record(z.string(), z.object({ 40 - qux: z.optional(z.string()) 31 + export const zQux = z.record(z.object({ 32 + qux: z.string().optional() 41 33 })); 42 - 43 - export type QuxZodType = z.infer<typeof zQux>; 44 34 45 35 /** 46 36 * This is Foo parameter. 47 37 */ 48 38 export const zFoo2 = z.string(); 49 39 50 - export type FooZodType2 = z.infer<typeof zFoo2>; 51 - 52 40 export const zFoo3 = z.object({ 53 - foo: z.optional(zBar) 41 + foo: zBar.optional() 54 42 }); 55 - 56 - export type FooZodType3 = z.infer<typeof zFoo3>; 57 43 58 44 export const zPatchFooData = z.object({ 59 45 body: z.object({ 60 - foo: z.optional(z.string()) 46 + foo: z.string().optional() 61 47 }), 62 - path: z.optional(z.never()), 63 - query: z.optional(z.object({ 64 - foo: z.optional(z.string()), 65 - bar: z.optional(zBar), 66 - baz: z.optional(z.object({ 67 - baz: z.optional(z.string()) 68 - })), 69 - qux: z.optional(z.iso.date()), 70 - quux: z.optional(z.iso.datetime()) 71 - })) 48 + path: z.never().optional(), 49 + query: z.object({ 50 + foo: z.string().optional(), 51 + bar: zBar.optional(), 52 + baz: z.object({ 53 + baz: z.string().optional() 54 + }).optional(), 55 + qux: z.string().date().optional(), 56 + quux: z.string().datetime().optional() 57 + }).optional() 72 58 }); 73 59 74 - export type PatchFooDataZodType = z.infer<typeof zPatchFooData>; 75 - 76 60 export const zPostFooData = z.object({ 77 61 body: zFoo3, 78 - path: z.optional(z.never()), 79 - query: z.optional(z.never()) 80 - }); 81 - 82 - export type PostFooDataZodType = z.infer<typeof zPostFooData>; 62 + path: z.never().optional(), 63 + query: z.never().optional() 64 + });
+3 -3
packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/v4/validators-union-merge/zod.gen.ts
··· 17 17 18 18 export const zDogDetails = z.object({ 19 19 breed: z.string(), 20 - barkVolume: z.int().gte(1).lte(10) 20 + barkVolume: z.number().int().gte(1).lte(10) 21 21 }); 22 22 23 23 export const zCatDetails = z.object({ ··· 32 32 export const zPetStore = z.object({ 33 33 animals: z.array(z.object({ 34 34 name: z.string(), 35 - type: z.optional(z.enum([ 35 + type: z.enum([ 36 36 'dog', 37 37 'cat' 38 - ])), 38 + ]).optional(), 39 39 details: z.union([ 40 40 zDogDetails, 41 41 zCatDetails
+27 -29
packages/openapi-ts-tests/zod/v4/__snapshots__/3.1.x/v4/validators/zod.gen.ts
··· 5 5 /** 6 6 * This is Bar schema. 7 7 */ 8 - export const zBar = z.object({ 9 - get foo(): z.ZodOptional { 10 - return z.optional(zFoo); 11 - } 8 + export const zBar: z.AnyZodObject = z.object({ 9 + foo: z.lazy(() => { 10 + return zFoo; 11 + }).optional() 12 12 }); 13 13 14 14 /** 15 15 * This is Foo schema. 16 16 */ 17 - export const zFoo = z.union([ 17 + export const zFoo: z.ZodTypeAny = z.union([ 18 18 z.object({ 19 - foo: z.optional(z.string().regex(/^\d{3}-\d{2}-\d{4}$/)), 20 - bar: z.optional(zBar), 21 - get baz(): z.ZodOptional { 22 - return z.optional(z.array(z.lazy((): any => { 23 - return zFoo; 24 - }))); 25 - }, 26 - qux: z.optional(z.int().gt(0)).default(0) 19 + foo: z.string().regex(/^\d{3}-\d{2}-\d{4}$/).optional(), 20 + bar: zBar.optional(), 21 + baz: z.array(z.lazy(() => { 22 + return zFoo; 23 + })).optional(), 24 + qux: z.number().int().gt(0).optional().default(0) 27 25 }), 28 26 z.null() 29 27 ]).default(null); 30 28 31 29 export const zBaz = z.string().regex(/foo\nbar/).readonly().default('baz'); 32 30 33 - export const zQux = z.record(z.string(), z.object({ 34 - qux: z.optional(z.string()) 31 + export const zQux = z.record(z.object({ 32 + qux: z.string().optional() 35 33 })); 36 34 37 35 /** ··· 40 38 export const zFoo2 = z.string(); 41 39 42 40 export const zFoo3 = z.object({ 43 - foo: z.optional(zBar) 41 + foo: zBar.optional() 44 42 }); 45 43 46 44 export const zPatchFooData = z.object({ 47 45 body: z.object({ 48 - foo: z.optional(z.string()) 46 + foo: z.string().optional() 49 47 }), 50 - path: z.optional(z.never()), 51 - query: z.optional(z.object({ 52 - foo: z.optional(z.string()), 53 - bar: z.optional(zBar), 54 - baz: z.optional(z.object({ 55 - baz: z.optional(z.string()) 56 - })), 57 - qux: z.optional(z.iso.date()), 58 - quux: z.optional(z.iso.datetime()) 59 - })) 48 + path: z.never().optional(), 49 + query: z.object({ 50 + foo: z.string().optional(), 51 + bar: zBar.optional(), 52 + baz: z.object({ 53 + baz: z.string().optional() 54 + }).optional(), 55 + qux: z.string().date().optional(), 56 + quux: z.string().datetime().optional() 57 + }).optional() 60 58 }); 61 59 62 60 export const zPostFooData = z.object({ 63 61 body: zFoo3, 64 - path: z.optional(z.never()), 65 - query: z.optional(z.never()) 62 + path: z.never().optional(), 63 + query: z.never().optional() 66 64 });