echoapi-converter 0.0.71 → 0.0.73

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 +17 -5
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -2910,9 +2910,10 @@ class SwaggerToApipost {
2910
2910
  createNewFolder(name, tags) {
2911
2911
  const tagData = tags === null || tags === void 0 ? void 0 : tags.find((tag) => tag.name === name);
2912
2912
  const description = (tagData === null || tagData === void 0 ? void 0 : tagData.description) || "";
2913
+ const type = (tagData === null || tagData === void 0 ? void 0 : tagData['x-type']) || "folder";
2913
2914
  const newFolder = {
2914
2915
  name: name,
2915
- target_type: "folder",
2916
+ target_type: type,
2916
2917
  description: description,
2917
2918
  children: [],
2918
2919
  };
@@ -4920,11 +4921,19 @@ const completionPostmanTarget = (targetItem) => {
4920
4921
  };
4921
4922
  const getHostWithPortFromUrl = (urlString) => {
4922
4923
  try {
4924
+ if (urlString.length <= 0) {
4925
+ return {};
4926
+ }
4923
4927
  const url = new URL(urlString);
4924
- return url.host; // 返回包含端口号的host部分(如果有的话)
4928
+ return {
4929
+ host: url.host.split('.'),
4930
+ protocol: lodash.replace(url.protocol, new RegExp(':', 'g'), ''),
4931
+ }; // 返回包含端口号的host部分(如果有的话)
4925
4932
  }
4926
4933
  catch (error) {
4927
- return '';
4934
+ return {
4935
+ host: [urlString],
4936
+ };
4928
4937
  }
4929
4938
  };
4930
4939
  const urlHost = getHostWithPortFromUrl((targetItem === null || targetItem === void 0 ? void 0 : targetItem.url) || '');
@@ -4933,8 +4942,11 @@ const completionPostmanTarget = (targetItem) => {
4933
4942
  query: getPostmanQuery((_b = (_a = targetItem === null || targetItem === void 0 ? void 0 : targetItem.request) === null || _a === void 0 ? void 0 : _a.query) === null || _b === void 0 ? void 0 : _b.parameter),
4934
4943
  variable: getPostmanVariable((_d = (_c = targetItem === null || targetItem === void 0 ? void 0 : targetItem.request) === null || _c === void 0 ? void 0 : _c.restful) === null || _d === void 0 ? void 0 : _d.parameter)
4935
4944
  };
4936
- if (urlHost) {
4937
- urlObj.host = [urlHost];
4945
+ if (urlHost === null || urlHost === void 0 ? void 0 : urlHost.protocol) {
4946
+ urlObj.protocol = urlHost === null || urlHost === void 0 ? void 0 : urlHost.protocol;
4947
+ }
4948
+ if (lodash.isArray(urlHost.host)) {
4949
+ urlObj.host = urlHost.host;
4938
4950
  }
4939
4951
  return urlObj;
4940
4952
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "echoapi-converter",
3
- "version": "0.0.71",
3
+ "version": "0.0.73",
4
4
  "description": "echoapi to swagger",
5
5
  "main": "dist/index.js",
6
6
  "files": [