Skip to content

Commit 1cc9e01

Browse files
authoredApr 12, 2024
fix: accumulate discriminator mapping keys (#1305)
* concatenate mapping keys * lint * refactor
1 parent e114594 commit 1cc9e01

File tree

11 files changed

+249
-276
lines changed

11 files changed

+249
-276
lines changed
 

‎packages/core/src/getters/discriminators.ts

+8-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { SchemasObject } from 'openapi3-ts/oas30';
1+
import { SchemaObject, SchemasObject } from 'openapi3-ts/oas30';
22
import { ContextSpecs } from '../types';
33
import { getRefInfo } from './ref';
44
import { pascal } from '../utils';
@@ -28,12 +28,17 @@ export const resolveDiscriminators = (
2828
if (!subTypeSchema) {
2929
continue;
3030
}
31-
31+
const property = subTypeSchema.properties?.[
32+
propertyName
33+
] as SchemaObject;
3234
subTypeSchema.properties = {
3335
...subTypeSchema.properties,
3436
[propertyName]: {
3537
type: 'string',
36-
enum: [mappingKey],
38+
enum: [
39+
...(property.enum ?? []),
40+
mappingKey,
41+
],
3742
},
3843
};
3944
subTypeSchema.required = [

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

+27-37
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,18 @@
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 CreatePetsBody = {
1310
name: string;
1411
tag: string;
1512
};
1613

1714
export type ListPetsParams = {
18-
/**
19-
* How many items to return at one time (max 100)
20-
*/
21-
limit?: string;
15+
/**
16+
* How many items to return at one time (max 100)
17+
*/
18+
limit?: string;
2219
};
2320

2421
export interface Error {
@@ -54,46 +51,39 @@ export interface Pet {
5451
*/
5552
export type Pets = Pet[];
5653

57-
58-
59-
60-
61-
/**
54+
/**
6255
* @summary List all pets
6356
*/
6457
export const listPets = <TData = AxiosResponse<Pets>>(
65-
params?: ListPetsParams, options?: AxiosRequestConfig
66-
): Promise<TData> => {
67-
return axios.get(
68-
`/pets`,{
58+
params?: ListPetsParams,
59+
options?: AxiosRequestConfig,
60+
): Promise<TData> => {
61+
return axios.get(`/pets`, {
6962
...options,
70-
params: {...params, ...options?.params},}
71-
);
72-
}
63+
params: { ...params, ...options?.params },
64+
});
65+
};
7366

7467
/**
7568
* @summary Create a pet
7669
*/
7770
export const createPets = <TData = AxiosResponse<void>>(
78-
createPetsBody: CreatePetsBody, options?: AxiosRequestConfig
79-
): Promise<TData> => {
80-
return axios.post(
81-
`/pets`,
82-
createPetsBody,options
83-
);
84-
}
71+
createPetsBody: CreatePetsBody,
72+
options?: AxiosRequestConfig,
73+
): Promise<TData> => {
74+
return axios.post(`/pets`, createPetsBody, options);
75+
};
8576

8677
/**
8778
* @summary Info for a specific pet
8879
*/
8980
export const showPetById = <TData = AxiosResponse<Pet>>(
90-
petId: string, options?: AxiosRequestConfig
91-
): Promise<TData> => {
92-
return axios.get(
93-
`/pets/${petId}`,options
94-
);
95-
}
81+
petId: string,
82+
options?: AxiosRequestConfig,
83+
): Promise<TData> => {
84+
return axios.get(`/pets/${petId}`, options);
85+
};
9686

97-
export type ListPetsResult = AxiosResponse<Pets>
98-
export type CreatePetsResult = AxiosResponse<void>
99-
export type ShowPetByIdResult = AxiosResponse<Pet>
87+
export type ListPetsResult = AxiosResponse<Pets>;
88+
export type CreatePetsResult = AxiosResponse<void>;
89+
export type ShowPetByIdResult = AxiosResponse<Pet>;

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

+27-37
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,18 @@
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 CreatePetsBody = {
1310
name: string;
1411
tag: string;
1512
};
1613

1714
export type ListPetsParams = {
18-
/**
19-
* How many items to return at one time (max 100)
20-
*/
21-
limit?: string;
15+
/**
16+
* How many items to return at one time (max 100)
17+
*/
18+
limit?: string;
2219
};
2320

2421
export interface Error {
@@ -54,46 +51,39 @@ export interface Pet {
5451
*/
5552
export type Pets = Pet[];
5653

57-
58-
59-
60-
61-
/**
54+
/**
6255
* @summary List all pets
6356
*/
6457
export const listPets = <TData = AxiosResponse<Pets>>(
65-
params?: ListPetsParams, options?: AxiosRequestConfig
66-
): Promise<TData> => {
67-
return axios.get(
68-
`/pets`,{
58+
params?: ListPetsParams,
59+
options?: AxiosRequestConfig,
60+
): Promise<TData> => {
61+
return axios.get(`/pets`, {
6962
...options,
70-
params: {...params, ...options?.params},}
71-
);
72-
}
63+
params: { ...params, ...options?.params },
64+
});
65+
};
7366

7467
/**
7568
* @summary Create a pet
7669
*/
7770
export const createPets = <TData = AxiosResponse<void>>(
78-
createPetsBody: CreatePetsBody, options?: AxiosRequestConfig
79-
): Promise<TData> => {
80-
return axios.post(
81-
`/pets`,
82-
createPetsBody,options
83-
);
84-
}
71+
createPetsBody: CreatePetsBody,
72+
options?: AxiosRequestConfig,
73+
): Promise<TData> => {
74+
return axios.post(`/pets`, createPetsBody, options);
75+
};
8576

8677
/**
8778
* @summary Info for a specific pet
8879
*/
8980
export const showPetById = <TData = AxiosResponse<Pet>>(
90-
petId: string, options?: AxiosRequestConfig
91-
): Promise<TData> => {
92-
return axios.get(
93-
`/pets/${petId}`,options
94-
);
95-
}
81+
petId: string,
82+
options?: AxiosRequestConfig,
83+
): Promise<TData> => {
84+
return axios.get(`/pets/${petId}`, options);
85+
};
9686

97-
export type ListPetsResult = AxiosResponse<Pets>
98-
export type CreatePetsResult = AxiosResponse<void>
99-
export type ShowPetByIdResult = AxiosResponse<Pet>
87+
export type ListPetsResult = AxiosResponse<Pets>;
88+
export type CreatePetsResult = AxiosResponse<void>;
89+
export type ShowPetByIdResult = AxiosResponse<Pet>;

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

+82-93
Original file line numberDiff line numberDiff line change
@@ -4,135 +4,124 @@
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'
12-
import type {
13-
CreatePetsBody,
14-
ListPetsParams
15-
} from '../model'
16-
import {
17-
faker
18-
} from '@faker-js/faker'
19-
import {
20-
HttpResponse,
21-
delay,
22-
http
23-
} from 'msw'
24-
import type {
25-
Pet,
26-
Pets
27-
} from '../model'
7+
import axios from 'axios';
8+
import type { AxiosRequestConfig, AxiosResponse } from 'axios';
9+
import type { CreatePetsBody, ListPetsParams } from '../model';
10+
import { faker } from '@faker-js/faker';
11+
import { HttpResponse, delay, http } from 'msw';
12+
import type { Pet, Pets } from '../model';
2813
import listPetsMutator from '../mutator/response-type';
2914

30-
31-
32-
33-
/**
15+
/**
3416
* @summary List all pets
3517
*/
36-
export const listPets = (
37-
params?: ListPetsParams,
38-
version: number = 1,
39-
) => {
40-
return listPetsMutator<Pets>(
41-
{url: `/v${version}/pets`, method: 'GET',
42-
params
43-
},
44-
);
45-
}
46-
18+
export const listPets = (params?: ListPetsParams, version: number = 1) => {
19+
return listPetsMutator<Pets>({
20+
url: `/v${version}/pets`,
21+
method: 'GET',
22+
params,
23+
});
24+
};
25+
4726
/**
4827
* @summary Create a pet
4928
*/
5029
export const createPets = <TData = AxiosResponse<void>>(
51-
createPetsBody: CreatePetsBody,
52-
version: number = 1, options?: AxiosRequestConfig
53-
): Promise<TData> => {
54-
return axios.post(
55-
`/v${version}/pets`,
56-
createPetsBody,options
57-
);
58-
}
30+
createPetsBody: CreatePetsBody,
31+
version: number = 1,
32+
options?: AxiosRequestConfig,
33+
): Promise<TData> => {
34+
return axios.post(`/v${version}/pets`, createPetsBody, options);
35+
};
5936

