fix(接口测试): 解决导出swagger再次导入其他平台报错问题
--user=郭雨琦 https://www.tapd.cn/55049933/bugtrace/bugs/view/1155049933001016562
This commit is contained in:
parent
fea05e2359
commit
a02b8610f0
|
@ -17,6 +17,7 @@ import io.metersphere.api.dto.scenario.Body;
|
|||
import io.metersphere.api.dto.scenario.KeyValue;
|
||||
import io.metersphere.api.dto.scenario.request.RequestType;
|
||||
import io.metersphere.base.domain.ApiDefinitionWithBLOBs;
|
||||
import io.metersphere.base.domain.Project;
|
||||
import io.metersphere.commons.exception.MSException;
|
||||
import io.metersphere.commons.utils.LogUtil;
|
||||
import io.metersphere.commons.utils.XMLUtils;
|
||||
|
@ -603,11 +604,16 @@ public class Swagger3Parser extends SwaggerAbstractParser {
|
|||
},
|
||||
"components":{}
|
||||
} */
|
||||
public SwaggerApiExportResult swagger3Export(List<ApiDefinitionWithBLOBs> apiDefinitionList) {
|
||||
public SwaggerApiExportResult swagger3Export(List<ApiDefinitionWithBLOBs> apiDefinitionList, Project project) {
|
||||
SwaggerApiExportResult result = new SwaggerApiExportResult();
|
||||
|
||||
result.setOpenapi("3.0.1");
|
||||
result.setInfo(new SwaggerInfo());
|
||||
SwaggerInfo swaggerInfo = new SwaggerInfo();
|
||||
swaggerInfo.setVersion("1.0.1");
|
||||
swaggerInfo.setTitle("ms-" + project.getName());
|
||||
swaggerInfo.setDescription("");
|
||||
swaggerInfo.setTermsOfService("");
|
||||
result.setInfo(swaggerInfo);
|
||||
result.setServers(new ArrayList<>());
|
||||
result.setTags(new ArrayList<>());
|
||||
result.setComponents(new JSONObject());
|
||||
|
|
|
@ -2338,7 +2338,8 @@ public class ApiDefinitionService {
|
|||
return msApiExportResult;
|
||||
} else { // 导出为 Swagger 格式
|
||||
Swagger3Parser swagger3Parser = new Swagger3Parser();
|
||||
return swagger3Parser.swagger3Export(apiDefinitions);
|
||||
Project project = projectMapper.selectByPrimaryKey(request.getProjectId());
|
||||
return swagger3Parser.swagger3Export(apiDefinitions, project);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue