Skip to content

Commit 43766c8

Browse files
committedMay 17, 2024
fix(hono): correctly check response validator application/json
1 parent 246cf4c commit 43766c8

16 files changed

+551
-468
lines changed
 

‎.prettierignore

+1
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,4 @@ node_modules
99
.husky
1010
mockServiceWorker.js
1111
yarn.lock
12+
.svelte-kit

‎packages/hono/src/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -864,7 +864,7 @@ export const zValidator =
864864
865865
if (
866866
c.res.status !== 200 ||
867-
c.res.headers.get('Content-Type') !== 'application/json'
867+
!c.res.headers.get('Content-Type')?.includes('application/json')
868868
) {
869869
return;
870870
}

‎samples/basic/api/endpoints/petstoreFromFileSpec.ts

+43-54
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,13 @@
44
* Swagger Petstore
55
* OpenAPI spec version: 1.0.0
66
*/
7-
import axios from 'axios'
8-
import type {
9-
AxiosRequestConfig,
10-
AxiosResponse
11-
} from 'axios'
7+
import axios from 'axios';
8+
import type { AxiosRequestConfig, AxiosResponse } from 'axios';
129
export type ListPetsNestedArrayParams = {
13-
/**
14-
* How many items to return at one time (max 100)
15-
*/
16-
limit?: string;
10+
/**
11+
* How many items to return at one time (max 100)
12+
*/
13+
limit?: string;
1714
};
1815

1916
export type CreatePetsBody = {
@@ -22,10 +19,10 @@ export type CreatePetsBody = {
2219
};
2320

2421
export type ListPetsParams = {
25-
/**
26-
* How many items to return at one time (max 100)
27-
*/
28-
limit?: string;
22+
/**
23+
* How many items to return at one time (max 100)
24+
*/
25+
limit?: string;
2926
};
3027

3128
export interface Error {
@@ -43,17 +40,16 @@ export interface PetsNestedArray {
4340
data?: Pet[];
4441
}
4542

46-
export type PetCountry = typeof PetCountry[keyof typeof PetCountry];
47-
43+
export type PetCountry = (typeof PetCountry)[keyof typeof PetCountry];
4844

4945
// eslint-disable-next-line @typescript-eslint/no-redeclare
5046
export const PetCountry = {
51-
'People\'s_Republic_of_China': 'People\'s Republic of China',
47+
"People's_Republic_of_China": "People's Republic of China",
5248
Uruguay: 'Uruguay',
5349
} as const;
5450

55-
export type PetCallingCode = typeof PetCallingCode[keyof typeof PetCallingCode];
56-
51+
export type PetCallingCode =
52+
(typeof PetCallingCode)[keyof typeof PetCallingCode];
5753

5854
// eslint-disable-next-line @typescript-eslint/no-redeclare
5955
export const PetCallingCode = {
@@ -86,60 +82,53 @@ export interface Pet {
8682
tag?: string | null;
8783
}
8884

89-
90-
91-
92-
93-
/**
85+
/**
9486
* @summary List all pets
9587
*/
9688
export const listPets = <TData = AxiosResponse<PetsArray>>(
97-
params?: ListPetsParams, options?: AxiosRequestConfig
98-
): Promise<TData> => {
99-
return axios.get(
100-
`/pets`,{
89+
params?: ListPetsParams,
90+
options?: AxiosRequestConfig,
91+
): Promise<TData> => {
92+
return axios.get(`/pets`, {
10193
...options,
102-
params: {...params, ...options?.params},}
103-
);
104-
}
94+
params: { ...params, ...options?.params },
95+
});
96+
};
10597

10698
/**
10799
* @summary Create a pet
108100
*/
109101
export const createPets = <TData = AxiosResponse<void>>(
110-
createPetsBody: CreatePetsBody, options?: AxiosRequestConfig
111-
): Promise<TData> => {
112-
return axios.post(
113-
`/pets`,
114-
createPetsBody,options
115-
);
116-
}
102+
createPetsBody: CreatePetsBody,
103+
options?: AxiosRequestConfig,
104+
): Promise<TData> => {
105+
return axios.post(`/pets`, createPetsBody, options);
106+
};
117107

118108
/**
119109
* @summary List all pets as nested array
120110
*/
121111
export const listPetsNestedArray = <TData = AxiosResponse<PetsNestedArray>>(
122-
params?: ListPetsNestedArrayParams, options?: AxiosRequestConfig
123-
): Promise<TData> => {
124-
return axios.get(
125-
`/pets-nested-array`,{
112+
params?: ListPetsNestedArrayParams,
113+
options?: AxiosRequestConfig,
114+
): Promise<TData> => {
115+
return axios.get(`/pets-nested-array`, {
126116
...options,
127-
params: {...params, ...options?.params},}
128-
);
129-
}
117+
params: { ...params, ...options?.params },
118+
});
119+
};
130120

