repair gitee issues #I1426C

This commit is contained in:
songhaozhi 2019-10-28 23:17:52 +08:00
parent 765876b2d0
commit 584e7d1f73
1 changed files with 33 additions and 30 deletions

View File

@ -46,6 +46,8 @@ public class SourceBuilder {
private static final String NO_COMMENTS_FOUND = "No comments found.";
private static final String VALID = "Valid";
private static final String METHOD_DESCRIPTION = "apiNote";
private Map<String, JavaClass> javaFilesMap = new HashMap<>();
@ -1077,6 +1079,7 @@ public class SourceBuilder {
comment = NO_COMMENTS_FOUND;
}
List<JavaAnnotation> annotations = parameter.getAnnotations();
if (annotations.size() == 0) {
//default set required is true
if (DocClassUtil.isCollection(fullTypeName) || DocClassUtil.isArray(fullTypeName)) {
String[] gicNameArr = DocClassUtil.getSimpleGicName(typeName);
@ -1111,7 +1114,7 @@ public class SourceBuilder {
} else {
paramList.addAll(buildParams(fullTypeName, "", 0, "true", responseFieldMap, false, false));
}
}
for (JavaAnnotation annotation : annotations) {
String required = "true";
AnnotationValue annotationRequired = annotation.getProperty(DocAnnotationConstants.REQUIRED_PROP);
@ -1119,7 +1122,7 @@ public class SourceBuilder {
required = annotationRequired.toString();
}
String annotationName = annotation.getType().getName();
if (REQUEST_BODY.equals(annotationName)) {
if (REQUEST_BODY.equals(annotationName) || VALID.equals(annotationName) && annotations.size() == 1) {
if (requestBodyCounter > 0) {
throw new RuntimeException("You have use @RequestBody Passing multiple variables for method "
+ javaMethod.getName() + " in " + className + ",@RequestBody annotation could only bind one variables.");