-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgenerator.ts
More file actions
31 lines (26 loc) · 959 Bytes
/
generator.ts
File metadata and controls
31 lines (26 loc) · 959 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
31
import { generateApi } from 'swagger-typescript-api';
import * as path from 'path';
// @ts-ignore
import prettier from '../../.prettierrc.js';
import { fileURLToPath } from 'url';
// @ts-ignore
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const CROWDSEC_SWAGGER_URL = 'https://raw.githubusercontent.com/crowdsecurity/crowdsec/master/pkg/models/localapi_swagger.yaml';
const main = async () => {
await generateApi({
name: 'crowdsec-api-generated.ts',
output: path.join(__dirname, './src/types/generated'),
templates: path.join(__dirname, './_OATemplates'),
httpClientType: 'axios',
url: CROWDSEC_SWAGGER_URL,
generateClient: false,
modular: true,
prettier,
cleanOutput: true,
extractRequestParams: true,
extractRequestBody: true,
generateRouteTypes: true
});
};
main().catch((e) => console.error(e));