131121
/**
132122
* @summary Info for a specific pet
133123
*/
134124
export const showPetById = <TData = AxiosResponse<Pet>>(
135-
petId: string, options?: AxiosRequestConfig
136-
): Promise<TData> => {
137-
return axios.get(
138-
`/pets/${petId}`,options
139-
);
140-
}
125+
petId: string,
126+
options?: AxiosRequestConfig,
127+
): Promise<TData> => {
128+
return axios.get(`/pets/${petId}`, options);
129+
};
141130

142-
export type ListPetsResult = AxiosResponse<PetsArray>
143-
export type CreatePetsResult = AxiosResponse<void>
144-
export type ListPetsNestedArrayResult = AxiosResponse<PetsNestedArray>
145-
export type ShowPetByIdResult = AxiosResponse<Pet>
131+
export type ListPetsResult = AxiosResponse<PetsArray>;
132+
export type CreatePetsResult = AxiosResponse<void>;
133+
export type ListPetsNestedArrayResult = AxiosResponse<PetsNestedArray>;
134+
export type ShowPetByIdResult = AxiosResponse<Pet>;

‎samples/basic/api/endpoints/petstoreFromFileSpecWithConfig.ts

+43-54
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,13 @@
44
* Swagger Petstore
55
* OpenAPI spec version: 1.0.0
66
*/
7-
import axios from 'axios'
8-
import type {
9-
AxiosRequestConfig,
10-
AxiosResponse
11-
} from 'axios'
7+
import axios from 'axios';
8+
import type { AxiosRequestConfig, AxiosResponse } from 'axios';
129
export type ListPetsNestedArrayParams = {
13-
/**
14-
* How many items to return at one time (max 100)
15-
*/
16-
limit?: string;
10+
/**
11+
* How many items to return at one time (max 100)
12+
*/
13+
limit?: string;
1714
};
1815

