@midwayjs/swagger 3.1.0 → 3.1.5

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.
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
package/dist/index.js CHANGED
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
@@ -5,6 +5,7 @@ export declare class SwaggerMiddleware implements IMiddleware<IMidwayContext, Ne
5
5
  private swaggerExplorer;
6
6
  init(): Promise<void>;
7
7
  resolve(app: IMidwayApplication): (req: any, res: any, next: NextFunction) => Promise<any>;
8
+ replaceInfo(content: string): string;
8
9
  static getName(): string;
9
10
  }
10
11
  //# sourceMappingURL=swaggerMiddleware.d.ts.map
@@ -43,7 +43,7 @@ let SwaggerMiddleware = class SwaggerMiddleware {
43
43
  encoding: 'utf-8',
44
44
  });
45
45
  if (lastName === 'index.html') {
46
- content = content.replace('"https://petstore.swagger.io/v2/swagger.json"', `location.href.replace('${this.swaggerConfig.swaggerPath}/index.html', '${this.swaggerConfig.swaggerPath}/index.json')`);
46
+ content = this.replaceInfo(content);
47
47
  }
48
48
  const ext = (0, path_1.extname)(lastName);
49
49
  if (ext === '.js') {
@@ -81,7 +81,7 @@ let SwaggerMiddleware = class SwaggerMiddleware {
81
81
  encoding: 'utf-8',
82
82
  });
83
83
  if (lastName === 'index.html') {
84
- content = content.replace('"https://petstore.swagger.io/v2/swagger.json"', `location.href.replace('${this.swaggerConfig.swaggerPath}/index.html', '${this.swaggerConfig.swaggerPath}/index.json')`);
84
+ content = this.replaceInfo(content);
85
85
  }
86
86
  const ext = (0, path_1.extname)(lastName);
87
87
  if (ext === '.js') {
@@ -100,6 +100,9 @@ let SwaggerMiddleware = class SwaggerMiddleware {
100
100
  };
101
101
  }
102
102
  }
103
+ replaceInfo(content) {
104
+ return content.replace('"https://petstore.swagger.io/v2/swagger.json",', `location.href.replace('${this.swaggerConfig.swaggerPath}/index.html', '${this.swaggerConfig.swaggerPath}/index.json'),\n validatorUrl: null,`);
105
+ }
103
106
  static getName() {
104
107
  return 'swagger';
105
108
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@midwayjs/swagger",
3
- "version": "3.1.0",
3
+ "version": "3.1.5",
4
4
  "main": "dist/index",
5
5
  "typings": "index.d.ts",
6
6
  "files": [
@@ -9,11 +9,11 @@
9
9
  "index.d.ts"
10
10
  ],
11
11
  "devDependencies": {
12
- "@midwayjs/core": "^3.1.0",
12
+ "@midwayjs/core": "^3.1.5",
13
13
  "@midwayjs/decorator": "^3.0.10",
14
- "@midwayjs/koa": "^3.1.0",
15
- "@midwayjs/mock": "^3.1.0",
16
- "swagger-ui-dist": "4.6.1"
14
+ "@midwayjs/koa": "^3.1.5",
15
+ "@midwayjs/mock": "^3.1.5",
16
+ "swagger-ui-dist": "4.6.2"
17
17
  },
18
18
  "author": "Kurten Chan <chinkurten@gmail.com>",
19
19
  "license": "MIT",
@@ -27,5 +27,5 @@
27
27
  "type": "git",
28
28
  "url": "https://github.com/midwayjs/midway.git"
29
29
  },
30
- "gitHead": "2074c838e454a9673a044dbe065631dd9f944005"
30
+ "gitHead": "46a7851ad3ce6fc675bd7e1b7c9dff2c70009104"
31
31
  }