@midwayjs/swagger 4.0.0-beta.11 → 4.0.0-beta.12
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/dist/swaggerExplorer.js +12 -10
- package/package.json +6 -6
package/dist/swaggerExplorer.js
CHANGED
|
@@ -38,14 +38,15 @@ let SwaggerExplorer = class SwaggerExplorer {
|
|
|
38
38
|
typeof this.swaggerConfig?.externalDocs === 'object') {
|
|
39
39
|
this.documentBuilder.setExternalDoc(this.swaggerConfig?.externalDocs?.description, this.swaggerConfig?.externalDocs?.url);
|
|
40
40
|
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
for (const serv of
|
|
41
|
+
const servers = this.swaggerConfig?.servers;
|
|
42
|
+
if (Array.isArray(servers)) {
|
|
43
|
+
for (const serv of servers) {
|
|
44
44
|
this.documentBuilder.addServer(serv?.url, serv?.description, serv?.variables);
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
|
-
|
|
48
|
-
|
|
47
|
+
const tags = this.swaggerConfig?.tags;
|
|
48
|
+
if (Array.isArray(tags)) {
|
|
49
|
+
for (const t of tags) {
|
|
49
50
|
this.documentBuilder.addTag(t.name, t.description, t.externalDocs);
|
|
50
51
|
}
|
|
51
52
|
}
|
|
@@ -54,13 +55,14 @@ let SwaggerExplorer = class SwaggerExplorer {
|
|
|
54
55
|
this.swaggerConfig.documentOptions.operationIdFactory;
|
|
55
56
|
}
|
|
56
57
|
// 设置 auth 类型
|
|
57
|
-
|
|
58
|
-
|
|
58
|
+
const authConfig = this.swaggerConfig?.auth;
|
|
59
|
+
if (Array.isArray(authConfig)) {
|
|
60
|
+
for (const a of authConfig) {
|
|
59
61
|
this.setAuth(a);
|
|
60
62
|
}
|
|
61
63
|
}
|
|
62
|
-
else {
|
|
63
|
-
this.setAuth(
|
|
64
|
+
else if (authConfig) {
|
|
65
|
+
this.setAuth(authConfig);
|
|
64
66
|
}
|
|
65
67
|
}
|
|
66
68
|
addGlobalPrefix(globalPrefix) {
|
|
@@ -270,7 +272,7 @@ let SwaggerExplorer = class SwaggerExplorer {
|
|
|
270
272
|
description: getNotEmptyValue(operMeta?.metadata?.description, webRouter.description),
|
|
271
273
|
operationId: operMeta?.metadata?.operationId ||
|
|
272
274
|
this.getOperationId(target.name, webRouter),
|
|
273
|
-
tags: routerTags.length ? routerTags : operMeta?.metadata?.tags ?? [],
|
|
275
|
+
tags: routerTags.length ? routerTags : (operMeta?.metadata?.tags ?? []),
|
|
274
276
|
};
|
|
275
277
|
if (operMeta?.metadata?.deprecated != null) {
|
|
276
278
|
opts[webRouter.requestMethod].deprecated =
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@midwayjs/swagger",
|
|
3
|
-
"version": "4.0.0-beta.
|
|
3
|
+
"version": "4.0.0-beta.12",
|
|
4
4
|
"description": "Midway Component for Swagger API Documentation",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"typings": "index.d.ts",
|
|
@@ -12,10 +12,10 @@
|
|
|
12
12
|
],
|
|
13
13
|
"devDependencies": {
|
|
14
14
|
"@apidevtools/swagger-parser": "11.0.1",
|
|
15
|
-
"@midwayjs/core": "^4.0.0-beta.
|
|
16
|
-
"@midwayjs/koa": "^4.0.0-beta.
|
|
17
|
-
"@midwayjs/mock": "^4.0.0-beta.
|
|
18
|
-
"@midwayjs/validate": "^4.0.0-beta.
|
|
15
|
+
"@midwayjs/core": "^4.0.0-beta.12",
|
|
16
|
+
"@midwayjs/koa": "^4.0.0-beta.12",
|
|
17
|
+
"@midwayjs/mock": "^4.0.0-beta.12",
|
|
18
|
+
"@midwayjs/validate": "^4.0.0-beta.12",
|
|
19
19
|
"swagger-ui-dist": "5.18.3"
|
|
20
20
|
},
|
|
21
21
|
"author": "Kurten Chan <chinkurten@gmail.com>",
|
|
@@ -30,5 +30,5 @@
|
|
|
30
30
|
"type": "git",
|
|
31
31
|
"url": "https://github.com/midwayjs/midway.git"
|
|
32
32
|
},
|
|
33
|
-
"gitHead": "
|
|
33
|
+
"gitHead": "1c48179b7c827ba8ec9351e9b6c36ec1726d3e11"
|
|
34
34
|
}
|