1916
export type CreatePetsBody = {
@@ -22,10 +19,10 @@ export type CreatePetsBody = {
2219
};
2320

2421
export type ListPetsParams = {
25-
/**
26-
* How many items to return at one time (max 100)
27-
*/
28-
limit?: string;
22+
/**
23+
* How many items to return at one time (max 100)
24+
*/
25+
limit?: string;
2926
};
3027

3128
export interface Error {
@@ -43,17 +40,16 @@ export interface PetsNestedArray {
4340
data?: Pet[];
4441
}
4542

46-
export type PetCountry = typeof PetCountry[keyof typeof PetCountry];
47-
43+
export type PetCountry = (typeof PetCountry)[keyof typeof PetCountry];
4844

4945
// eslint-disable-next-line @typescript-eslint/no-redeclare
5046
export const PetCountry = {
51-
'People\'s_Republic_of_China': 'People\'s Republic of China',
47+
"People's_Republic_of_China": "People's Republic of China",
5248
Uruguay: 'Uruguay',
5349
} as const;
5450

55-
export type PetCallingCode = typeof PetCallingCode[keyof typeof PetCallingCode];
56-
51+
export type PetCallingCode =
52+
(typeof PetCallingCode)[keyof typeof PetCallingCode];
5753

5854
// eslint-disable-next-line @typescript-eslint/no-redeclare
5955
export const PetCallingCode = {
@@ -86,60 +82,53 @@ export interface Pet {
8682
tag?: string | null;
8783
}
8884

89-
90-
91-
92-
93-
/**
85+
/**
9486
* @summary List all pets
9587
*/
9688
export const listPets = <TData = AxiosResponse<PetsArray>>(
97-
params?: ListPetsParams, options?: AxiosRequestConfig
98-
): Promise<TData> => {
99-
return axios.get(
100-
`/pets`,{
89+
params?: ListPetsParams,
90+
options?: AxiosRequestConfig,
91+
): Promise<TData> => {
92+
return axios.get(`/pets`, {
10193
...options,
102-
params: {...params, ...options?.params},}
103-
);
104-
}
94+
params: { ...params, ...options?.params },
95+
});
96+
};
10597

10698
/**
10799
* @summary Create a pet
108100
*/
109101
export const createPets = <TData = AxiosResponse<void>>(
110-
createPetsBody: CreatePetsBody, options?: AxiosRequestConfig
111-
): Promise<TData> => {
112-
return axios.post(
113-
`/pets`,
114-
createPetsBody,options
115-
);
116-
}
102+
createPetsBody: CreatePetsBody,
103+
options?: AxiosRequestConfig,
104+
): Promise<TData> => {
105+
return axios.post(`/pets`, createPetsBody, options);
106+
};
117107

118108
/**
119109
* @summary List all pets as nested array
120110
*/
121111
export const listPetsNestedArray = <TData = AxiosResponse<PetsNestedArray>>(
122-
params?: ListPetsNestedArrayParams, options?: AxiosRequestConfig
123-
): Promise<TData> => {
124-
return axios.get(
125-
`/pets-nested-array`,{
112+
params?: ListPetsNestedArrayParams,
113+
options?: AxiosRequestConfig,
114+
): Promise<TData> => {
115+
return axios.get(`/pets-nested-array`, {
126116
...options,
127-
params: {...params, ...options?.params},}
128-
);
129-
}
117+
params: { ...params, ...options?.params },
118+
});
119+
};
130120

131121
/**
132122
* @summary Info for a specific pet
133123
*/
134124
export const showPetById = <TData = AxiosResponse<Pet>>(
135-
petId: string, options?: AxiosRequestConfig
136-
): Promise<TData> => {
137-
return axios.get(
138-
`/pets/${petId}`,options
139-
);
140-
}
125+
petId: string,
126+
options?: AxiosRequestConfig,
127+
): Promise<TData> => {
128+
return axios.get(`/pets/${petId}`, options);
129+
};
141130

142-
export type ListPetsResult = AxiosResponse<PetsArray>
143-
export type CreatePetsResult = AxiosResponse<void>
144-
export type ListPetsNestedArrayResult = AxiosResponse<PetsNestedArray>
145-
export type ShowPetByIdResult = AxiosResponse<Pet>
131+
export type ListPetsResult = AxiosResponse<PetsArray>;
132+
export type CreatePetsResult = AxiosResponse<void>;
133+
export type ListPetsNestedArrayResult = AxiosResponse<PetsNestedArray>;
134+
export type ShowPetByIdResult = AxiosResponse<Pet>;

‎samples/basic/api/endpoints/petstoreFromFileSpecWithTransformer.ts

+177-121
Original file line numberDiff line numberDiff line change
@@ -4,175 +4,231 @@
44
* Swagger Petstore
55
* OpenAPI spec version: 1.0.0
66
*/
7-
import axios from 'axios'
8-
import type {
9-
AxiosRequestConfig,
10-
AxiosResponse
11-
} from 'axios'
7+
import axios from 'axios';
8+
import type { AxiosRequestConfig, AxiosResponse } from 'axios';
129
import type {
1310
CreatePetsBody,
1411
ListPetsNestedArrayParams,
15-
ListPetsParams
16-
} from '../model'
17-
import {
18-
faker
19-
} from '@faker-js/faker'
20-
import {
21-
HttpResponse,
22-
delay,
23-
http
24-
} from 'msw'
25-
import type {
26-
Pet,
27-
PetsArray,
28-
PetsNestedArray
29-
} from '../model'
12+
ListPetsParams,
13+
} from '../model';
14+
import { faker } from '@faker-js/faker';
15+
import { HttpResponse, delay, http } from 'msw';
16+
import type { Pet, PetsArray, PetsNestedArray } from '../model';
3017
import listPetsMutator from '../mutator/response-type';
3118

