forked from acacode/swagger-typescript-api
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapiConfig.js
38 lines (34 loc) · 825 Bytes
/
apiConfig.js
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
32
33
34
35
36
37
38
const { formatDescription } = require("./common");
const createApiConfig = ({ info, servers, }) => {
const server = (servers && servers[0]) || { url: '' }
const generic = [
'SecurityDataType'
].filter(Boolean).join(', ')
return {
props: [
{
name: 'baseUrl',
optional: true,
type: 'string'
},
{
name: 'baseApiParams',
optional: true,
type: 'RequestParams'
},
{
name: 'securityWorker',
optional: true,
type: '(securityData: SecurityDataType) => RequestParams'
}
].filter(Boolean),
generic: generic && `<${generic}>`,
baseUrl: server.url,
title: info.title,
version: info.version,
description: formatDescription(info.description),
}
}
module.exports = {
createApiConfig,
}