echoapi-converter 0.0.11 → 0.0.13
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 +9 -6
- 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
|
}
|
|
@@ -1456,7 +1459,7 @@ class SwaggerToApipost {
|
|
|
1456
1459
|
if (Object.prototype.toString.call(swaggerApi) !== '[object Object]')
|
|
1457
1460
|
return;
|
|
1458
1461
|
if (lodash.has(swaggerApi, 'tags') && swaggerApi.tags.length > 0) {
|
|
1459
|
-
this.handleTags(swaggerApi.tags, tags);
|
|
1462
|
+
this.handleTags(lodash.uniq(swaggerApi.tags), tags);
|
|
1460
1463
|
}
|
|
1461
1464
|
const api = {
|
|
1462
1465
|
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',
|
|
@@ -1591,7 +1594,7 @@ class SwaggerToApipost {
|
|
|
1591
1594
|
request.body.raw_parameter = raw_parameter;
|
|
1592
1595
|
if (lodash.isEmpty(request.body.raw)) {
|
|
1593
1596
|
try {
|
|
1594
|
-
const myMockSchema = new MockSchema__default["default"]();
|
|
1597
|
+
const myMockSchema = new MockSchema__default["default"]({ app: 'echoapi' });
|
|
1595
1598
|
const schemaJson = yield myMockSchema.mock(bodyData.schema);
|
|
1596
1599
|
request.body.raw =
|
|
1597
1600
|
lodash.isPlainObject(schemaJson) || Array.isArray(Raw)
|
|
@@ -1829,7 +1832,7 @@ class SwaggerToApipost {
|
|
|
1829
1832
|
}
|
|
1830
1833
|
}
|
|
1831
1834
|
if (lodash.has(swaggerApi, 'tags') && swaggerApi.tags.length > 0) {
|
|
1832
|
-
for (const folder of swaggerApi.tags) {
|
|
1835
|
+
for (const folder of lodash.uniq(swaggerApi.tags)) {
|
|
1833
1836
|
if (lodash.has(this.folders, folder)) {
|
|
1834
1837
|
this.folders[folder].children.push(api);
|
|
1835
1838
|
}
|
|
@@ -1885,7 +1888,7 @@ class SwaggerToApipost {
|
|
|
1885
1888
|
if (Object.prototype.toString.call(swaggerApi) !== '[object Object]')
|
|
1886
1889
|
return;
|
|
1887
1890
|
if (lodash.has(swaggerApi, 'tags') && swaggerApi.tags.length > 0) {
|
|
1888
|
-
this.handleTags(swaggerApi.tags, tags);
|
|
1891
|
+
this.handleTags(lodash.uniq(swaggerApi.tags), tags);
|
|
1889
1892
|
}
|
|
1890
1893
|
let api = {
|
|
1891
1894
|
// __originalOperationId swagger-client转换完后编码不支持中文
|
|
@@ -2023,7 +2026,7 @@ class SwaggerToApipost {
|
|
|
2023
2026
|
request.body.raw = transExample(parameter === null || parameter === void 0 ? void 0 : parameter.example) || Raw_text;
|
|
2024
2027
|
if (lodash.isEmpty(request.body.raw)) {
|
|
2025
2028
|
try {
|
|
2026
|
-
const myMockSchema = new MockSchema__default["default"]();
|
|
2029
|
+
const myMockSchema = new MockSchema__default["default"]({ app: 'echoapi' });
|
|
2027
2030
|
const schemaJson = yield myMockSchema.mock(parameter.schema);
|
|
2028
2031
|
request.body.raw =
|
|
2029
2032
|
lodash.isPlainObject(schemaJson) || Array.isArray(Raw)
|
|
@@ -2229,7 +2232,7 @@ class SwaggerToApipost {
|
|
|
2229
2232
|
}
|
|
2230
2233
|
}
|
|
2231
2234
|
if (lodash.has(swaggerApi, 'tags') && swaggerApi.tags.length > 0) {
|
|
2232
|
-
for (const folder of swaggerApi.tags) {
|
|
2235
|
+
for (const folder of lodash.uniq(swaggerApi.tags)) {
|
|
2233
2236
|
if (lodash.has(this.folders, folder)) {
|
|
2234
2237
|
if (Object.prototype.toString.call(this.folders[folder].children) === '[object Array]') {
|
|
2235
2238
|
this.folders[folder].children.push(Object.assign(Object.assign({}, api), { sort: this.folders[folder].children.length + 1 }));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "echoapi-converter",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.13",
|
|
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",
|