echoapi-converter 0.0.8 → 0.0.9
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 +15 -5
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -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({
|