Skip to content

Commit 91d91df

Browse files
committed
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)
1 parent 9a8a56c commit 91d91df

File tree

233 files changed

+1149
-2388
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

233 files changed

+1149
-2388
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
// This file is auto-generated by @hey-api/openapi-ts
2+
export * from './types.gen';
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
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+
};

packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/body-response-text-plain/client/client.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -143,16 +143,14 @@ export const createClient = (config: Config = {}): Client => {
143143
};
144144
}
145145

146-
const textError = await response.text();
147-
let jsonError: unknown;
146+
let error = await response.text();
148147

149148
try {
150-
jsonError = JSON.parse(textError);
149+
error = JSON.parse(error);
151150
} catch {
152151
// noop
153152
}
154153

155-
const error = jsonError ?? textError;
156154
let finalError = error;
157155

158156
for (const fn of interceptors.error._fns) {

packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/body-response-text-plain/core/params.ts

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,11 @@ type Slot = 'body' | 'headers' | 'path' | 'query';
33
export type Field =
44
| {
55
in: Exclude<Slot, 'body'>;
6-
/**
7-
* Field name. This is the name we want the user to see and use.
8-
*/
96
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-
*/
147
map?: string;
158
}
169
| {
1710
in: Extract<Slot, 'body'>;
18-
/**
19-
* Key isn't required for bodies.
20-
*/
2111
key?: string;
2212
map?: string;
2313
};

packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/body-response-text-plain/core/types.ts

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -102,17 +102,3 @@ export interface Config {
102102
*/
103103
responseValidator?: (data: unknown) => Promise<unknown>;
104104
}
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-
};
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,27 @@
11
// This file is auto-generated by @hey-api/openapi-ts
22

3+
export type _110 = '1-10' | '11-20';
4+
35
export const _110 = {
46
110: '1-10',
57
1120: '11-20'
68
} as const;
79

8-
export type _110 = typeof _110[keyof typeof _110];
10+
export type MyFoo = 'myFoo' | 'myBar';
911

1012
export const MyFoo = {
1113
MyFoo: 'myFoo',
1214
MyBar: 'myBar'
1315
} as const;
1416

15-
export type MyFoo = typeof MyFoo[keyof typeof MyFoo];
17+
export type MyFoo2 = 'MyFoo' | 'MyBar';
1618

1719
export const MyFoo2 = {
1820
MyFoo: 'MyFoo',
1921
MyBar: 'MyBar'
2022
} as const;
2123

22-
export type MyFoo2 = typeof MyFoo2[keyof typeof MyFoo2];
24+
export type Foo = 'foo' | 'bar' | '' | true | false;
2325

