echoapi-converter 0.0.9 → 0.0.11

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 +12 -5
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1448,7 +1448,7 @@ class SwaggerToApipost {
1448
1448
  }
1449
1449
  }
1450
1450
  handlePathV3(path, pathItem, tags) {
1451
- var _a, _b, _c, _d, _e, _f, _g;
1451
+ var _a, _b, _c, _d, _e, _f, _g, _h;
1452
1452
  return __awaiter(this, void 0, void 0, function* () {
1453
1453
  let url = path;
1454
1454
  for (const method in pathItem) {
@@ -1459,7 +1459,7 @@ class SwaggerToApipost {
1459
1459
  this.handleTags(swaggerApi.tags, tags);
1460
1460
  }
1461
1461
  const api = {
1462
- name: (swaggerApi === null || swaggerApi === void 0 ? void 0 : swaggerApi.summary) || (swaggerApi === null || swaggerApi === void 0 ? void 0 : swaggerApi.operationId) || 'New HTTP',
1462
+ name: (swaggerApi === null || swaggerApi === void 0 ? void 0 : swaggerApi.summary) || (swaggerApi === null || swaggerApi === void 0 ? void 0 : swaggerApi.__originalOperationId) || (swaggerApi === null || swaggerApi === void 0 ? void 0 : swaggerApi.operationId) || 'New HTTP',
1463
1463
  target_type: 'api',
1464
1464
  tags: [],
1465
1465
  url: url || '',
@@ -1531,6 +1531,9 @@ class SwaggerToApipost {
1531
1531
  }
1532
1532
  }
1533
1533
  }
1534
+ request['restful'] = {
1535
+ parameter: genRestfulByUrl(url, ((_g = request === null || request === void 0 ? void 0 : request.restful) === null || _g === void 0 ? void 0 : _g.parameter) || []),
1536
+ };
1534
1537
  }
1535
1538
  if (lodash.has(swaggerApi, 'requestBody') &&
1536
1539
  lodash.has(swaggerApi.requestBody, 'content')) {
@@ -1542,7 +1545,7 @@ class SwaggerToApipost {
1542
1545
  if (lodash.has(bodyData, 'schema')) {
1543
1546
  const { schema } = bodyData;
1544
1547
  if ((schema === null || schema === void 0 ? void 0 : schema.type) === 'array') {
1545
- properties = (_g = schema === null || schema === void 0 ? void 0 : schema.items) === null || _g === void 0 ? void 0 : _g.properties;
1548
+ properties = (_h = schema === null || schema === void 0 ? void 0 : schema.items) === null || _h === void 0 ? void 0 : _h.properties;
1546
1549
  }
1547
1550
  else {
1548
1551
  properties = schema === null || schema === void 0 ? void 0 : schema.properties;
@@ -1872,7 +1875,7 @@ class SwaggerToApipost {
1872
1875
  }
1873
1876
  }
1874
1877
  handlePath(path, pathItem, tags) {
1875
- var _a, _b, _c, _d, _e, _f, _g;
1878
+ var _a, _b, _c, _d, _e, _f, _g, _h;
1876
1879
  return __awaiter(this, void 0, void 0, function* () {
1877
1880
  let url = path;
1878
1881
  url = decodeURI(this.basePath + url);
@@ -1885,7 +1888,8 @@ class SwaggerToApipost {
1885
1888
  this.handleTags(swaggerApi.tags, tags);
1886
1889
  }
1887
1890
  let api = {
1888
- name: (swaggerApi === null || swaggerApi === void 0 ? void 0 : swaggerApi.summary) || (swaggerApi === null || swaggerApi === void 0 ? void 0 : swaggerApi.operationId) || '新建接口',
1891
+ // __originalOperationId swagger-client转换完后编码不支持中文
1892
+ name: (swaggerApi === null || swaggerApi === void 0 ? void 0 : swaggerApi.summary) || (swaggerApi === null || swaggerApi === void 0 ? void 0 : swaggerApi.__originalOperationId) || (swaggerApi === null || swaggerApi === void 0 ? void 0 : swaggerApi.operationId) || 'New HTTP',
1889
1893
  tags: [],
1890
1894
  target_type: 'api',
1891
1895
  url: url || '',
@@ -2051,6 +2055,9 @@ class SwaggerToApipost {
2051
2055
  }
2052
2056
  }
2053
2057
  }
2058
+ request['restful'] = {
2059
+ parameter: genRestfulByUrl(url, ((_h = request === null || request === void 0 ? void 0 : request.restful) === null || _h === void 0 ? void 0 : _h.parameter) || []),
2060
+ };
2054
2061
  if (!lodash.isString(request.body.raw)) {
2055
2062
  request.body.raw = JSON.stringify(request.body.raw);
2056
2063
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "echoapi-converter",
3
- "version": "0.0.9",
3
+ "version": "0.0.11",
4
4
  "description": "echoapi to swagger",
5
5
  "main": "dist/index.js",
6
6
  "files": [