Optimize MultipartFile object parameter handling

This commit is contained in:
oppofind 2020-08-29 21:48:08 +08:00
parent b8b33485bc
commit ce9516fd65
2 changed files with 11 additions and 10 deletions

View File

@ -7,6 +7,7 @@
2. 修改复杂参数表树型数据转化的错误。
3. 修复非allInOne模板使用渲染错误。
4. 修复一些泛型例子解析错误bug。
5. 优化MultipartFile文件上传参数处理不对该参数进行展开分析。
#### 版本号1.9.2
- 更新日期: 2020-08-23
- 更新内容:

View File

@ -107,12 +107,7 @@ public class ParamsBuildHelper {
}
paramList.add(param);
}
// if (className.contains(DocGlobalConstants.MULTIPART_FILE_FULLY)) {
// ApiParam param = ApiParam.of().setField("").setType("file")
// .setPid(pid)
// .setDesc("comment").setRequired(true).setVersion(DocGlobalConstants.DEFAULT_VERSION);
// paramList.add(param);
// }
else {
boolean isGenerics = JavaFieldUtil.checkGenerics(fields);
out:
@ -127,6 +122,7 @@ public class ParamsBuildHelper {
if (field.isTransient() && skipTransientField) {
continue;
}
if ((responseFieldToUnderline && isResp) || (requestFieldToUnderline && !isResp)) {
fieldName = StringUtil.camelToUnderline(fieldName);
}
@ -212,6 +208,14 @@ public class ParamsBuildHelper {
if (StringUtil.isNotEmpty(comment)) {
comment = DocUtil.replaceNewLineToHtmlBr(comment);
}
// file
if (fieldGicName.contains(DocGlobalConstants.MULTIPART_FILE_FULLY)) {
ApiParam param = ApiParam.of().setField(pre + fieldName).setType("file")
.setPid(pid).setId(paramList.size() + pid + 1)
.setDesc(comment).setRequired(Boolean.valueOf(isRequired)).setVersion(since);
paramList.add(param);
continue;
}
if (JavaClassValidateUtil.isPrimitive(subTypeName)) {
ApiParam param = ApiParam.of().setField(pre + fieldName);
param.setPid(pid);
@ -245,10 +249,6 @@ public class ParamsBuildHelper {
}
param.setType(DocGlobalConstants.ENUM);
}
//如果是文件
if(typeSimpleName.contains(DocGlobalConstants.MULTIPART_FILE_FULLY)){
param.setType("file");
}
//如果已经设置返回类型 不需要再次设置
if (param.getType() == null) {
String processedType;