2426
export const Foo = {
2527
Foo: 'foo',
@@ -29,7 +31,7 @@ export const Foo = {
2931
False: false
3032
} as const;
3133

32-
export type Foo = typeof Foo[keyof typeof Foo];
34+
export type Numbers = 100 | 200 | 300 | -100 | -200 | -300;
3335

3436
export const Numbers = {
3537
100: 100,
@@ -40,16 +42,20 @@ export const Numbers = {
4042
'-300': -300
4143
} as const;
4244

43-
export type Numbers = typeof Numbers[keyof typeof Numbers];
45+
export type Arrays = [
46+
'foo'
47+
] | [
48+
'bar'
49+
] | [
50+
'baz'
51+
];
4452

4553
export const Arrays = {
4654
0: ['foo'],
4755
1: ['bar'],
4856
2: ['baz']
4957
} as const;
5058

51-
export type Arrays = typeof Arrays[keyof typeof Arrays];
52-
5359
export type ClientOptions = {
5460
baseUrl: string;
5561
};
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,27 @@
11
// This file is auto-generated by @hey-api/openapi-ts
22

3+
export type _110 = '1-10' | '11-20';
4+
35
export const _110 = {
46
'1_10': '1-10',
57
'11_20': '11-20'
68
} as const;
79

8-
export type _110 = typeof _110[keyof typeof _110];
10+
export type MyFoo = 'myFoo' | 'myBar';
911

1012
export const MyFoo = {
1113
MY_FOO: 'myFoo',
1214
MY_BAR: 'myBar'
1315
} as const;
1416

15-
export type MyFoo = typeof MyFoo[keyof typeof MyFoo];
17+
export type MyFoo2 = 'MyFoo' | 'MyBar';
1618

1719
export const MyFoo2 = {
1820
MY_FOO: 'MyFoo',
1921
MY_BAR: 'MyBar'
2022
} as const;
2123

22-
export type MyFoo2 = typeof MyFoo2[keyof typeof MyFoo2];
24+
export type Foo = 'foo' | 'bar' | '' | true | false;
2325

2426
export const Foo = {
2527
FOO: 'foo',
@@ -29,7 +31,7 @@ export const Foo = {
2931
FALSE: false
3032
} as const;
3133

32-
export type Foo = typeof Foo[keyof typeof Foo];
34+
export type Numbers = 100 | 200 | 300 | -100 | -200 | -300;
3335

3436
export const Numbers = {
3537
100: 100,
@@ -40,16 +42,20 @@ export const Numbers = {
4042
'-300': -300
4143
} as const;
4244

43-
export type Numbers = typeof Numbers[keyof typeof Numbers];
45+
export type Arrays = [
46+
'foo'
47+
] | [
48+
'bar'
49+
] | [
50+
'baz'
51+
];
4452

4553
export const Arrays = {
4654
0: ['foo'],
4755
1: ['bar'],
4856
2: ['baz']
4957
} as const;
5058

51-
export type Arrays = typeof Arrays[keyof typeof Arrays];
52-
5359
export type ClientOptions = {
5460
baseUrl: string;
5561
};
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,27 @@
11
// This file is auto-generated by @hey-api/openapi-ts
22

3+
export type _110 = '1-10' | '11-20';
4+
35
export const _110 = {
46
110: '1-10',
57
1120: '11-20'
68
} as const;
79

8-
export type _110 = typeof _110[keyof typeof _110];
10+
export type MyFoo = 'myFoo' | 'myBar';
911

1012
export const MyFoo = {
1113
myFoo: 'myFoo',
1214
myBar: 'myBar'
1315
} as const;
1416

15-
export type MyFoo = typeof MyFoo[keyof typeof MyFoo];
17+
export type MyFoo2 = 'MyFoo' | 'MyBar';
1618

1719
export const MyFoo2 = {
1820
myFoo: 'MyFoo',
1921
myBar: 'MyBar'
2022
} as const;
2123

22-
export type MyFoo2 = typeof MyFoo2[keyof typeof MyFoo2];
24+
export type Foo = 'foo' | 'bar' | '' | true | false;
2325

2426
export const Foo = {
2527
foo: 'foo',
@@ -29,7 +31,7 @@ export const Foo = {
2931
false: false
3032
} as const;
3133

32-
export type Foo = typeof Foo[keyof typeof Foo];
34+
export type Numbers = 100 | 200 | 300 | -100 | -200 | -300;
3335

3436
export const Numbers = {
3537
100: 100,
@@ -40,16 +42,20 @@ export const Numbers = {
4042
'-300': -300
4143
} as const;
4244

43-
export type Numbers = typeof Numbers[keyof typeof Numbers];
45+
export type Arrays = [
46+
'foo'
47+
] | [
48+
'bar'
49+
] | [
50+
'baz'
51+
];
4452

4553
export const Arrays = {
4654
0: ['foo'],
4755
1: ['bar'],
4856
2: ['baz']
4957
} as const;
5058

51-
export type Arrays = typeof Arrays[keyof typeof Arrays];
52-
5359
export type ClientOptions = {
5460
baseUrl: string;
5561
};
Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,27 @@
11
// This file is auto-generated by @hey-api/openapi-ts
22

3+
export type _110 = '1-10' | '11-20';
4+
35
export const _110 = {
46
'1-10': '1-10',
57
'11-20': '11-20'
68
} as const;
79

8-
export type _110 = typeof _110[keyof typeof _110];
10+
export type MyFoo = 'myFoo' | 'myBar';
911

1012
export const MyFoo = {
1113
myFoo: 'myFoo',
1214
myBar: 'myBar'
1315
} as const;
1416

15-
export type MyFoo = typeof MyFoo[keyof typeof MyFoo];
17+
export type MyFoo2 = 'MyFoo' | 'MyBar';
1618

1719
export const MyFoo2 = {
1820
MyFoo: 'MyFoo',
1921
MyBar: 'MyBar'
2022
} as const;
2123

22-
export type MyFoo2 = typeof MyFoo2[keyof typeof MyFoo2];
24+
export type Foo = 'foo' | 'bar' | '' | true | false;
2325

2426
export const Foo = {
2527
foo: 'foo',
@@ -29,7 +31,7 @@ export const Foo = {
2931
false: false
3032
} as const;
3133

32-
export type Foo = typeof Foo[keyof typeof Foo];
34+
export type Numbers = 100 | 200 | 300 | -100 | -200 | -300;
3335

3436
export const Numbers = {
3537
100: 100,
@@ -40,16 +42,20 @@ export const Numbers = {
4042
'-300': -300
4143
} as const;
4244

43-
export type Numbers = typeof Numbers[keyof typeof Numbers];
45+
export type Arrays = [
46+
'foo'
47+
] | [
48+
'bar'
49+
] | [
50+
'baz'
51+
];
4452

4553
export const Arrays = {
4654
0: ['foo'],
4755
1: ['bar'],
4856
2: ['baz']
4957
} as const;
5058

51-
export type Arrays = typeof Arrays[keyof typeof Arrays];
52-
5359
export type ClientOptions = {
5460
baseUrl: string;
5561
};

0 commit comments

Comments
 (0)