@midwayjs/swagger 3.8.2 → 3.9.3

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.
@@ -216,9 +216,25 @@ let SwaggerExplorer = class SwaggerExplorer {
216
216
  }
217
217
  if (core_1.Types.isClass(currentType)) {
218
218
  this.parseClzz(currentType);
219
- p.schema = {
220
- $ref: '#/components/schemas/' + currentType.name,
221
- };
219
+ if (p.in === 'query') {
220
+ // 如果@Query()装饰的 是一个对象,则把该对象的子属性作为多个@Query参数
221
+ const schema = this.documentBuilder.getSchema(currentType.name);
222
+ Object.keys(schema.properties).forEach(pName => {
223
+ const ppt = schema.properties[pName];
224
+ const pp = {
225
+ name: pName,
226
+ in: p.in,
227
+ };
228
+ this.parseFromParamsToP({ metadata: ppt }, pp);
229
+ parameters.push(pp);
230
+ });
231
+ continue;
232
+ }
233
+ else {
234
+ p.schema = {
235
+ $ref: '#/components/schemas/' + currentType.name,
236
+ };
237
+ }
222
238
  }
223
239
  else {
224
240
  p.schema = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@midwayjs/swagger",
3
- "version": "3.8.2",
3
+ "version": "3.9.3",
4
4
  "main": "dist/index",
5
5
  "typings": "index.d.ts",
6
6
  "files": [
@@ -9,10 +9,10 @@
9
9
  "index.d.ts"
10
10
  ],
11
11
  "devDependencies": {
12
- "@midwayjs/core": "^3.8.0",
13
- "@midwayjs/koa": "^3.8.0",
14
- "@midwayjs/mock": "^3.8.0",
15
- "@midwayjs/validate": "^3.8.0",
12
+ "@midwayjs/core": "^3.9.0",
13
+ "@midwayjs/koa": "^3.9.0",
14
+ "@midwayjs/mock": "^3.9.0",
15
+ "@midwayjs/validate": "^3.9.0",
16
16
  "swagger-ui-dist": "4.15.5"
17
17
  },
18
18
  "author": "Kurten Chan <chinkurten@gmail.com>",
@@ -27,5 +27,5 @@
27
27
  "type": "git",
28
28
  "url": "https://github.com/midwayjs/midway.git"
29
29
  },
30
- "gitHead": "28121734fba47fa189493c09a58c2673ba60f81e"
30
+ "gitHead": "3cd5d856789433bcfab6bcdce87743035176c878"
31
31
  }