echoapi-converter 0.0.10 → 0.0.12
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.
- package/dist/index.js +14 -5
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -973,6 +973,9 @@ const getApipostMode = (mode) => {
|
|
|
973
973
|
else if (mode == 'application/x-www-form-urlencoded') {
|
|
974
974
|
apipostMode = 'urlencoded';
|
|
975
975
|
}
|
|
976
|
+
else if (mode == 'application/octet-stream') {
|
|
977
|
+
apipostMode = 'binary';
|
|
978
|
+
}
|
|
976
979
|
else if (mode && mode != undefined) {
|
|
977
980
|
apipostMode = 'json';
|
|
978
981
|
}
|
|
@@ -1448,7 +1451,7 @@ class SwaggerToApipost {
|
|
|
1448
1451
|
}
|
|
1449
1452
|
}
|
|
1450
1453
|
handlePathV3(path, pathItem, tags) {
|
|
1451
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
1454
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
1452
1455
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1453
1456
|
let url = path;
|
|
1454
1457
|
for (const method in pathItem) {
|
|
@@ -1531,6 +1534,9 @@ class SwaggerToApipost {
|
|
|
1531
1534
|
}
|
|
1532
1535
|
}
|
|
1533
1536
|
}
|
|
1537
|
+
request['restful'] = {
|
|
1538
|
+
parameter: genRestfulByUrl(url, ((_g = request === null || request === void 0 ? void 0 : request.restful) === null || _g === void 0 ? void 0 : _g.parameter) || []),
|
|
1539
|
+
};
|
|
1534
1540
|
}
|
|
1535
1541
|
if (lodash.has(swaggerApi, 'requestBody') &&
|
|
1536
1542
|
lodash.has(swaggerApi.requestBody, 'content')) {
|
|
@@ -1542,7 +1548,7 @@ class SwaggerToApipost {
|
|
|
1542
1548
|
if (lodash.has(bodyData, 'schema')) {
|
|
1543
1549
|
const { schema } = bodyData;
|
|
1544
1550
|
if ((schema === null || schema === void 0 ? void 0 : schema.type) === 'array') {
|
|
1545
|
-
properties = (
|
|
1551
|
+
properties = (_h = schema === null || schema === void 0 ? void 0 : schema.items) === null || _h === void 0 ? void 0 : _h.properties;
|
|
1546
1552
|
}
|
|
1547
1553
|
else {
|
|
1548
1554
|
properties = schema === null || schema === void 0 ? void 0 : schema.properties;
|
|
@@ -1588,7 +1594,7 @@ class SwaggerToApipost {
|
|
|
1588
1594
|
request.body.raw_parameter = raw_parameter;
|
|
1589
1595
|
if (lodash.isEmpty(request.body.raw)) {
|
|
1590
1596
|
try {
|
|
1591
|
-
const myMockSchema = new MockSchema__default["default"]();
|
|
1597
|
+
const myMockSchema = new MockSchema__default["default"]({ app: 'echoapi' });
|
|
1592
1598
|
const schemaJson = yield myMockSchema.mock(bodyData.schema);
|
|
1593
1599
|
request.body.raw =
|
|
1594
1600
|
lodash.isPlainObject(schemaJson) || Array.isArray(Raw)
|
|
@@ -1872,7 +1878,7 @@ class SwaggerToApipost {
|
|
|
1872
1878
|
}
|
|
1873
1879
|
}
|
|
1874
1880
|
handlePath(path, pathItem, tags) {
|
|
1875
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
1881
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
1876
1882
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1877
1883
|
let url = path;
|
|
1878
1884
|
url = decodeURI(this.basePath + url);
|
|
@@ -2020,7 +2026,7 @@ class SwaggerToApipost {
|
|
|
2020
2026
|
request.body.raw = transExample(parameter === null || parameter === void 0 ? void 0 : parameter.example) || Raw_text;
|
|
2021
2027
|
if (lodash.isEmpty(request.body.raw)) {
|
|
2022
2028
|
try {
|
|
2023
|
-
const myMockSchema = new MockSchema__default["default"]();
|
|
2029
|
+
const myMockSchema = new MockSchema__default["default"]({ app: 'echoapi' });
|
|
2024
2030
|
const schemaJson = yield myMockSchema.mock(parameter.schema);
|
|
2025
2031
|
request.body.raw =
|
|
2026
2032
|
lodash.isPlainObject(schemaJson) || Array.isArray(Raw)
|
|
@@ -2052,6 +2058,9 @@ class SwaggerToApipost {
|
|
|
2052
2058
|
}
|
|
2053
2059
|
}
|
|
2054
2060
|
}
|
|
2061
|
+
request['restful'] = {
|
|
2062
|
+
parameter: genRestfulByUrl(url, ((_h = request === null || request === void 0 ? void 0 : request.restful) === null || _h === void 0 ? void 0 : _h.parameter) || []),
|
|
2063
|
+
};
|
|
2055
2064
|
if (!lodash.isString(request.body.raw)) {
|
|
2056
2065
|
request.body.raw = JSON.stringify(request.body.raw);
|
|
2057
2066
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "echoapi-converter",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.12",
|
|
4
4
|
"description": "echoapi to swagger",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"files": [
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"@types/lodash": "^4.14.202",
|
|
33
|
-
"apipost-mock-schema": "^0.0.
|
|
33
|
+
"apipost-mock-schema": "^0.0.37",
|
|
34
34
|
"apipost-tools": "0.0.34",
|
|
35
35
|
"axios": "^1.6.7",
|
|
36
36
|
"fs": "^0.0.1-security",
|