fix(接口测试): 修复JSON-SCHEMA空类型参数处理问题

--bug=1033206 --user=赵勇 【接口测试】github#27698, 接口请求体开启json-schema后,设置参数为空,实际请求时非空,不符合预期 https://www.tapd.cn/55049933/s/1439488

Signed-off-by: fit2-zhao <yong.zhao@fit2cloud.com>
This commit is contained in:
fit2-zhao 2023-11-27 10:16:41 +08:00 committed by Craftsman
parent 1268b1f8fc
commit 97a2eb051d
3 changed files with 4 additions and 2 deletions

View File

@ -287,7 +287,7 @@ public class JSONSchemaBuilder {
JSONArray jsonArray = (JSONArray) root.get(PropertyConstant.MS_OBJECT);
List<String> list = new LinkedList<>();
JSONSchemaParser.toJsonString(jsonArray, list);
return list.toString();
return JSON.toJSONString(list);
}
return JSON.toJSONString(JSON.toMap(root));
}

View File

@ -238,7 +238,7 @@ public class JSONSchemaParser {
JSONArray jsonArray = (JSONArray) root.get(PropertyConstant.MS_OBJECT);
List<String> list = new LinkedList<>();
toJsonString(jsonArray, list);
json = list.toString();
json = JSON.toJSONString(list);
} else {
json = JSON.toJSONString(JSON.toMap(root));
}

View File

@ -127,6 +127,8 @@ public class JSON {
value = toMap((JSONObject) value);
} else if (value instanceof JSONArray) {
value = toList((JSONArray) value);
} else if (value == JSONObject.NULL) {
value = null;
}
map.put(key, value);
}