6037
/**
6138
* @summary Info for a specific pet
6239
*/
6340
export const showPetById = <TData = AxiosResponse<Pet>>(
64-
petId: string,
65-
version: number = 1, options?: AxiosRequestConfig
66-
): Promise<TData> => {
67-
return axios.get(
68-
`/v${version}/pets/${petId}`,options
69-
);
70-
}
71-
41+
petId: string,
42+
version: number = 1,
43+
options?: AxiosRequestConfig,
44+
): Promise<TData> => {
45+
return axios.get(`/v${version}/pets/${petId}`, options);
46+
};
7247

7348
type AwaitedInput<T> = PromiseLike<T> | T;
7449

75-
type Awaited<O> = O extends AwaitedInput<infer T> ? T : never;
76-
77-
export type ListPetsResult = NonNullable<Awaited<ReturnType<typeof listPets>>>
78-
export type CreatePetsResult = AxiosResponse<void>
79-
export type ShowPetByIdResult = AxiosResponse<Pet>
80-
81-
82-
export const getListPetsResponseMock = (overrideResponse: any = {}): Pets => (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]), id: faker.number.int({min: undefined, max: undefined}), name: 'jon', tag: faker.helpers.arrayElement(['jon', null]), ...overrideResponse})))
83-
84-
export const getShowPetByIdResponseMock = () => ((() => ({
85-
id: faker.number.int({ min: 1, max: 99 }),
86-
name: faker.person.firstName(),
87-
tag: faker.helpers.arrayElement([
88-
faker.word.sample(),
89-
void 0
90-
])
91-
}))())
92-
50+
type Awaited<O> = O extends AwaitedInput<infer T> ? T : never;
51+
52+
export type ListPetsResult = NonNullable<Awaited<ReturnType<typeof listPets>>>;
53+
export type CreatePetsResult = AxiosResponse<void>;
54+
export type ShowPetByIdResult = AxiosResponse<Pet>;
55+
56+
export const getListPetsResponseMock = (overrideResponse: any = {}): Pets =>
57+
Array.from(
58+
{ length: faker.number.int({ min: 1, max: 10 }) },
59+
(_, i) => i + 1,
60+
).map(() => ({
61+
age: faker.helpers.arrayElement([
62+
faker.number.int({ min: 0, max: 30 }),
63+
undefined,
64+
]),
65+
id: faker.number.int({ min: undefined, max: undefined }),
66+
name: 'jon',
67+
tag: faker.helpers.arrayElement(['jon', null]),
68+
...overrideResponse,
69+
}));
70+
71+
export const getShowPetByIdResponseMock = () =>
72+
(() => ({
73+
id: faker.number.int({ min: 1, max: 99 }),
74+
name: faker.person.firstName(),
75+
tag: faker.helpers.arrayElement([faker.word.sample(), void 0]),
76+
}))();
9377

