Add query param parameter description

This commit is contained in:
yusun4 2020-10-13 22:42:10 +08:00
parent 6587c24efd
commit c1a2a14775
1 changed files with 4 additions and 1 deletions

View File

@ -481,6 +481,7 @@ public class SpringBootDocBuildTemplate implements IDocBuildTemplate<ApiDoc> {
List<String> groupClasses = JavaClassUtil.getParamGroupJavaClass(annotations);
String strRequired = "false";
boolean isPathVariable = false;
boolean isRequestBody = false;
for (JavaAnnotation annotation : annotations) {
String annotationName = annotation.getType().getValue();
if (SpringMvcAnnotations.REQUEST_HERDER.equals(annotationName)) {
@ -511,11 +512,14 @@ public class SpringBootDocBuildTemplate implements IDocBuildTemplate<ApiDoc> {
+ javaMethod.getName() + " in " + className + ",@RequestBody annotation could only bind one variables.");
}
requestBodyCounter++;
isRequestBody = true;
}
}
boolean required = Boolean.parseBoolean(strRequired);
if (isPathVariable) {
comment = comment + " (This is path parameter.)";
} else if (!isRequestBody && requestBodyCounter > 0) {
comment = comment + " (This is query parameter.)";
}
if (JavaClassValidateUtil.isCollection(fullTypeName) || JavaClassValidateUtil.isArray(fullTypeName)) {
String[] gicNameArr = DocClassUtil.getSimpleGicName(typeName);
@ -562,7 +566,6 @@ public class SpringBootDocBuildTemplate implements IDocBuildTemplate<ApiDoc> {
}
// param is enum
else if (javaClass.isEnum()) {
String o = JavaClassUtil.getEnumParams(javaClass);
ApiParam param = ApiParam.of().setField(paramName)
.setId(paramList.size() + 1)