echoapi-converter 0.0.8 → 0.0.10
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 +18 -7
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -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 || '',
|
|
@@ -1699,15 +1699,20 @@ class SwaggerToApipost {
|
|
|
1699
1699
|
else if (lodash.isPlainObject(bodyData === null || bodyData === void 0 ? void 0 : bodyData.schema)) {
|
|
1700
1700
|
jsonSchema = bodyData.schema;
|
|
1701
1701
|
}
|
|
1702
|
-
if (lodash.has(bodyData, 'example')
|
|
1702
|
+
if (lodash.has(bodyData, 'example')) {
|
|
1703
1703
|
const example = bodyData.example;
|
|
1704
1704
|
if (status == 200 || status == 404) {
|
|
1705
1705
|
let originRaw;
|
|
1706
1706
|
try {
|
|
1707
|
-
|
|
1707
|
+
if (Object.prototype.toString.call(example) === '[object Object]') {
|
|
1708
|
+
originRaw = JSON.stringify(Object.assign({}, example));
|
|
1709
|
+
}
|
|
1710
|
+
else {
|
|
1711
|
+
originRaw = example;
|
|
1712
|
+
}
|
|
1708
1713
|
}
|
|
1709
1714
|
catch (error) {
|
|
1710
|
-
originRaw = String(
|
|
1715
|
+
originRaw = String(example);
|
|
1711
1716
|
}
|
|
1712
1717
|
const Raw_text = this.getBeautifulRaw(originRaw);
|
|
1713
1718
|
response.example.push({
|
|
@@ -1730,10 +1735,15 @@ class SwaggerToApipost {
|
|
|
1730
1735
|
const newUUID = ATools.snowflakeId();
|
|
1731
1736
|
let originRaw;
|
|
1732
1737
|
try {
|
|
1733
|
-
|
|
1738
|
+
if (Object.prototype.toString.call(example) === '[object Object]') {
|
|
1739
|
+
originRaw = JSON.stringify(Object.assign({}, example));
|
|
1740
|
+
}
|
|
1741
|
+
else {
|
|
1742
|
+
originRaw = example;
|
|
1743
|
+
}
|
|
1734
1744
|
}
|
|
1735
1745
|
catch (error) {
|
|
1736
|
-
originRaw = String(
|
|
1746
|
+
originRaw = String(example);
|
|
1737
1747
|
}
|
|
1738
1748
|
const Raw_text = this.getBeautifulRaw(originRaw);
|
|
1739
1749
|
response.example.push({
|
|
@@ -1875,7 +1885,8 @@ class SwaggerToApipost {
|
|
|
1875
1885
|
this.handleTags(swaggerApi.tags, tags);
|
|
1876
1886
|
}
|
|
1877
1887
|
let api = {
|
|
1878
|
-
|
|
1888
|
+
// __originalOperationId swagger-client转换完后编码不支持中文
|
|
1889
|
+
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',
|
|
1879
1890
|
tags: [],
|
|
1880
1891
|
target_type: 'api',
|
|
1881
1892
|
url: url || '',
|