Skip to content

Commit 891bc59

Browse files
committed
test: update snapshots
1 parent 729f841 commit 891bc59

3 files changed

Lines changed: 25 additions & 22 deletions

File tree

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
// This file is auto-generated by @hey-api/openapi-ts
22

3-
export type { ClientOptions, ModelMapData, ModelMapResponse, ModelMapResponse2, ModelMapResponses, ModelWithDate } from './types.gen';
3+
export type { Bar, ClientOptions, Foo, PostFooData, PostFooResponse, PostFooResponses } from './types.gen';
Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,23 @@
11
// This file is auto-generated by @hey-api/openapi-ts
22

3-
import type { ModelMapResponse2 } from './types.gen';
3+
import type { PostFooResponse } from './types.gen';
44

5-
const modelWithDateSchemaResponseTransformer = (data: any) => {
6-
data.modified = new Date(data.modified);
5+
const fooSchemaResponseTransformer = (data: any) => {
6+
data.foo = new Date(data.foo);
77
return data;
88
};
99

10-
const modelMapResponseSchemaResponseTransformer = (data: any) => {
11-
data.items = Object.fromEntries(Object.entries(data.items).map((entry: any) => {
12-
entry[1] = modelWithDateSchemaResponseTransformer(entry[1]);
13-
return [entry[0], entry[1]];
14-
}));
10+
const barSchemaResponseTransformer = (data: any) => {
11+
data.bar = new Date(data.bar);
12+
if (data.baz) {
13+
for (const key of Object.keys(data.baz)) {
14+
data.baz[key] = fooSchemaResponseTransformer(data.baz[key]);
15+
}
16+
}
1517
return data;
1618
};
1719

18-
export const modelMapResponseTransformer = async (data: any): Promise<ModelMapResponse2> => {
19-
data = modelMapResponseSchemaResponseTransformer(data);
20+
export const postFooResponseTransformer = async (data: any): Promise<PostFooResponse> => {
21+
data = barSchemaResponseTransformer(data);
2022
return data;
2123
};

packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-additional-properties/types.gen.ts

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,28 +4,29 @@ export type ClientOptions = {
44
baseUrl: `${string}://${string}` | (string & {});
55
};
66

7-
export type ModelWithDate = {
8-
modified: Date;
7+
export type Foo = {
8+
foo: Date;
99
};
1010

11-
export type ModelMapResponse = {
12-
items: {
13-
[key: string]: ModelWithDate;
11+
export type Bar = {
12+
bar: Date;
13+
baz?: {
14+
[key: string]: Foo;
1415
};
1516
};
1617

17-
export type ModelMapData = {
18+
export type PostFooData = {
1819
body?: never;
1920
path?: never;
2021
query?: never;
21-
url: '/api/model-map';
22+
url: '/foo';
2223
};
2324

24-
export type ModelMapResponses = {
25+
export type PostFooResponses = {
2526
/**
26-
* Success
27+
* OK
2728
*/
28-
200: ModelMapResponse;
29+
200: Bar;
2930
};
3031

31-
export type ModelMapResponse2 = ModelMapResponses[keyof ModelMapResponses];
32+
export type PostFooResponse = PostFooResponses[keyof PostFooResponses];

0 commit comments

Comments
 (0)