9478
export const getListPetsMockHandler = (overrideResponse?: Pets) => {
9579
return http.get('*/v:version/pets', async () => {
9680
await delay(1000);
97-
return new HttpResponse(JSON.stringify(overrideResponse ? overrideResponse : getListPetsResponseMock()),
81+
return new HttpResponse(
82+
JSON.stringify(
83+
overrideResponse ? overrideResponse : getListPetsResponseMock(),
84+
),
9885
{
9986
status: 200,
10087
headers: {
10188
'Content-Type': 'application/json',
102-
}
103-
}
104-
)
105-
})
106-
}
89+
},
90+
},
91+
);
92+
});
93+
};
10794

10895
export const getCreatePetsMockHandler = () => {
10996
return http.post('*/v:version/pets', async () => {
11097
await delay(1000);
111-
return new HttpResponse(null,
112-
{
113-
status: 200,
114-
headers: {
115-
'Content-Type': 'application/json',
116-
}
117-
}
118-
)
119-
})
120-
}
98+
return new HttpResponse(null, {
99+
status: 200,
100+
headers: {
101+
'Content-Type': 'application/json',
102+
},
103+
});
104+
});
105+
};
121106

122107
export const getShowPetByIdMockHandler = (overrideResponse?: Pet) => {
123108
return http.get('*/v:version/pets/:petId', async () => {
124109
await delay(1000);
125-
return new HttpResponse(JSON.stringify(overrideResponse ? overrideResponse : getShowPetByIdResponseMock()),
110+
return new HttpResponse(
111+
JSON.stringify(
112+
overrideResponse ? overrideResponse : getShowPetByIdResponseMock(),
113+
),
126114
{
127115
status: 200,
128116
headers: {
129117
'Content-Type': 'application/json',
130-
}
131-
}
132-
)
133-
})
134-
}
118+
},
119+
},
120+
);
121+
});
122+
};
135123
export const getSwaggerPetstoreMock = () => [
136124
getListPetsMockHandler(),
137125
getCreatePetsMockHandler(),
138-
getShowPetByIdMockHandler()]
126+
getShowPetByIdMockHandler(),
127+
];

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ export * from './createPetsBody';
99
export * from './error';
1010
export * from './listPetsParams';
1111
export * from './pet';
12-
export * from './pets';
12+
export * from './pets';

