fix(接口定义): 修复swagger导入报错的缺陷

--bug=1026055 --user=王孝刚 【接口测试】github#24292,接口导入 Swagger 文件报“解析数据出错
https://www.tapd.cn/55049933/s/1370510
This commit is contained in:
wxg0103 2023-05-10 14:15:43 +08:00 committed by jianxing
parent b74d048f94
commit 585abe8e56
1 changed files with 21 additions and 19 deletions

View File

@ -221,28 +221,30 @@ public class Swagger2Parser extends SwaggerAbstractParser {
// todo 路径变量 {xxx} 是否要转换 // todo 路径变量 {xxx} 是否要转换
for (Parameter parameter : parameters) { for (Parameter parameter : parameters) {
switch (parameter.getIn()) { if (StringUtils.isNotBlank(parameter.getIn())) {
case SwaggerParameterType.PATH: switch (parameter.getIn()) {
parsePathParameters(parameter, request.getRest()); case SwaggerParameterType.PATH:
break; parsePathParameters(parameter, request.getRest());
case SwaggerParameterType.QUERY: break;
parseQueryParameters(parameter, request.getArguments()); case SwaggerParameterType.QUERY:
break; parseQueryParameters(parameter, request.getArguments());
case SwaggerParameterType.FORM_DATA: break;
parseFormDataParameters((FormParameter) parameter, request.getBody()); case SwaggerParameterType.FORM_DATA:
break; parseFormDataParameters((FormParameter) parameter, request.getBody());
case SwaggerParameterType.BODY: break;
parseRequestBodyParameters(parameter, request.getBody()); case SwaggerParameterType.BODY:
break; parseRequestBodyParameters(parameter, request.getBody());
case SwaggerParameterType.HEADER: break;
parseHeaderParameters(parameter, request.getHeaders()); case SwaggerParameterType.HEADER:
break; parseHeaderParameters(parameter, request.getHeaders());
case SwaggerParameterType.COOKIE: break;
parseCookieParameters(parameter, request.getHeaders()); case SwaggerParameterType.COOKIE:
break; parseCookieParameters(parameter, request.getHeaders());
break;
// case SwaggerParameterType.FILE: // case SwaggerParameterType.FILE:
// parsePathParameters(parameter, request); // parsePathParameters(parameter, request);
// break; // break;
}
} }
} }
} }