@midwayjs/swagger 3.14.11 → 3.14.13
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/interfaces/index.d.ts +1 -1
- package/dist/ui/render.d.ts +2 -7
- package/dist/ui/render.js +4 -3
- package/package.json +7 -7
|
@@ -364,7 +364,7 @@ export interface SwaggerOptions {
|
|
|
364
364
|
*/
|
|
365
365
|
operationIdFactory?: (controllerKey: string, webRouter: RouterOption) => string;
|
|
366
366
|
};
|
|
367
|
-
swaggerUIRender?: (config: SwaggerOptions, swaggerExplorer: SwaggerExplorer
|
|
367
|
+
swaggerUIRender?: (config: SwaggerOptions, swaggerExplorer: SwaggerExplorer) => (pathname: string) => Promise<{
|
|
368
368
|
ext: string;
|
|
369
369
|
content: any;
|
|
370
370
|
}>;
|
package/dist/ui/render.d.ts
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
1
|
import type { SwaggerOptions } from '../interfaces';
|
|
3
2
|
import { SwaggerExplorer } from '../swaggerExplorer';
|
|
4
|
-
export declare function renderSwaggerUIDist(swaggerConfig: SwaggerOptions, swaggerExplorer: SwaggerExplorer
|
|
5
|
-
customInitializer?: Buffer | string;
|
|
6
|
-
}): (pathname: string) => Promise<{
|
|
3
|
+
export declare function renderSwaggerUIDist(swaggerConfig: SwaggerOptions, swaggerExplorer: SwaggerExplorer): (pathname: string) => Promise<{
|
|
7
4
|
ext: string;
|
|
8
5
|
content: any;
|
|
9
6
|
}>;
|
|
@@ -11,9 +8,7 @@ export declare function renderJSON(swaggerConfig: SwaggerOptions, swaggerExplore
|
|
|
11
8
|
ext: string;
|
|
12
9
|
content: Omit<import("../interfaces").OpenAPIObject, "paths">;
|
|
13
10
|
}>;
|
|
14
|
-
export declare function renderSwaggerUIRemote(swaggerConfig: SwaggerOptions, swaggerExplorer: SwaggerExplorer
|
|
15
|
-
indexPagePath?: string;
|
|
16
|
-
}): (pathname: string) => Promise<{
|
|
11
|
+
export declare function renderSwaggerUIRemote(swaggerConfig: SwaggerOptions, swaggerExplorer: SwaggerExplorer): (pathname: string) => Promise<{
|
|
17
12
|
ext: string;
|
|
18
13
|
content: Omit<import("../interfaces").OpenAPIObject, "paths">;
|
|
19
14
|
} | {
|
package/dist/ui/render.js
CHANGED
|
@@ -4,12 +4,12 @@ exports.renderSwaggerUIRemote = exports.renderJSON = exports.renderSwaggerUIDist
|
|
|
4
4
|
const core_1 = require("@midwayjs/core");
|
|
5
5
|
const fs_1 = require("fs");
|
|
6
6
|
const path_1 = require("path");
|
|
7
|
-
function renderSwaggerUIDist(swaggerConfig, swaggerExplorer
|
|
7
|
+
function renderSwaggerUIDist(swaggerConfig, swaggerExplorer) {
|
|
8
8
|
const { getAbsoluteFSPath } = (0, core_1.safeRequire)('swagger-ui-dist');
|
|
9
9
|
if (!getAbsoluteFSPath) {
|
|
10
10
|
throw new core_1.MidwayCommonError('swagger-ui-dist is not installed');
|
|
11
11
|
}
|
|
12
|
-
swaggerRenderOptions =
|
|
12
|
+
const swaggerRenderOptions = swaggerConfig.swaggerUIRenderOptions || {};
|
|
13
13
|
if (swaggerRenderOptions.customInitializer) {
|
|
14
14
|
if ((0, path_1.isAbsolute)(swaggerRenderOptions.customInitializer)) {
|
|
15
15
|
swaggerRenderOptions.customInitializer = (0, fs_1.readFileSync)(swaggerRenderOptions.customInitializer);
|
|
@@ -69,7 +69,8 @@ function renderJSON(swaggerConfig, swaggerExplorer) {
|
|
|
69
69
|
};
|
|
70
70
|
}
|
|
71
71
|
exports.renderJSON = renderJSON;
|
|
72
|
-
function renderSwaggerUIRemote(swaggerConfig, swaggerExplorer
|
|
72
|
+
function renderSwaggerUIRemote(swaggerConfig, swaggerExplorer) {
|
|
73
|
+
const swaggerRenderOptions = swaggerConfig.swaggerUIRenderOptions || {};
|
|
73
74
|
const indexPagePath = (swaggerRenderOptions === null || swaggerRenderOptions === void 0 ? void 0 : swaggerRenderOptions.indexPagePath) || (0, path_1.join)(__dirname, '../../index.html');
|
|
74
75
|
return async (pathname) => {
|
|
75
76
|
if (pathname.indexOf(swaggerConfig.swaggerPath) === -1) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@midwayjs/swagger",
|
|
3
|
-
"version": "3.14.
|
|
3
|
+
"version": "3.14.13",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"typings": "index.d.ts",
|
|
6
6
|
"files": [
|
|
@@ -10,11 +10,11 @@
|
|
|
10
10
|
"index.html"
|
|
11
11
|
],
|
|
12
12
|
"devDependencies": {
|
|
13
|
-
"@midwayjs/core": "^3.14.
|
|
14
|
-
"@midwayjs/koa": "^3.14.
|
|
15
|
-
"@midwayjs/mock": "^3.14.
|
|
16
|
-
"@midwayjs/validate": "^3.14.
|
|
17
|
-
"swagger-ui-dist": "5.11.
|
|
13
|
+
"@midwayjs/core": "^3.14.12",
|
|
14
|
+
"@midwayjs/koa": "^3.14.12",
|
|
15
|
+
"@midwayjs/mock": "^3.14.12",
|
|
16
|
+
"@midwayjs/validate": "^3.14.12",
|
|
17
|
+
"swagger-ui-dist": "5.11.3"
|
|
18
18
|
},
|
|
19
19
|
"author": "Kurten Chan <chinkurten@gmail.com>",
|
|
20
20
|
"license": "MIT",
|
|
@@ -28,5 +28,5 @@
|
|
|
28
28
|
"type": "git",
|
|
29
29
|
"url": "https://github.com/midwayjs/midway.git"
|
|
30
30
|
},
|
|
31
|
-
"gitHead": "
|
|
31
|
+
"gitHead": "d145ad36adb40cfe7bf780e2ec07049d5ee90bdd"
|
|
32
32
|
}
|