fix(接口测试): 修改swagger2文件导入媒体类型部分数据缺失问题
--bug=1023905 --user=郭雨琦 https://www.tapd.cn/55049933/bugtrace/bugs/view/1155049933001023905
This commit is contained in:
parent
30f6a521ec
commit
1f7b1344c0
|
@ -420,6 +420,16 @@ public class Swagger2Parser extends SwaggerAbstractParser {
|
|||
if (body.getType().equals(Body.JSON_STR)) {
|
||||
body.setJsonSchema(parseSchema2JsonSchema(bodyParameter.getSchema()));
|
||||
body.setFormat("JSON-SCHEMA");
|
||||
} else if (body.getType().equals(Body.WWW_FROM) || body.getType().equals(Body.FORM_DATA)) {
|
||||
String parameterStr = parseSchema(bodyParameter.getSchema());
|
||||
JSONObject jsonObject = JSONUtil.parseObject(parameterStr);
|
||||
Set<String> strings = jsonObject.keySet();
|
||||
List<KeyValue> kvs = new ArrayList<>();
|
||||
for (String key : strings) {
|
||||
KeyValue keyValue = new KeyValue(key, jsonObject.get(key).toString());
|
||||
kvs.add(keyValue);
|
||||
}
|
||||
body.setKvs(kvs);
|
||||
} else {
|
||||
body.setRaw(parseSchema(bodyParameter.getSchema()));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue