fix(接口测试): 修复特殊数据的swagger3.0数据导出失败的缺陷

--bug=1027526 --user=王孝刚 【接口测试】导入swagger2.0接口数据后再次导出为swagger3.0格式-导出失败
https://www.tapd.cn/55049933/s/1389001
This commit is contained in:
wxg0103 2023-07-03 18:42:25 +08:00 committed by fit2-zhao
parent f1aef17cf7
commit b446bb8fa7
1 changed files with 4 additions and 2 deletions

View File

@ -1263,9 +1263,11 @@ public class Swagger3Parser extends SwaggerAbstractParser {
String xml = XMLUtil.delXmlHeader(xmlText);
int startIndex = xml.indexOf("<", 0);
int endIndex = xml.indexOf(">", 0);
String substring = xml.substring(startIndex + 1, endIndex);
if (endIndex > startIndex+ 1 ) {
String substring = xml.substring(startIndex + 1, endIndex);
bodyInfo = buildRefSchema(substring);
}
JSONObject xmlToJson = XMLUtil.xmlConvertJson(xmlText);
bodyInfo = buildRefSchema(substring);
JSONObject jsonObject = buildRequestBodyXmlSchema(xmlToJson);
if (schemas == null) {
schemas = new LinkedList<>();