‎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/react-query/basic/src/api/endpoints/petstoreFromFileSpecWithTransformer.ts

+24-26
Original file line numberDiff line numberDiff line change
@@ -38,34 +38,32 @@ import { customInstance } from '../mutator/custom-instance';
3838
import type { ErrorType } from '../mutator/custom-instance';
3939

4040
type IsAny<T> = 0 extends 1 & T ? true : false;
41-
type IsUnknown<T> = IsAny<T> extends true
42-
? false
43-
: unknown extends T
44-
? true
45-
: false;
41+
type IsUnknown<T> =
42+
IsAny<T> extends true ? false : unknown extends T ? true : false;
4643
type Primitive = string | number | boolean | bigint | symbol | undefined | null;
4744
type isBuiltin = Primitive | Function | Date | Error | RegExp;
48-
type NonReadonly<T> = T extends Exclude<isBuiltin, Error>
49-
? T
50-
: T extends Map<infer Key, infer Value>
51-
? Map<NonReadonly<Key>, NonReadonly<Value>>
52-
: T extends ReadonlyMap<infer Key, infer Value>
53-
? Map<NonReadonly<Key>, NonReadonly<Value>>
54-
: T extends WeakMap<infer Key, infer Value>
55-
? WeakMap<NonReadonly<Key>, NonReadonly<Value>>
56-
: T extends Set<infer Values>
57-
? Set<NonReadonly<Values>>
58-
: T extends ReadonlySet<infer Values>
59-
? Set<NonReadonly<Values>>
60-
: T extends WeakSet<infer Values>
61-
? WeakSet<NonReadonly<Values>>
62-
: T extends Promise<infer Value>
63-
? Promise<NonReadonly<Value>>
64-
: T extends {}
65-
? { -readonly [Key in keyof T]: NonReadonly<T[Key]> }
66-
: IsUnknown<T> extends true
67-
? unknown
68-
: T;
45+
type NonReadonly<T> =
46+
T extends Exclude<isBuiltin, Error>
47+
? T
48+
: T extends Map<infer Key, infer Value>
49+
? Map<NonReadonly<Key>, NonReadonly<Value>>
50+
: T extends ReadonlyMap<infer Key, infer Value>
51+
? Map<NonReadonly<Key>, NonReadonly<Value>>
52+
: T extends WeakMap<infer Key, infer Value>
53+
? WeakMap<NonReadonly<Key>, NonReadonly<Value>>
54+
: T extends Set<infer Values>
55+
? Set<NonReadonly<Values>>
56+
: T extends ReadonlySet<infer Values>
57+
? Set<NonReadonly<Values>>
58+
: T extends WeakSet<infer Values>
59+
? WeakSet<NonReadonly<Values>>
60+
: T extends Promise<infer Value>
61+
? Promise<NonReadonly<Value>>
62+
: T extends {}
63+
? { -readonly [Key in keyof T]: NonReadonly<T[Key]> }
64+
: IsUnknown<T> extends true
65+
? unknown
66+
: T;
6967

7068
type AwaitedInput<T> = PromiseLike<T> | T;
7169

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

+71-69
Original file line numberDiff line numberDiff line change
@@ -4,86 +4,88 @@
44
* Swagger Petstore
55
* OpenAPI spec version: 1.0.0
66
*/
7-
import {
8-
useMutation
9-
} from 'react-query'
7+
import { useMutation } from 'react-query';
108
import type {
119
MutationFunction,
1210
UseMutationOptions,
13-
UseMutationResult
14-
} from 'react-query'
15-
import type {
16-
CreatePetsBody,
17-
Error,
18-
Pet
19-
} from './models'
11+
UseMutationResult,
12+
} from 'react-query';
13+
import type { CreatePetsBody, Error, Pet } from './models';
2014
import { customInstance } from './custom-instance';
2115

22-
2316
type AwaitedInput<T> = PromiseLike<T> | T;
2417

25-
type Awaited<O> = O extends AwaitedInput<infer T> ? T : never;
26-
27-
18+
type Awaited<O> = O extends AwaitedInput<infer T> ? T : never;
2819

2920
/**
3021
* @summary Create a pet
3122
*/
32-
export const createPets = (
33-
createPetsBody: CreatePetsBody,
34-
) => {
35-
36-
const formUrlEncoded = new URLSearchParams();
37-
formUrlEncoded.append('name', createPetsBody.name)
38-
formUrlEncoded.append('tag', createPetsBody.tag)
39-
40-
return customInstance<Pet>(
41-
{url: `/pets`, method: 'POST',
42-
headers: {'Content-Type': 'application/x-www-form-urlencoded', },
43-
data: formUrlEncoded
44-
},
45-
);
46-
}
47-
48-
49-
50-
export const getCreatePetsMutationOptions = <TError = Error,
51-
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof createPets>>, TError,{data: CreatePetsBody}, TContext>, }
52-
): UseMutationOptions<Awaited<ReturnType<typeof createPets>>, TError,{data: CreatePetsBody}, TContext> => {
53-
const {mutation: mutationOptions} = options ?? {};
54-
55-
56-
23+
export const createPets = (createPetsBody: CreatePetsBody) => {
24+
const formUrlEncoded = new URLSearchParams();
25+
formUrlEncoded.append('name', createPetsBody.name);
26+
formUrlEncoded.append('tag', createPetsBody.tag);
27+
28+
return customInstance<Pet>({
29+
url: `/pets`,
30+
method: 'POST',
31+
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
32+
data: formUrlEncoded,
33+
});
34+
};
35+
36+
export const getCreatePetsMutationOptions = <
37+
TError = Error,
38+
TContext = unknown,
39+
>(options?: {
40+
mutation?: UseMutationOptions<
41+
Awaited<ReturnType<typeof createPets>>,
42+
TError,
43+
{ data: CreatePetsBody },
44+
TContext
45+
>;
46+
}): UseMutationOptions<
47+
Awaited<ReturnType<typeof createPets>>,
48+
TError,
49+
{ data: CreatePetsBody },
50+
TContext
51+
> => {
52+
const { mutation: mutationOptions } = options ?? {};
53+
54+
const mutationFn: MutationFunction<
55+
Awaited<ReturnType<typeof createPets>>,
56+
{ data: CreatePetsBody }
57+
> = (props) => {
58+
const { data } = props ?? {};
59+
60+
return createPets(data);
61+
};
62+
63+
return { mutationFn, ...mutationOptions };
64+
};
65+
66+
export type CreatePetsMutationResult = NonNullable<
67+
Awaited<ReturnType<typeof createPets>>
68+
>;
69+
export type CreatePetsMutationBody = CreatePetsBody;
70+
export type CreatePetsMutationError = Error;
5771

58-
const mutationFn: MutationFunction<Awaited<ReturnType<typeof createPets>>, {data: CreatePetsBody}> = (props) => {
59-
const {data} = props ?? {};
60-
61-
return createPets(data,)
62-
}
63-
64-
65-
66-
67-
return { mutationFn, ...mutationOptions }}
68-
69-
export type CreatePetsMutationResult = NonNullable<Awaited<ReturnType<typeof createPets>>>
70-
export type CreatePetsMutationBody = CreatePetsBody
71-
export type CreatePetsMutationError = Error
72-
73-
/**
72+
/**
7473
* @summary Create a pet
7574
*/
76-
export const useCreatePets = <TError = Error,
77-
TContext = unknown>(options?: { mutation?:UseMutationOptions<Awaited<ReturnType<typeof createPets>>, TError,{data: CreatePetsBody}, TContext>, }
78-
): UseMutationResult<
79-
Awaited<ReturnType<typeof createPets>>,
80-
TError,
81-
{data: CreatePetsBody},
82-
TContext
83-
> => {
84-
85-
const mutationOptions = getCreatePetsMutationOptions(options);
86-
87-
return useMutation(mutationOptions);
88-
}
89-
75+
export const useCreatePets = <TError = Error, TContext = unknown>(options?: {
76+
mutation?: UseMutationOptions<
77+
Awaited<ReturnType<typeof createPets>>,
78+
TError,
79+
{ data: CreatePetsBody },
80+
TContext
81+
>;
82+
}): UseMutationResult<
83+
Awaited<ReturnType<typeof createPets>>,
84+
TError,
85+
{ data: CreatePetsBody },
86+
TContext
87+
> => {
88+
const mutationOptions = getCreatePetsMutationOptions(options);
89+
90+
return useMutation(mutationOptions);
91+
};

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ export * from './createPetsBody';
99
export * from './error';
1010
export * from './pet';
1111
export * from './petCallingCode';
12-
export * from './petCountry';
12+
export * from './petCountry';

‎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.