32-
33-
34-
35-
/**
19+
/**
3620
* @summary List all pets
3721
*/
38-
export const listPets = (
39-
params?: ListPetsParams,
40-
version: number = 1,
41-
) => {
42-
return listPetsMutator<PetsArray>(
43-
{url: `/v${version}/pets`, method: 'GET',
44-
params
45-
},
46-
);
47-
}
48-
22+
export const listPets = (params?: ListPetsParams, version: number = 1) => {
23+
return listPetsMutator<PetsArray>({
24+
url: `/v${version}/pets`,
25+
method: 'GET',
26+
params,
27+
});
28+
};
29+
4930
/**
5031
* @summary Create a pet
5132
*/
5233
export const createPets = <TData = AxiosResponse<void>>(
53-
createPetsBody: CreatePetsBody,
54-
version: number = 1, options?: AxiosRequestConfig
55-
): Promise<TData> => {
56-
return axios.post(
57-
`/v${version}/pets`,
58-
createPetsBody,options
59-
);
60-
}
34+
createPetsBody: CreatePetsBody,
35+
version: number = 1,
36+
options?: AxiosRequestConfig,
37+
): Promise<TData> => {
38+
return axios.post(`/v${version}/pets`, createPetsBody, options);
39+
};
6140

6241
/**
6342
* @summary List all pets as nested array
6443
*/
6544
export const listPetsNestedArray = <TData = AxiosResponse<PetsNestedArray>>(
66-
params?: ListPetsNestedArrayParams,
67-
version: number = 1, options?: AxiosRequestConfig
68-
): Promise<TData> => {
69-
return axios.get(
70-
`/v${version}/pets-nested-array`,{
45+
params?: ListPetsNestedArrayParams,
46+
version: number = 1,
47+
options?: AxiosRequestConfig,
48+
): Promise<TData> => {
49+
return axios.get(`/v${version}/pets-nested-array`, {
7150
...options,
72-
params: {...params, ...options?.params},}
73-
);
74-
}
51+
params: { ...params, ...options?.params },
52+
});
53+
};
7554

7655
/**
7756
* @summary Info for a specific pet
7857
*/
7958
export const showPetById = <TData = AxiosResponse<Pet>>(
80-
petId: string,
81-
version: number = 1, options?: AxiosRequestConfig
82-
): Promise<TData> => {
83-
return axios.get(
84-
`/v${version}/pets/${petId}`,options
85-
);
86-
}
87-
59+
petId: string,
60+
version: number = 1,
61+
options?: AxiosRequestConfig,
62+
): Promise<TData> => {
63+
return axios.get(`/v${version}/pets/${petId}`, options);
64+
};
8865

8966
type AwaitedInput<T> = PromiseLike<T> | T;
9067

