swagger-to-axios 1.0.7 → 1.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/lib/{typeing.d.ts → types.d.ts} +3 -13
- package/lib/types.js +1 -0
- package/lib/utils/index.js +2 -1
- package/package.json +1 -1
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import fs from 'fs';
|
|
2
2
|
const fsPromises = fs.promises;
|
|
3
3
|
import { writeFile, urlToName, urlToLinkParams, getFolderList, } from './utils/index.js';
|
|
4
|
+
import "./types.js";
|
|
4
5
|
/** 创建所有 API 文件
|
|
5
6
|
* @param {SwaggerDocument[]} swaggerList - swagger 文档列表
|
|
6
7
|
* @param {Config} config - 配置项
|
|
@@ -3,18 +3,7 @@ declare interface SwaggerDocument {
|
|
|
3
3
|
/** swagger 文档地址 */
|
|
4
4
|
url: string;
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
7
|
-
* 默认值:false。
|
|
8
|
-
* 注:
|
|
9
|
-
* 1、如果该项为 true,则 url 应填本地地址,建议填写完整路径。
|
|
10
|
-
* */
|
|
11
|
-
localFile?: boolean;
|
|
12
|
-
/**
|
|
13
|
-
* swagger 文档文件类型。
|
|
14
|
-
* 默认值:yaml。
|
|
15
|
-
* */
|
|
16
|
-
urlType?: 'yaml' | 'json';
|
|
17
|
-
/** 生成文件后该文档的文件夹名称。
|
|
6
|
+
* 生成文件后该文档的文件夹名称。
|
|
18
7
|
* 默认值:字符串随机数。
|
|
19
8
|
* */
|
|
20
9
|
name?: string;
|
|
@@ -46,7 +35,8 @@ declare interface Config {
|
|
|
46
35
|
* 默认值:VUE_APP_PROTOCOL | VITE_APP_PROTOCOL(根据 cliType 属性)。
|
|
47
36
|
* 注:
|
|
48
37
|
* 1、如果 includeBaseURL 为 false,则不需要配置该项。
|
|
49
|
-
* 2
|
|
38
|
+
* 2、推荐只在生产环境和开发环境使用不同协议时配置该项。
|
|
39
|
+
* 3、VUE_APP_PROTOCOL / VITE_APP_PROTOCOL 的值应该为 'https' 或者 'http'。
|
|
50
40
|
*/
|
|
51
41
|
envProtocolName?: string;
|
|
52
42
|
/**
|
package/lib/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
package/lib/utils/index.js
CHANGED
|
@@ -25,7 +25,7 @@ export const expandAllOf = (object) => {
|
|
|
25
25
|
Object.assign(object, override);
|
|
26
26
|
}
|
|
27
27
|
Object.keys(object).forEach((key) => {
|
|
28
|
-
if (typeof object[key] === 'object') {
|
|
28
|
+
if (object[key] && typeof object[key] === 'object') {
|
|
29
29
|
expandAllOf(object[key]);
|
|
30
30
|
}
|
|
31
31
|
});
|
|
@@ -47,6 +47,7 @@ export const getSwaggerJson = async ({ url, }) => {
|
|
|
47
47
|
return swagger;
|
|
48
48
|
}
|
|
49
49
|
catch (error) {
|
|
50
|
+
console.error(`${url}异常:${error}`);
|
|
50
51
|
return undefined;
|
|
51
52
|
}
|
|
52
53
|
};
|