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} 是否要转换
for (Parameter parameter : parameters) {
switch (parameter.getIn()) {
case SwaggerParameterType.PATH:
parsePathParameters(parameter, request.getRest());
break;
case SwaggerParameterType.QUERY:
parseQueryParameters(parameter, request.getArguments());
break;
case SwaggerParameterType.FORM_DATA:
parseFormDataParameters((FormParameter) parameter, request.getBody());
break;
case SwaggerParameterType.BODY:
parseRequestBodyParameters(parameter, request.getBody());
break;
case SwaggerParameterType.HEADER:
parseHeaderParameters(parameter, request.getHeaders());
break;
case SwaggerParameterType.COOKIE:
parseCookieParameters(parameter, request.getHeaders());
break;
if (StringUtils.isNotBlank(parameter.getIn())) {
switch (parameter.getIn()) {
case SwaggerParameterType.PATH:
parsePathParameters(parameter, request.getRest());
break;
case SwaggerParameterType.QUERY:
parseQueryParameters(parameter, request.getArguments());
break;
case SwaggerParameterType.FORM_DATA:
parseFormDataParameters((FormParameter) parameter, request.getBody());
break;
case SwaggerParameterType.BODY:
parseRequestBodyParameters(parameter, request.getBody());
break;
case SwaggerParameterType.HEADER:
parseHeaderParameters(parameter, request.getHeaders());
break;
case SwaggerParameterType.COOKIE:
parseCookieParameters(parameter, request.getHeaders());
break;
// case SwaggerParameterType.FILE:
// parsePathParameters(parameter, request);
// break;
}
}
}
}