support short annotation name
This commit is contained in:
parent
a648962b39
commit
59007f8ac6
|
@ -992,6 +992,7 @@ public class SourceBuilder {
|
|||
}
|
||||
boolean containsBrace = apiMethodDoc.getUrl().replace(DEFAULT_SERVER_URL, "").contains("{");
|
||||
Map<String, String> paramsMap = new LinkedHashMap<>();
|
||||
List<String> springMvcRequestAnnotations = SpringMvcRequestAnnotations.listSpringMvcRequestAnnotations();
|
||||
for (JavaParameter parameter : parameterList) {
|
||||
JavaType javaType = parameter.getType();
|
||||
String simpleTypeName = javaType.getValue();
|
||||
|
@ -1010,8 +1011,8 @@ public class SourceBuilder {
|
|||
String defaultVal = null;
|
||||
boolean notHasRequestParams = true;
|
||||
for (JavaAnnotation annotation : annotations) {
|
||||
String fullName = annotation.getType().getFullyQualifiedName();
|
||||
if (!fullName.contains(DocGlobalConstants.SPRING_WEB_ANNOTATION_PACKAGE)) {
|
||||
String fullName = annotation.getType().getSimpleName();
|
||||
if (!springMvcRequestAnnotations.contains(fullName)) {
|
||||
continue;
|
||||
}
|
||||
String annotationName = annotation.getType().getSimpleName();
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
package com.power.doc.constants;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author yu 2019/12/20.
|
||||
*/
|
||||
public enum SpringMvcRequestAnnotations {
|
||||
|
||||
PATH_VARIABLE("PathVariable"),
|
||||
REQ_PARAM ("RequestParam"),
|
||||
REQUEST_BODY("RequestBody"),
|
||||
REQUEST_HERDER ("RequestHeader"),
|
||||
;
|
||||
private String value;
|
||||
|
||||
SpringMvcRequestAnnotations(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public static List<String> listSpringMvcRequestAnnotations() {
|
||||
List<String> annotations = new ArrayList<>();
|
||||
for (SpringMvcRequestAnnotations annotation : SpringMvcRequestAnnotations.values()) {
|
||||
annotations.add(annotation.value);
|
||||
}
|
||||
return annotations;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue