-
Notifications
You must be signed in to change notification settings - Fork 217
Expand file tree
/
Copy pathopenapi-config.ts
More file actions
30 lines (24 loc) · 873 Bytes
/
openapi-config.ts
File metadata and controls
30 lines (24 loc) · 873 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import { intersectionWith } from 'lodash';
import type { ConfigFile } from '@rtk-query/codegen-openapi';
import type { OperationDefinition } from '@rtk-query/codegen-openapi/src/types';
const filterEndpoint =
(tags: string[]) =>
(_, { operation }: OperationDefinition) => {
const test = (a: string, b: string) => a.toLowerCase().includes(b.toLowerCase());
return Boolean(intersectionWith(operation.tags as string[], tags, test).length);
};
const FILES = {
'./src/api-services/userPayments.ts': {
filterEndpoints: filterEndpoint(['user_payments']),
exportName: 'userPayments',
},
};
const config: ConfigFile = {
schemaFile: 'http://127.0.0.1:8000/openapi.json',
apiFile: './src/services/mainApi.ts',
apiImport: 'mainApi',
outputFiles: FILES,
hooks: true,
tag: true,
};
export default config;