fix(接口测试): 修复swagger导入失败的缺陷

--bug=1026085 --user=王孝刚 [接口测试]github#24323接口导入-导入 Swagger 文件报“格式错误”
https://www.tapd.cn/55049933/s/1370729
This commit is contained in:
wxg0103 2023-05-11 10:30:16 +08:00 committed by f2c-ci-robot[bot]
parent d38253365a
commit 9d71894a3a
1 changed files with 11 additions and 7 deletions

View File

@ -1219,9 +1219,11 @@ public class ApiDefinitionService {
JSONObject element = JSONObject.parseObject(request, Feature.DisableSpecialKeyDetect);
try {
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
hashTree = mapper.readValue(element.getString("hashTree"), new TypeReference<LinkedList<MsTestElement>>() {
});
} catch (JsonProcessingException e) {
if (StringUtils.isNotBlank(element.getString("hashTree"))) {
hashTree = mapper.readValue(element.getString("hashTree"), new TypeReference<LinkedList<MsTestElement>>() {
});
}
} catch (Exception e) {
LogUtil.error(e);
}
MsHTTPSamplerProxy msHTTPSamplerProxy = JSONObject.parseObject(request, MsHTTPSamplerProxy.class, Feature.DisableSpecialKeyDetect);
@ -1251,9 +1253,11 @@ public class ApiDefinitionService {
JSONObject element = JSONObject.parseObject(request, Feature.DisableSpecialKeyDetect);
try {
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
hashTree = mapper.readValue(element.getString("hashTree"), new TypeReference<LinkedList<MsTestElement>>() {
});
} catch (JsonProcessingException e) {
if (StringUtils.isNotBlank(element.getString("hashTree"))) {
hashTree = mapper.readValue(element.getString("hashTree"), new TypeReference<LinkedList<MsTestElement>>() {
});
}
} catch (Exception e) {
LogUtil.error(e);
}
boolean createCase = CollectionUtils.isNotEmpty(tcpSampler.getParameters());
@ -1294,7 +1298,7 @@ public class ApiDefinitionService {
* @return
*/
public MsExecResponseDTO run(RunDefinitionRequest request, List<MultipartFile> bodyFiles) {
if(request.getConfig() == null ) {
if (request.getConfig() == null) {
request.setConfig(new RunModeConfigDTO());
}
if (StringUtils.isNotBlank(request.getEnvironmentGroupId())) {