91-
type Awaited<O> = O extends AwaitedInput<infer T> ? T : never;
92-
93-
export type ListPetsResult = NonNullable<Awaited<ReturnType<typeof listPets>>>
94-
export type CreatePetsResult = AxiosResponse<void>
95-
export type ListPetsNestedArrayResult = AxiosResponse<PetsNestedArray>
96-
export type ShowPetByIdResult = AxiosResponse<Pet>
97-
98-
99-
export const getListPetsResponseMock = (): PetsArray => (Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() => ({age: faker.helpers.arrayElement([faker.number.int({min: 0, max: 30}), undefined]), callingCode: faker.helpers.arrayElement([faker.helpers.arrayElement(['+33','+420','+33'] as const), undefined]), country: faker.helpers.arrayElement([faker.helpers.arrayElement(['People\'s Republic of China','Uruguay'] as const), undefined]), email: faker.helpers.arrayElement([faker.internet.email(), undefined]), id: faker.number.int({min: undefined, max: undefined}), name: 'jon', tag: faker.helpers.arrayElement(['jon', null])})))
100-
101-
export const getListPetsNestedArrayResponseMock = (overrideResponse: Partial< PetsNestedArray > = {}): PetsNestedArray => ({data: faker.helpers.arrayElement([Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() => ({age: faker.helpers.arrayElement([faker.number.int({min: 0, max: 30}), undefined]), callingCode: faker.helpers.arrayElement([faker.helpers.arrayElement(['+33','+420','+33'] as const), undefined]), country: faker.helpers.arrayElement([faker.helpers.arrayElement(['People\'s Republic of China','Uruguay'] as const), undefined]), email: faker.helpers.arrayElement([faker.internet.email(), undefined]), id: faker.number.int({min: undefined, max: undefined}), name: 'jon', tag: faker.helpers.arrayElement(['jon', null])})), undefined]), ...overrideResponse})
102-
103-
export const getShowPetByIdResponseMock = () => ((() => ({
104-
id: faker.number.int({ min: 1, max: 99 }),
105-
name: faker.person.firstName(),
106-
tag: faker.helpers.arrayElement([
107-
faker.word.sample(),
108-
void 0
109-
])
110-
}))())
111-
112-
113-
export const getListPetsMockHandler = (overrideResponse?: PetsArray | ((info: Parameters<Parameters<typeof http.get>[1]>[0]) => PetsArray)) => {
68+
type Awaited<O> = O extends AwaitedInput<infer T> ? T : never;
69+
70+
export type ListPetsResult = NonNullable<Awaited<ReturnType<typeof listPets>>>;
71+
export type CreatePetsResult = AxiosResponse<void>;
72+
export type ListPetsNestedArrayResult = AxiosResponse<PetsNestedArray>;
73+
export type ShowPetByIdResult = AxiosResponse<Pet>;
74+
75+
export const getListPetsResponseMock = (): PetsArray =>
76+
Array.from(
77+
{ length: faker.number.int({ min: 1, max: 10 }) },
78+
(_, i) => i + 1,
79+
).map(() => ({
80+
age: faker.helpers.arrayElement([
81+
faker.number.int({ min: 0, max: 30 }),
82+
undefined,
83+
]),
84+
callingCode: faker.helpers.arrayElement([
85+
faker.helpers.arrayElement(['+33', '+420', '+33'] as const),
86+
undefined,
87+
]),
88+
country: faker.helpers.arrayElement([
89+
faker.helpers.arrayElement([
90+
"People's Republic of China",
91+
'Uruguay',
92+
] as const),
93+
undefined,
94+
]),
95+
email: faker.helpers.arrayElement([faker.internet.email(), undefined]),
96+
id: faker.number.int({ min: undefined, max: undefined }),
97+
name: 'jon',
98+
tag: faker.helpers.arrayElement(['jon', null]),
99+
}));
100+
101+
export const getListPetsNestedArrayResponseMock = (
102+
overrideResponse: Partial<PetsNestedArray> = {},
103+
): PetsNestedArray => ({
104+
data: faker.helpers.arrayElement([
105+
Array.from(
106+
{ length: faker.number.int({ min: 1, max: 10 }) },
107+
(_, i) => i + 1,
108+
).map(() => ({
109+
age: faker.helpers.arrayElement([
110+
faker.number.int({ min: 0, max: 30 }),
111+
undefined,
112+
]),
113+
callingCode: faker.helpers.arrayElement([
114+
faker.helpers.arrayElement(['+33', '+420', '+33'] as const),
115+
undefined,
116+
]),
117+
country: faker.helpers.arrayElement([
118+
faker.helpers.arrayElement([
119+
"People's Republic of China",
120+
'Uruguay',
121+
] as const),
122+
undefined,
123+
]),
124+
email: faker.helpers.arrayElement([faker.internet.email(), undefined]),
125+
id: faker.number.int({ min: undefined, max: undefined }),
126+
name: 'jon',
127+
tag: faker.helpers.arrayElement(['jon', null]),
128+
})),
129+
undefined,
130+
]),
131+
...overrideResponse,
132+
});
133+
134+
export const getShowPetByIdResponseMock = () =>
135+
(() => ({
136+
id: faker.number.int({ min: 1, max: 99 }),
137+
name: faker.person.firstName(),
138+
tag: faker.helpers.arrayElement([faker.word.sample(), void 0]),
139+
}))();
140+
141+
export const getListPetsMockHandler = (
142+
overrideResponse?:
143+
| PetsArray
144+
| ((info: Parameters<Parameters<typeof http.get>[1]>[0]) => PetsArray),
145+
) => {
114146
return http.get('*/v:version/pets', async (info) => {
115147
await delay(1000);
116-
return new HttpResponse(JSON.stringify(overrideResponse !== undefined
117-
? (typeof overrideResponse === "function" ? overrideResponse(info) : overrideResponse)
118-
: getListPetsResponseMock()),
148+
return new HttpResponse(
149+
JSON.stringify(
150+
overrideResponse !== undefined
151+
? typeof overrideResponse === 'function'
152+
? overrideResponse(info)
153+
: overrideResponse
154+
: getListPetsResponseMock(),
155+
),
119156
{
120157
status: 200,
121158
headers: {
122159
'Content-Type': 'application/json',
123-
}
124-
}
125-
)
126-
})
127-
}
160+
},
161+
},
162+
);
163+
});
164+
};
128165

129166
export const getCreatePetsMockHandler = () => {
130167
return http.post('*/v:version/pets', async () => {
131168
await delay(1000);
132-
return new HttpResponse(null,
133-
{
134-
status: 200,
135-
headers: {
136-
'Content-Type': 'application/json',
137-
}
138-
}
139-
)
140-
})
141-
}
142-
143-
export const getListPetsNestedArrayMockHandler = (overrideResponse?: PetsNestedArray | ((info: Parameters<Parameters<typeof http.get>[1]>[0]) => PetsNestedArray)) => {
169+
return new HttpResponse(null, {
170+
status: 200,
171+
headers: {
172+
'Content-Type': 'application/json',
173+
},
174+
});
175+
});
176+
};
177+
178+
export const getListPetsNestedArrayMockHandler = (
179+
overrideResponse?:
180+
| PetsNestedArray
181+
| ((
182+
info: Parameters<Parameters<typeof http.get>[1]>[0],
183+
) => PetsNestedArray),
184+
) => {
144185
return http.get('*/v:version/pets-nested-array', async (info) => {
145186
await delay(1000);
146-
return new HttpResponse(JSON.stringify(overrideResponse !== undefined
147-
? (typeof overrideResponse === "function" ? overrideResponse(info) : overrideResponse)
148-
: getListPetsNestedArrayResponseMock()),
187+
return new HttpResponse(
188+
JSON.stringify(
189+
overrideResponse !== undefined
190+
? typeof overrideResponse === 'function'
191+
? overrideResponse(info)
192+
: overrideResponse
193+
: getListPetsNestedArrayResponseMock(),
194+
),
149195
{
150196
status: 200,
151197
headers: {
152198
'Content-Type': 'application/json',
153-
}
154-
}
155-
)
156-
})
157-
}
158-
159-
export const getShowPetByIdMockHandler = (overrideResponse?: Pet | ((info: Parameters<Parameters<typeof http.get>[1]>[0]) => Pet)) => {
199+
},
200+
},
201+
);
202+
});
203+
};
204+
205+
export const getShowPetByIdMockHandler = (
206+
overrideResponse?:
207+
| Pet
208+
| ((info: Parameters<Parameters<typeof http.get>[1]>[0]) => Pet),
209+
) => {
160210
return http.get('*/v:version/pets/:petId', async (info) => {
161211
await delay(1000);
162-
return new HttpResponse(JSON.stringify(overrideResponse !== undefined
163-
? (typeof overrideResponse === "function" ? overrideResponse(info) : overrideResponse)
164-
: getShowPetByIdResponseMock()),
212+
return new HttpResponse(
213+
JSON.stringify(
214+
overrideResponse !== undefined
215+
? typeof overrideResponse === 'function'
216+
? overrideResponse(info)
217+
: overrideResponse
218+
: getShowPetByIdResponseMock(),
219+
),
165220
{
166221
status: 200,
167222
headers: {
168223
'Content-Type': 'application/json',
169-
}
170-
}
171-
)
172-
})
173-
}
224+
},
225+
},
226+
);
227+
});
228+
};
174229
export const getSwaggerPetstoreMock = () => [
175230
getListPetsMockHandler(),
176231
getCreatePetsMockHandler(),
177232
getListPetsNestedArrayMockHandler(),
178-
getShowPetByIdMockHandler()]
233+
getShowPetByIdMockHandler(),
234+
];

