fix(TCP-Mock、Json-schema): #1007848 【github#7666】TCP mock的json raw点击无响应、jesonschema转换时健的顺序错序

--bug=1007848 --user=宋天阳 【github#7666】TCP mock的json
raw点击无响应
https://www.tapd.cn/55049933/s/1067738、jesonschema转换时健的顺序错序
This commit is contained in:
song-tianyang 2021-11-15 16:55:55 +08:00 committed by song-tianyang
parent a199d9f139
commit 1b161e3cac
3 changed files with 6 additions and 5 deletions

View File

@ -210,7 +210,7 @@ public class JSONSchemaGenerator {
array.add(0);
}
} else if (itemsObject.has("properties")) {
JSONObject propertyConcept = new JSONObject();
JSONObject propertyConcept = new JSONObject(true);
JsonObject propertiesObj = itemsObject.get("properties").getAsJsonObject();
for (Entry<String, JsonElement> entry : propertiesObj.entrySet()) {
String propertyKey = entry.getKey();
@ -229,13 +229,13 @@ public class JSONSchemaGenerator {
array.add(itemsObjectArray);
}
}
concept.put(propertyName, array);
} else if (propertyObjType.equals("object")) {
JSONObject obj = new JSONObject();
concept.put(propertyName, obj);
analyzeObject(object, obj);
} else if (StringUtils.equalsIgnoreCase(propertyObjType,"null")) {
concept.put(propertyName, null);
}
}
}
@ -274,7 +274,7 @@ public class JSONSchemaGenerator {
private static String formerJson(String jsonSchema) {
try {
JSONObject root = new JSONObject();
JSONObject root = new JSONObject(true);
generator(jsonSchema, root);
// 格式化返回
Gson gson = new GsonBuilder().serializeNulls().setPrettyPrinting().disableHtmlEscaping().create();

View File

@ -86,6 +86,7 @@ export default {
name: "",
mockConfigId: "",
request: {
reportType: "raw",
jsonParam: false,
variables: [],
jsonData: "{}",

View File

@ -21,7 +21,7 @@
</el-select>
</el-col>
<el-col :span="4">
<ms-mock :disabled="pickValue.type==='object' || pickValue.type==='array'" :schema="pickValue"/>
<ms-mock :disabled="pickValue.type==='object' || pickValue.type==='array' || pickValue.type==='null'" :schema="pickValue"/>
</el-col>
<el-col :span="4">
<el-input v-model="pickValue.description" class="ms-col-title" :placeholder="$t('schema.description')" size="small"/>