echoapi-converter 0.0.49 → 0.0.50

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.
Files changed (2) hide show
  1. package/dist/index.js +29 -10
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -616,11 +616,10 @@ const handleSocketMethodRequestBody = (body, pathItem) => {
616
616
  };
617
617
  }
618
618
  else {
619
- let modeStr = MODE_TYPE[mode];
620
- if (modeStr) {
621
- pathItem.requestBody.content[modeStr] = {
622
- 'x-mode': modeStr || '',
623
- schema: {
619
+ if (mode) {
620
+ pathItem.requestBody.content[mode] = {
621
+ 'x-mode': mode || '',
622
+ schema: lodash.isPlainObject(body === null || body === void 0 ? void 0 : body.raw_schema) && !lodash.isEmpty(body === null || body === void 0 ? void 0 : body.raw_schema) ? body === null || body === void 0 ? void 0 : body.raw_schema : {
624
623
  type: "object",
625
624
  },
626
625
  example: (body === null || body === void 0 ? void 0 : body.raw) || "",
@@ -746,7 +745,7 @@ const createPathItem = (item, sourceObj, pid, pidName, modelsObj, apiVersion, ta
746
745
  pathItem['x-mark-id'] = item === null || item === void 0 ? void 0 : item.mark_id;
747
746
  }
748
747
  if (lodash.isString(item === null || item === void 0 ? void 0 : item.updated_at)) {
749
- pathItem['x-updated-at'] = item === null || item === void 0 ? void 0 : item.tags;
748
+ pathItem['x-updated-at'] = item === null || item === void 0 ? void 0 : item.updated_at;
750
749
  }
751
750
  if (lodash.isString((_a = item === null || item === void 0 ? void 0 : item.updated_user) === null || _a === void 0 ? void 0 : _a.nick_name)) {
752
751
  pathItem['x-updated-user-name'] = (_b = item === null || item === void 0 ? void 0 : item.updated_user) === null || _b === void 0 ? void 0 : _b.nick_name;
@@ -1329,7 +1328,12 @@ class ApipostToSwagger {
1329
1328
  paths[temp_url][targetMethod] = pathItem;
1330
1329
  }
1331
1330
  else if (pathItem.tags.length > 0) {
1332
- paths[temp_url][targetMethod].tags.push(...pathItem.tags);
1331
+ lodash.forEach(pathItem.tags, tag => {
1332
+ if (!paths[temp_url][targetMethod].tags.includes(tag)) {
1333
+ // 排除重复目录
1334
+ paths[temp_url][targetMethod].tags.push(tag);
1335
+ }
1336
+ });
1333
1337
  }
1334
1338
  }
1335
1339
  else if (["folder", "socket"].includes(item.target_type)) {
@@ -1367,7 +1371,12 @@ ${item.description}
1367
1371
  paths[temp_url][targetMethod] = pathItem;
1368
1372
  }
1369
1373
  else if (pathItem.tags.length > 0) {
1370
- paths[temp_url][targetMethod].tags.push(...pathItem.tags);
1374
+ lodash.forEach(pathItem.tags, tag => {
1375
+ if (!paths[temp_url][targetMethod].tags.includes(tag)) {
1376
+ // 排除重复目录
1377
+ paths[temp_url][targetMethod].tags.push(tag);
1378
+ }
1379
+ });
1371
1380
  }
1372
1381
  }
1373
1382
  else if (item.target_type === 'socket_method') {
@@ -1380,7 +1389,12 @@ ${item.description}
1380
1389
  paths[temp_url][targetMethod] = pathItem;
1381
1390
  }
1382
1391
  else if (pathItem.tags.length > 0) {
1383
- paths[temp_url][targetMethod].tags.push(...pathItem.tags);
1392
+ lodash.forEach(pathItem.tags, tag => {
1393
+ if (!paths[temp_url][targetMethod].tags.includes(tag)) {
1394
+ // 排除重复目录
1395
+ paths[temp_url][targetMethod].tags.push(tag);
1396
+ }
1397
+ });
1384
1398
  }
1385
1399
  }
1386
1400
  else if (item.target_type === 'doc') {
@@ -1393,7 +1407,12 @@ ${item.description}
1393
1407
  paths[temp_url][targetMethod] = pathItem;
1394
1408
  }
1395
1409
  else if (pathItem.tags.length > 0) {
1396
- paths[temp_url][targetMethod].tags.push(...pathItem.tags);
1410
+ lodash.forEach(pathItem.tags, tag => {
1411
+ if (!paths[temp_url][targetMethod].tags.includes(tag)) {
1412
+ // 排除重复目录
1413
+ paths[temp_url][targetMethod].tags.push(tag);
1414
+ }
1415
+ });
1397
1416
  }
1398
1417
  }
1399
1418
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "echoapi-converter",
3
- "version": "0.0.49",
3
+ "version": "0.0.50",
4
4
  "description": "echoapi to swagger",
5
5
  "main": "dist/index.js",
6
6
  "files": [