‎samples/basic/api/model/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@ export * from './petCallingCode';
1414
export * from './petCountry';
1515
export * from './pets';
1616
export * from './petsArray';
17-
export * from './petsNestedArray';
17+
export * from './petsNestedArray';

‎samples/basic/api/model/listPetsNestedArrayParams.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
*/
77

88
export type ListPetsNestedArrayParams = {
9-
/**
10-
* How many items to return at one time (max 100)
11-
*/
12-
limit?: string;
9+
/**
10+
* How many items to return at one time (max 100)
11+
*/
12+
limit?: string;
1313
};

‎samples/basic/api/model/listPetsParams.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
*/
77

88
export type ListPetsParams = {
9-
/**
10-
* How many items to return at one time (max 100)
11-
*/
12-
limit?: string;
9+
/**
10+
* How many items to return at one time (max 100)
11+
*/
12+
limit?: string;
1313
};

‎samples/basic/api/model/petCallingCode.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
* OpenAPI spec version: 1.0.0
66
*/
77

8-
export type PetCallingCode = typeof PetCallingCode[keyof typeof PetCallingCode];
9-
8+
export type PetCallingCode =
9+
(typeof PetCallingCode)[keyof typeof PetCallingCode];
1010

1111
// eslint-disable-next-line @typescript-eslint/no-redeclare
1212
export const PetCallingCode = {

‎samples/basic/api/model/petCountry.ts

+2-3
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,10 @@
55
* OpenAPI spec version: 1.0.0
66
*/
77

8-
export type PetCountry = typeof PetCountry[keyof typeof PetCountry];
9-
8+
export type PetCountry = (typeof PetCountry)[keyof typeof PetCountry];
109

1110
// eslint-disable-next-line @typescript-eslint/no-redeclare
1211
export const PetCountry = {
13-
'People\'s_Republic_of_China': 'People\'s Republic of China',
12+
"People's_Republic_of_China": "People's Republic of China",
1413
Uruguay: 'Uruguay',
1514
} as const;

‎samples/react-query/form-url-encoded/endpoints.ts

+260-210
Large diffs are not rendered by default.

‎samples/react-query/form-url-encoded/models/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@ export * from './pet';
1313
export * from './petCallingCode';
1414
export * from './petCountry';
1515
export * from './petsArray';
16-
export * from './petsNestedArray';
16+
export * from './petsNestedArray';

‎samples/react-query/form-url-encoded/models/listPetsNestedArrayParams.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
*/
77

88
export type ListPetsNestedArrayParams = {
9-
/**
10-
* How many items to return at one time (max 100)
11-
*/
12-
limit?: string;
9+
/**
10+
* How many items to return at one time (max 100)
11+
*/
12+
limit?: string;
1313
};

‎samples/react-query/form-url-encoded/models/listPetsParams.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
*/
77

88
export type ListPetsParams = {
9-
/**
10-
* How many items to return at one time (max 100)
11-
*/
12-
limit?: string;
9+
/**
10+
* How many items to return at one time (max 100)
11+
*/
12+
limit?: string;
1313
};

‎samples/react-query/form-url-encoded/models/petCallingCode.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
* OpenAPI spec version: 1.0.0
66
*/
77

8-
export type PetCallingCode = typeof PetCallingCode[keyof typeof PetCallingCode];
9-
8+
export type PetCallingCode =
9+
(typeof PetCallingCode)[keyof typeof PetCallingCode];
1010

1111
// eslint-disable-next-line @typescript-eslint/no-redeclare
1212
export const PetCallingCode = {

‎samples/react-query/form-url-encoded/models/petCountry.ts

+2-3
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,10 @@
55
* OpenAPI spec version: 1.0.0
66
*/
77

8-
export type PetCountry = typeof PetCountry[keyof typeof PetCountry];
9-
8+
export type PetCountry = (typeof PetCountry)[keyof typeof PetCountry];
109

1110
// eslint-disable-next-line @typescript-eslint/no-redeclare
1211
export const PetCountry = {
13-
'People\'s_Republic_of_China': 'People\'s Republic of China',
12+
"People's_Republic_of_China": "People's Republic of China",
1413
Uruguay: 'Uruguay',
1514
} as const;

0 commit comments

Comments
 (0)
Please sign in to comment.