Compare commits
7 Commits
Author | SHA1 | Date |
---|---|---|
shalousun | d72404af10 | |
shalousun | 3c0108ed15 | |
shalousun | 6049e33b8d | |
shalousun | c4fcf6d561 | |
shalousun | ad47c6094b | |
shalousun | 146387c1fb | |
shalousun | d75e388db1 |
|
@ -11,7 +11,7 @@
|
||||||
5. 修复maven插件torna-rest和torna-rpc两个task未加编译前缀的问题。
|
5. 修复maven插件torna-rest和torna-rpc两个task未加编译前缀的问题。
|
||||||
6. 修复生成json用例中数组类型json错误的问题。
|
6. 修复生成json用例中数组类型json错误的问题。
|
||||||
7. 修复customRequestFields中设置字段value在用例中不生效的bug。
|
7. 修复customRequestFields中设置字段value在用例中不生效的bug。
|
||||||
|
8. 修改基础数组类型字段formdata生成样例错误
|
||||||
#### 版本号:2.1.7
|
#### 版本号:2.1.7
|
||||||
|
|
||||||
- 更新日期: 2020-05-12
|
- 更新日期: 2020-05-12
|
||||||
|
|
|
@ -39,7 +39,7 @@ public class ApiDataBuilder {
|
||||||
* @return List of ApiDoc
|
* @return List of ApiDoc
|
||||||
*/
|
*/
|
||||||
public static ApiAllData getApiData(ApiConfig config) {
|
public static ApiAllData getApiData(ApiConfig config) {
|
||||||
return getApiData(config, false);
|
return getApiData(config, Boolean.FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -49,7 +49,7 @@ public class ApiDataBuilder {
|
||||||
* @return List of ApiDoc
|
* @return List of ApiDoc
|
||||||
*/
|
*/
|
||||||
public static ApiAllData getApiDataTree(ApiConfig config) {
|
public static ApiAllData getApiDataTree(ApiConfig config) {
|
||||||
return getApiData(config, true);
|
return getApiData(config, Boolean.TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static ApiAllData getApiData(ApiConfig config, boolean toTree) {
|
private static ApiAllData getApiData(ApiConfig config, boolean toTree) {
|
||||||
|
@ -57,7 +57,7 @@ public class ApiDataBuilder {
|
||||||
DocBuilderTemplate builderTemplate = new DocBuilderTemplate();
|
DocBuilderTemplate builderTemplate = new DocBuilderTemplate();
|
||||||
builderTemplate.checkAndInitForGetApiData(config);
|
builderTemplate.checkAndInitForGetApiData(config);
|
||||||
JavaProjectBuilder javaProjectBuilder = new JavaProjectBuilder();
|
JavaProjectBuilder javaProjectBuilder = new JavaProjectBuilder();
|
||||||
builderTemplate.getApiData(config, javaProjectBuilder);
|
ApiAllData apiAllData = builderTemplate.getApiData(config, javaProjectBuilder);
|
||||||
return builderTemplate.getApiData(config, javaProjectBuilder);
|
return apiAllData;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -322,6 +322,7 @@ public class DocBuilderTemplate extends BaseDocBuilderTemplate {
|
||||||
config.setMd5EncryptedHtmlName(true);
|
config.setMd5EncryptedHtmlName(true);
|
||||||
ProjectDocConfigBuilder configBuilder = new ProjectDocConfigBuilder(config, javaProjectBuilder);
|
ProjectDocConfigBuilder configBuilder = new ProjectDocConfigBuilder(config, javaProjectBuilder);
|
||||||
IDocBuildTemplate docBuildTemplate = new SpringBootDocBuildTemplate();
|
IDocBuildTemplate docBuildTemplate = new SpringBootDocBuildTemplate();
|
||||||
return docBuildTemplate.getApiData(configBuilder);
|
List<ApiDoc> apiDocList = docBuildTemplate.getApiData(configBuilder);
|
||||||
|
return apiDocList;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -158,14 +158,28 @@ public class FormDataBuildHelper {
|
||||||
formData.setValue(StringUtil.removeQuotes(String.valueOf(value)));
|
formData.setValue(StringUtil.removeQuotes(String.valueOf(value)));
|
||||||
formData.setDescription(comment);
|
formData.setDescription(comment);
|
||||||
formDataList.add(formData);
|
formDataList.add(formData);
|
||||||
} else if (JavaClassValidateUtil.isCollection(subTypeName)) {
|
} else if (JavaClassValidateUtil.isCollection(subTypeName) || JavaClassValidateUtil.isArray(subTypeName)) {
|
||||||
String gNameTemp = field.getType().getGenericCanonicalName();
|
String gNameTemp = field.getType().getGenericCanonicalName();
|
||||||
String[] gNameArr = DocClassUtil.getSimpleGicName(gNameTemp);
|
String[] gNameArr = DocClassUtil.getSimpleGicName(gNameTemp);
|
||||||
if (gNameArr.length == 0) {
|
if (gNameArr.length == 0) {
|
||||||
continue out;
|
continue out;
|
||||||
}
|
}
|
||||||
String gName = DocClassUtil.getSimpleGicName(gNameTemp)[0];
|
String gName = DocClassUtil.getSimpleGicName(gNameTemp)[0];
|
||||||
if (!JavaClassValidateUtil.isPrimitive(gName)) {
|
if (JavaClassValidateUtil.isPrimitive(gName)) {
|
||||||
|
String fieldValue = "";
|
||||||
|
if (tagsMap.containsKey(DocTags.MOCK) && StringUtil.isNotEmpty(tagsMap.get(DocTags.MOCK))) {
|
||||||
|
fieldValue = tagsMap.get(DocTags.MOCK);
|
||||||
|
} else {
|
||||||
|
String val = DocUtil.getValByTypeAndFieldName(gName, field.getName());
|
||||||
|
fieldValue = val + "," + val;
|
||||||
|
}
|
||||||
|
FormData formData = new FormData();
|
||||||
|
formData.setKey(pre + fieldName);
|
||||||
|
formData.setType("text");
|
||||||
|
formData.setValue(fieldValue);
|
||||||
|
formData.setDescription(comment);
|
||||||
|
formDataList.add(formData);
|
||||||
|
} else {
|
||||||
if (!simpleName.equals(gName) && !gName.equals(simpleName)) {
|
if (!simpleName.equals(gName) && !gName.equals(simpleName)) {
|
||||||
if (gName.length() == 1) {
|
if (gName.length() == 1) {
|
||||||
int len = globGicName.length;
|
int len = globGicName.length;
|
||||||
|
|
|
@ -276,25 +276,6 @@ public class ParamsBuildHelper {
|
||||||
commonHandleParam(paramList, param, isRequired, NO_COMMENTS_FOUND, since, strRequired);
|
commonHandleParam(paramList, param, isRequired, NO_COMMENTS_FOUND, since, strRequired);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ApiParam param = ApiParam.of().setField(pre + fieldName).setPid(pid).setMaxLength(maxLength);
|
|
||||||
JavaClass javaClass = projectBuilder.getJavaProjectBuilder().getClassByName(subTypeName);
|
|
||||||
if (javaClass.isEnum()) {
|
|
||||||
comment = comment + handleEnumComment(javaClass, projectBuilder);
|
|
||||||
param.setType(DocGlobalConstants.ENUM);
|
|
||||||
}
|
|
||||||
if (JavaClassValidateUtil.isCollection(subTypeName)) {
|
|
||||||
String gNameTemp = fieldGicName;
|
|
||||||
// like Student<T>, Student class has a field List<T> lists.
|
|
||||||
if (globGicName.length > 0 && JAVA_LIST_FULLY.equals(gNameTemp)) {
|
|
||||||
gNameTemp = gNameTemp + "<T>";
|
|
||||||
}
|
|
||||||
String[] gNameArr = DocClassUtil.getSimpleGicName(gNameTemp);
|
|
||||||
if (gNameArr.length > 0) {
|
|
||||||
String gName = DocClassUtil.getSimpleGicName(gNameTemp)[0];
|
|
||||||
JavaClass javaClass1 = projectBuilder.getJavaProjectBuilder().getClassByName(gName);
|
|
||||||
comment = comment + handleEnumComment(javaClass1, projectBuilder);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
String appendComment = "";
|
String appendComment = "";
|
||||||
if (displayActualType) {
|
if (displayActualType) {
|
||||||
if (globGicName.length > 0) {
|
if (globGicName.length > 0) {
|
||||||
|
@ -307,84 +288,92 @@ public class ParamsBuildHelper {
|
||||||
appendComment = " (ActualType: " + JavaClassUtil.getClassSimpleName(docField.getActualJavaType()) + ")";
|
appendComment = " (ActualType: " + JavaClassUtil.getClassSimpleName(docField.getActualJavaType()) + ")";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//如果已经设置返回类型 不需要再次设置
|
|
||||||
if (param.getType() == null) {
|
|
||||||
String processedType;
|
|
||||||
if (typeSimpleName.length() == 1) {
|
|
||||||
processedType = DocClassUtil.processTypeNameForParams(typeSimpleName.toLowerCase());
|
|
||||||
} else {
|
|
||||||
processedType = isShowJavaType ? typeSimpleName : DocClassUtil.processTypeNameForParams(typeSimpleName.toLowerCase());
|
|
||||||
}
|
|
||||||
param.setType(processedType);
|
|
||||||
}
|
|
||||||
if (!isResp && javaClass.isEnum()) {
|
|
||||||
List<JavaMethod> methods = javaClass.getMethods();
|
|
||||||
int index = 0;
|
|
||||||
|
|
||||||
enumOut:
|
|
||||||
for (JavaMethod method : methods) {
|
|
||||||
List<JavaAnnotation> javaAnnotationList = method.getAnnotations();
|
|
||||||
for (JavaAnnotation annotation : javaAnnotationList) {
|
|
||||||
if (annotation.getType().getValue().contains("JsonValue")) {
|
|
||||||
break enumOut;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (CollectionUtil.isEmpty(javaAnnotations) && index < 1) {
|
|
||||||
break enumOut;
|
|
||||||
}
|
|
||||||
index++;
|
|
||||||
}
|
|
||||||
Object value = JavaClassUtil.getEnumValue(javaClass, !jsonRequest);
|
|
||||||
param.setValue(String.valueOf(value));
|
|
||||||
param.setEnumValues(JavaClassUtil.getEnumValues(javaClass));
|
|
||||||
param.setType(DocGlobalConstants.ENUM);
|
|
||||||
}
|
|
||||||
if (StringUtil.isNotEmpty(comment)) {
|
|
||||||
commonHandleParam(paramList, param, isRequired, comment + appendComment, since, strRequired);
|
|
||||||
} else {
|
|
||||||
commonHandleParam(paramList, param, isRequired, NO_COMMENTS_FOUND + appendComment, since, strRequired);
|
|
||||||
}
|
|
||||||
StringBuilder preBuilder = new StringBuilder();
|
StringBuilder preBuilder = new StringBuilder();
|
||||||
for (int j = 0; j < level; j++) {
|
for (int j = 0; j < level; j++) {
|
||||||
preBuilder.append(DocGlobalConstants.FIELD_SPACE);
|
preBuilder.append(DocGlobalConstants.FIELD_SPACE);
|
||||||
}
|
}
|
||||||
preBuilder.append("└─");
|
preBuilder.append("└─");
|
||||||
int fieldPid = paramList.size() + pid;
|
int fieldPid;
|
||||||
if (JavaClassValidateUtil.isMap(subTypeName)) {
|
ApiParam param = ApiParam.of().setField(pre + fieldName).setPid(pid).setMaxLength(maxLength);
|
||||||
String gNameTemp = fieldGicName;
|
|
||||||
String valType = DocClassUtil.getMapKeyValueType(gNameTemp).length == 0 ? gNameTemp : DocClassUtil.getMapKeyValueType(gNameTemp)[1];
|
String processedType;
|
||||||
if (JavaClassValidateUtil.isMap(gNameTemp) || JAVA_OBJECT_FULLY.equals(valType)) {
|
if (typeSimpleName.length() == 1) {
|
||||||
ApiParam param1 = ApiParam.of().setField(preBuilder.toString() + "any object")
|
processedType = DocClassUtil.processTypeNameForParams(typeSimpleName.toLowerCase());
|
||||||
.setId(fieldPid + 1).setPid(fieldPid)
|
} else {
|
||||||
.setMaxLength(maxLength)
|
processedType = isShowJavaType ? typeSimpleName : DocClassUtil.processTypeNameForParams(typeSimpleName.toLowerCase());
|
||||||
.setType("object").setDesc(DocGlobalConstants.ANY_OBJECT_MSG).setVersion(DocGlobalConstants.DEFAULT_VERSION);
|
}
|
||||||
paramList.add(param1);
|
param.setType(processedType);
|
||||||
continue;
|
JavaClass javaClass = projectBuilder.getJavaProjectBuilder().getClassByName(subTypeName);
|
||||||
}
|
if (javaClass.isEnum()) {
|
||||||
if (!JavaClassValidateUtil.isPrimitive(valType)) {
|
comment = comment + handleEnumComment(javaClass, projectBuilder);
|
||||||
if (valType.length() == 1) {
|
param.setType(DocGlobalConstants.ENUM);
|
||||||
String gicName = genericMap.get(valType);
|
if (!isResp) {
|
||||||
if (!JavaClassValidateUtil.isPrimitive(gicName) && !simpleName.equals(gicName)) {
|
List<JavaMethod> methods = javaClass.getMethods();
|
||||||
paramList.addAll(buildParams(gicName, preBuilder.toString(), nextLevel, isRequired,
|
int index = 0;
|
||||||
isResp, registryClasses, projectBuilder, groupClasses, fieldPid, jsonRequest));
|
enumOut:
|
||||||
|
for (JavaMethod method : methods) {
|
||||||
|
List<JavaAnnotation> javaAnnotationList = method.getAnnotations();
|
||||||
|
for (JavaAnnotation annotation : javaAnnotationList) {
|
||||||
|
if (annotation.getType().getValue().contains("JsonValue")) {
|
||||||
|
break enumOut;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
if (CollectionUtil.isEmpty(javaAnnotations) && index < 1) {
|
||||||
paramList.addAll(buildParams(valType, preBuilder.toString(), nextLevel, isRequired,
|
break enumOut;
|
||||||
isResp, registryClasses, projectBuilder, groupClasses, fieldPid, jsonRequest));
|
}
|
||||||
|
index++;
|
||||||
}
|
}
|
||||||
|
Object value = JavaClassUtil.getEnumValue(javaClass, !jsonRequest);
|
||||||
|
param.setValue(String.valueOf(value));
|
||||||
|
param.setEnumValues(JavaClassUtil.getEnumValues(javaClass));
|
||||||
}
|
}
|
||||||
} else if (JavaClassValidateUtil.isCollection(subTypeName)) {
|
if (StringUtil.isNotEmpty(comment)) {
|
||||||
String gNameTemp = fieldGicName;
|
commonHandleParam(paramList, param, isRequired, comment + appendComment, since, strRequired);
|
||||||
if (globGicName.length > 0 && JAVA_LIST_FULLY.equals(gNameTemp)) {
|
} else {
|
||||||
gNameTemp = gNameTemp + "<T>";
|
commonHandleParam(paramList, param, isRequired, NO_COMMENTS_FOUND + appendComment, since, strRequired);
|
||||||
}
|
}
|
||||||
String[] gNameArr = DocClassUtil.getSimpleGicName(gNameTemp);
|
|
||||||
|
} else if (JavaClassValidateUtil.isCollection(subTypeName) || JavaClassValidateUtil.isArray(subTypeName)) {
|
||||||
|
param.setType("array");
|
||||||
|
if (globGicName.length > 0 && "java.util.List".equals(fieldGicName)) {
|
||||||
|
fieldGicName = fieldGicName + "<T>";
|
||||||
|
}
|
||||||
|
if (JavaClassValidateUtil.isArray(subTypeName)) {
|
||||||
|
fieldGicName = fieldGicName.substring(0, fieldGicName.lastIndexOf("["));
|
||||||
|
fieldGicName = "java.util.List<" + fieldGicName + ">";
|
||||||
|
}
|
||||||
|
String[] gNameArr = DocClassUtil.getSimpleGicName(fieldGicName);
|
||||||
if (gNameArr.length == 0) {
|
if (gNameArr.length == 0) {
|
||||||
continue out;
|
continue out;
|
||||||
}
|
}
|
||||||
String gName = DocClassUtil.getSimpleGicName(gNameTemp)[0];
|
if (gNameArr.length > 0) {
|
||||||
|
String gName = DocClassUtil.getSimpleGicName(fieldGicName)[0];
|
||||||
if (!JavaClassValidateUtil.isPrimitive(gName)) {
|
JavaClass javaClass1 = projectBuilder.getJavaProjectBuilder().getClassByName(gName);
|
||||||
|
comment = comment + handleEnumComment(javaClass1, projectBuilder);
|
||||||
|
}
|
||||||
|
String gName = gNameArr[0];
|
||||||
|
if (JavaClassValidateUtil.isPrimitive(gName)) {
|
||||||
|
String builder = DocUtil.jsonValueByType(gName) +
|
||||||
|
"," +
|
||||||
|
DocUtil.jsonValueByType(gName);
|
||||||
|
if (StringUtil.isEmpty(fieldValue)) {
|
||||||
|
param.setValue(DocUtil.handleJsonStr(builder));
|
||||||
|
} else {
|
||||||
|
param.setValue(fieldValue);
|
||||||
|
}
|
||||||
|
if (StringUtil.isNotEmpty(comment)) {
|
||||||
|
commonHandleParam(paramList, param, isRequired, comment + appendComment, since, strRequired);
|
||||||
|
} else {
|
||||||
|
commonHandleParam(paramList, param, isRequired, NO_COMMENTS_FOUND + appendComment, since, strRequired);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (StringUtil.isNotEmpty(comment)) {
|
||||||
|
commonHandleParam(paramList, param, isRequired, comment + appendComment, since, strRequired);
|
||||||
|
} else {
|
||||||
|
commonHandleParam(paramList, param, isRequired, NO_COMMENTS_FOUND + appendComment, since, strRequired);
|
||||||
|
}
|
||||||
|
fieldPid = paramList.size() + pid;
|
||||||
if (!simpleName.equals(gName) && !gName.equals(simpleName)) {
|
if (!simpleName.equals(gName) && !gName.equals(simpleName)) {
|
||||||
JavaClass arraySubClass = projectBuilder.getJavaProjectBuilder().getClassByName(gName);
|
JavaClass arraySubClass = projectBuilder.getJavaProjectBuilder().getClassByName(gName);
|
||||||
if (arraySubClass.isEnum()) {
|
if (arraySubClass.isEnum()) {
|
||||||
|
@ -408,19 +397,44 @@ public class ParamsBuildHelper {
|
||||||
isResp, registryClasses, projectBuilder, groupClasses, fieldPid, jsonRequest));
|
isResp, registryClasses, projectBuilder, groupClasses, fieldPid, jsonRequest));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} else if (JavaClassValidateUtil.isMap(subTypeName)) {
|
||||||
|
if (StringUtil.isNotEmpty(comment)) {
|
||||||
|
commonHandleParam(paramList, param, isRequired, comment + appendComment, since, strRequired);
|
||||||
} else {
|
} else {
|
||||||
String builder = "[" +
|
commonHandleParam(paramList, param, isRequired, NO_COMMENTS_FOUND + appendComment, since, strRequired);
|
||||||
DocUtil.jsonValueByType(gName) +
|
}
|
||||||
"," +
|
fieldPid = paramList.size() + pid;
|
||||||
DocUtil.jsonValueByType(gName) +
|
String gNameTemp = fieldGicName;
|
||||||
"]";
|
String valType = DocClassUtil.getMapKeyValueType(gNameTemp).length == 0 ? gNameTemp : DocClassUtil.getMapKeyValueType(gNameTemp)[1];
|
||||||
if (StringUtil.isEmpty(fieldValue)) {
|
if (JavaClassValidateUtil.isMap(gNameTemp) || JAVA_OBJECT_FULLY.equals(valType)) {
|
||||||
param.setValue(DocUtil.handleJsonStr(builder));
|
ApiParam param1 = ApiParam.of().setField(preBuilder.toString() + "any object")
|
||||||
|
.setId(fieldPid + 1).setPid(fieldPid)
|
||||||
|
.setMaxLength(maxLength)
|
||||||
|
.setType("object").setDesc(DocGlobalConstants.ANY_OBJECT_MSG).setVersion(DocGlobalConstants.DEFAULT_VERSION);
|
||||||
|
paramList.add(param1);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (!JavaClassValidateUtil.isPrimitive(valType)) {
|
||||||
|
if (valType.length() == 1) {
|
||||||
|
String gicName = genericMap.get(valType);
|
||||||
|
if (!JavaClassValidateUtil.isPrimitive(gicName) && !simpleName.equals(gicName)) {
|
||||||
|
paramList.addAll(buildParams(gicName, preBuilder.toString(), nextLevel, isRequired,
|
||||||
|
isResp, registryClasses, projectBuilder, groupClasses, fieldPid, jsonRequest));
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
param.setValue(fieldValue);
|
paramList.addAll(buildParams(valType, preBuilder.toString(), nextLevel, isRequired,
|
||||||
|
isResp, registryClasses, projectBuilder, groupClasses, fieldPid, jsonRequest));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (subTypeName.length() == 1 || DocGlobalConstants.JAVA_OBJECT_FULLY.equals(subTypeName)) {
|
} else if (subTypeName.length() == 1 || DocGlobalConstants.JAVA_OBJECT_FULLY.equals(subTypeName)) {
|
||||||
|
if (StringUtil.isNotEmpty(comment)) {
|
||||||
|
commonHandleParam(paramList, param, isRequired, comment + appendComment, since, strRequired);
|
||||||
|
} else {
|
||||||
|
commonHandleParam(paramList, param, isRequired, NO_COMMENTS_FOUND + appendComment, since, strRequired);
|
||||||
|
}
|
||||||
|
fieldPid = paramList.size() + pid;
|
||||||
// handle java generic or object
|
// handle java generic or object
|
||||||
if (DocGlobalConstants.JAVA_OBJECT_FULLY.equals(subTypeName) && StringUtil.isNotEmpty(field.getComment())) {
|
if (DocGlobalConstants.JAVA_OBJECT_FULLY.equals(subTypeName) && StringUtil.isNotEmpty(field.getComment())) {
|
||||||
ApiParam param1 = ApiParam.of().setField(preBuilder.toString() + "any object")
|
ApiParam param1 = ApiParam.of().setField(preBuilder.toString() + "any object")
|
||||||
|
@ -461,21 +475,18 @@ public class ParamsBuildHelper {
|
||||||
isResp, registryClasses, projectBuilder, groupClasses, fieldPid, jsonRequest));
|
isResp, registryClasses, projectBuilder, groupClasses, fieldPid, jsonRequest));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (JavaClassValidateUtil.isArray(subTypeName)) {
|
|
||||||
fieldGicName = fieldGicName.substring(0, fieldGicName.indexOf("["));
|
|
||||||
if (className.equals(fieldGicName)) {
|
|
||||||
//do nothing
|
|
||||||
} else if (!JavaClassValidateUtil.isPrimitive(fieldGicName)) {
|
|
||||||
paramList.addAll(buildParams(fieldGicName, preBuilder.toString(), nextLevel, isRequired,
|
|
||||||
isResp, registryClasses, projectBuilder, groupClasses, fieldPid, jsonRequest));
|
|
||||||
}
|
|
||||||
} else if (simpleName.equals(subTypeName)) {
|
} else if (simpleName.equals(subTypeName)) {
|
||||||
//do nothing
|
//do nothing
|
||||||
} else {
|
} else {
|
||||||
if (!javaClass.isEnum()) {
|
if (StringUtil.isNotEmpty(comment)) {
|
||||||
paramList.addAll(buildParams(fieldGicName, preBuilder.toString(), nextLevel, isRequired,
|
commonHandleParam(paramList, param, isRequired, comment + appendComment, since, strRequired);
|
||||||
isResp, registryClasses, projectBuilder, groupClasses, fieldPid, jsonRequest));
|
} else {
|
||||||
|
commonHandleParam(paramList, param, isRequired, NO_COMMENTS_FOUND + appendComment, since, strRequired);
|
||||||
}
|
}
|
||||||
|
fieldPid = paramList.size() + pid;
|
||||||
|
paramList.addAll(buildParams(fieldGicName, preBuilder.toString(), nextLevel, isRequired,
|
||||||
|
isResp, registryClasses, projectBuilder, groupClasses, fieldPid, jsonRequest));
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}//end field
|
}//end field
|
||||||
|
|
|
@ -823,9 +823,14 @@ public class SpringBootDocBuildTemplate implements IDocBuildTemplate<ApiDoc> {
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean checkController(JavaClass cls) {
|
private boolean checkController(JavaClass cls) {
|
||||||
|
if (cls.isAnnotation() || cls.isEnum()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
JavaClass superClass = cls.getSuperJavaClass();
|
JavaClass superClass = cls.getSuperJavaClass();
|
||||||
List<JavaAnnotation> classAnnotations = new ArrayList<>();
|
List<JavaAnnotation> classAnnotations = new ArrayList<>();
|
||||||
classAnnotations.addAll(superClass.getAnnotations());
|
if (Objects.nonNull(superClass)) {
|
||||||
|
classAnnotations.addAll(superClass.getAnnotations());
|
||||||
|
}
|
||||||
classAnnotations.addAll(cls.getAnnotations());
|
classAnnotations.addAll(cls.getAnnotations());
|
||||||
for (JavaAnnotation annotation : classAnnotations) {
|
for (JavaAnnotation annotation : classAnnotations) {
|
||||||
String name = annotation.getType().getValue();
|
String name = annotation.getType().getValue();
|
||||||
|
@ -928,7 +933,7 @@ public class SpringBootDocBuildTemplate implements IDocBuildTemplate<ApiDoc> {
|
||||||
return annotationsList;
|
return annotationsList;
|
||||||
}
|
}
|
||||||
JavaClass superJavaClass = cls.getSuperJavaClass();
|
JavaClass superJavaClass = cls.getSuperJavaClass();
|
||||||
if (!"Object".equals(superJavaClass.getSimpleName())) {
|
if (Objects.nonNull(superJavaClass) && !"Object".equals(superJavaClass.getSimpleName())) {
|
||||||
annotationsList.addAll(getAnnotations(superJavaClass));
|
annotationsList.addAll(getAnnotations(superJavaClass));
|
||||||
}
|
}
|
||||||
return annotationsList;
|
return annotationsList;
|
||||||
|
|
Loading…
Reference in New Issue