chore:删除多余代码
This commit is contained in:
parent
6c8074b99b
commit
41d56da1cd
|
@ -116,12 +116,6 @@ public class DocBuilderTemplate {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Merge all api doc into one document
|
||||
*
|
||||
* @param apiDocList list data of Api doc
|
||||
*/
|
||||
|
||||
/**
|
||||
* Merge all api doc into one document
|
||||
*
|
||||
|
|
|
@ -84,9 +84,6 @@ public class ProjectDocConfigBuilder {
|
|||
if (CollectionUtil.isEmpty(paths)) {
|
||||
builder.addSourceTree(new File(DocGlobalConstants.PROJECT_CODE_PATH));
|
||||
} else {
|
||||
if (!paths.contains(DocGlobalConstants.PROJECT_CODE_PATH)) {
|
||||
builder.addSourceTree(new File(DocGlobalConstants.PROJECT_CODE_PATH));
|
||||
}
|
||||
for (SourceCodePath path : paths) {
|
||||
if (null == path) {
|
||||
continue;
|
||||
|
|
|
@ -5,31 +5,31 @@ package com.power.doc.constants;
|
|||
*
|
||||
* @author yu 2019/9/19.
|
||||
*/
|
||||
public class DocAnnotationConstants {
|
||||
public interface DocAnnotationConstants {
|
||||
|
||||
public static final String SHORT_CONTROLLER = "Controller";
|
||||
String SHORT_CONTROLLER = "Controller";
|
||||
|
||||
public static final String SHORT_REST_CONTROLLER = "RestController";
|
||||
String SHORT_REST_CONTROLLER = "RestController";
|
||||
|
||||
public static final String SHORT_PATH_VARIABLE = "PathVariable";
|
||||
String SHORT_PATH_VARIABLE = "PathVariable";
|
||||
|
||||
public static final String SHORT_REQ_PARAM = "RequestParam";
|
||||
String SHORT_REQ_PARAM = "RequestParam";
|
||||
|
||||
public static final String SHORT_JSON_IGNORE = "JsonIgnore";
|
||||
String SHORT_JSON_IGNORE = "JsonIgnore";
|
||||
|
||||
public static final String SHORT_JSON_PROPERTY = "JsonProperty";
|
||||
String SHORT_JSON_PROPERTY = "JsonProperty";
|
||||
|
||||
public static final String SHORT_JSON_FIELD = "JSONField";
|
||||
String SHORT_JSON_FIELD = "JSONField";
|
||||
|
||||
public static final String REQUIRED_PROP = "required";
|
||||
String REQUIRED_PROP = "required";
|
||||
|
||||
public static final String SERIALIZE_PROP = "serialize";
|
||||
String SERIALIZE_PROP = "serialize";
|
||||
|
||||
public static final String NAME_PROP = "name";
|
||||
String NAME_PROP = "name";
|
||||
|
||||
public static final String VALUE_PROP = "value";
|
||||
String VALUE_PROP = "value";
|
||||
|
||||
public static final String DEFAULT_VALUE_PROP = "defaultValue";
|
||||
String DEFAULT_VALUE_PROP = "defaultValue";
|
||||
|
||||
public static final String REQUEST_MAPPING = "RequestMapping";
|
||||
String REQUEST_MAPPING = "RequestMapping";
|
||||
}
|
||||
|
|
|
@ -3,40 +3,40 @@ package com.power.doc.constants;
|
|||
/**
|
||||
* @author yu 2019/9/13.
|
||||
*/
|
||||
public class DocTags {
|
||||
public interface DocTags {
|
||||
|
||||
/**
|
||||
* java since tag
|
||||
*/
|
||||
public static final String SINCE = "since";
|
||||
String SINCE = "since";
|
||||
|
||||
/**
|
||||
* java required tag
|
||||
*/
|
||||
public static final String REQUIRED = "required";
|
||||
String REQUIRED = "required";
|
||||
|
||||
/**
|
||||
* java param tag
|
||||
*/
|
||||
public static final String PARAM = "param";
|
||||
String PARAM = "param";
|
||||
|
||||
/**
|
||||
* java apiNote tag for method detail
|
||||
*/
|
||||
public static final String API_NOTE = "apiNote";
|
||||
String API_NOTE = "apiNote";
|
||||
|
||||
/**
|
||||
* java author tag for method author
|
||||
*/
|
||||
public static final String AUTHOR = "author";
|
||||
String AUTHOR = "author";
|
||||
|
||||
/**
|
||||
* custom ignore tag
|
||||
*/
|
||||
public static final String IGNORE = "ignore";
|
||||
String IGNORE = "ignore";
|
||||
|
||||
/**
|
||||
* custom @mock tag
|
||||
*/
|
||||
public static final String MOCK = "mock";
|
||||
String MOCK = "mock";
|
||||
}
|
||||
|
|
|
@ -25,27 +25,27 @@ package com.power.doc.constants;
|
|||
/**
|
||||
* @author yu 2019/12/21.
|
||||
*/
|
||||
public class SpringMvcAnnotations {
|
||||
public interface SpringMvcAnnotations {
|
||||
|
||||
public static final String REQUEST_MAPPING = "RequestMapping";
|
||||
String REQUEST_MAPPING = "RequestMapping";
|
||||
|
||||
public static final String GET_MAPPING = "GetMapping";
|
||||
String GET_MAPPING = "GetMapping";
|
||||
|
||||
public static final String POST_MAPPING = "PostMapping";
|
||||
String POST_MAPPING = "PostMapping";
|
||||
|
||||
public static final String PUT_MAPPING = "PutMapping";
|
||||
String PUT_MAPPING = "PutMapping";
|
||||
|
||||
public static final String DELETE_MAPPING = "DeleteMapping";
|
||||
String DELETE_MAPPING = "DeleteMapping";
|
||||
|
||||
public static final String REQUEST_HERDER = "RequestHeader";
|
||||
String REQUEST_HERDER = "RequestHeader";
|
||||
|
||||
public static final String REQUEST_PARAM = "RequestParam";
|
||||
String REQUEST_PARAM = "RequestParam";
|
||||
|
||||
public static final String REQUEST_BODY = "RequestBody";
|
||||
String REQUEST_BODY = "RequestBody";
|
||||
|
||||
public static final String CONTROLLER = "Controller";
|
||||
String CONTROLLER = "Controller";
|
||||
|
||||
public static final String REST_CONTROLLER = "RestController";
|
||||
String REST_CONTROLLER = "RestController";
|
||||
|
||||
public static final String PATH_VARIABLE = "PathVariable";
|
||||
String PATH_VARIABLE = "PathVariable";
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@ package com.power.doc.constants;
|
|||
/**
|
||||
* @author yu 2019/12/22.
|
||||
*/
|
||||
public class ValidatorAnnotations {
|
||||
public interface ValidatorAnnotations {
|
||||
|
||||
public static final String VALID = "Valid";
|
||||
String VALID = "Valid";
|
||||
}
|
||||
|
|
|
@ -147,10 +147,8 @@ public class JsonBuildHelper {
|
|||
}
|
||||
return data.toString();
|
||||
} else if (DocGlobalConstants.JAVA_OBJECT_FULLY.equals(typeName)) {
|
||||
if (DocGlobalConstants.JAVA_OBJECT_FULLY.equals(typeName)) {
|
||||
data.append("{\"object\":\" any object\"},");
|
||||
// throw new RuntimeException("Please do not return java.lang.Object directly in api interface.");
|
||||
}
|
||||
} else {
|
||||
List<JavaField> fields = JavaClassUtil.getFields(cls, 0);
|
||||
boolean isGenerics = JavaFieldUtil.checkGenerics(fields);
|
||||
|
@ -311,7 +309,9 @@ public class JsonBuildHelper {
|
|||
} else {
|
||||
data0.append("{\"waring\":\"You may have used non-display generics.\"},");
|
||||
}
|
||||
if (!isGenerics) i++;
|
||||
if (!isGenerics) {
|
||||
i++;
|
||||
}
|
||||
} else if (typeName.equals(subTypeName)) {
|
||||
data0.append("{\"$ref\":\"...\"}").append(",");
|
||||
} else {
|
||||
|
|
|
@ -91,9 +91,7 @@ public class SpringBootDocBuildTemplate implements IDocBuildTemplate {
|
|||
@Override
|
||||
public boolean ignoreReturnObject(String typeName) {
|
||||
if (JavaClassValidateUtil.isMvcIgnoreParams(typeName)) {
|
||||
if (DocGlobalConstants.MODE_AND_VIEW_FULLY.equals(typeName)) {
|
||||
return true;
|
||||
}
|
||||
return DocGlobalConstants.MODE_AND_VIEW_FULLY.equals(typeName);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -513,7 +511,7 @@ public class SpringBootDocBuildTemplate implements IDocBuildTemplate {
|
|||
if (JavaClassValidateUtil.isPrimitive(fullTypeName)) {
|
||||
ApiParam bodyParam = ApiParam.of()
|
||||
.setField(paramName).setType(DocClassUtil.processTypeNameForParams(simpleName))
|
||||
.setDesc(comment).setRequired(Boolean.valueOf(required));
|
||||
.setDesc(comment).setRequired(Boolean.parseBoolean(required));
|
||||
reqBodyParamsList.add(bodyParam);
|
||||
} else {
|
||||
if (JavaClassValidateUtil.isCollection(fullTypeName) || JavaClassValidateUtil.isArray(fullTypeName)) {
|
||||
|
@ -525,7 +523,7 @@ public class SpringBootDocBuildTemplate implements IDocBuildTemplate {
|
|||
if (JavaClassValidateUtil.isPrimitive(gicName)) {
|
||||
ApiParam bodyParam = ApiParam.of()
|
||||
.setField(paramName).setType(DocClassUtil.processTypeNameForParams(simpleName))
|
||||
.setDesc(comment).setRequired(Boolean.valueOf(required)).setVersion(DocGlobalConstants.DEFAULT_VERSION);
|
||||
.setDesc(comment).setRequired(Boolean.parseBoolean(required)).setVersion(DocGlobalConstants.DEFAULT_VERSION);
|
||||
reqBodyParamsList.add(bodyParam);
|
||||
} else {
|
||||
reqBodyParamsList.addAll(ParamsBuildHelper.buildParams(gicNameArr[0], DocGlobalConstants.ENMPTY, 0, "true", responseFieldMap, Boolean.FALSE, new HashMap<>(), builder));
|
||||
|
@ -534,7 +532,7 @@ public class SpringBootDocBuildTemplate implements IDocBuildTemplate {
|
|||
} else if (JavaClassValidateUtil.isMap(fullTypeName)) {
|
||||
if (DocGlobalConstants.JAVA_MAP_FULLY.equals(typeName)) {
|
||||
ApiParam apiParam = ApiParam.of().setField(paramName).setType("map")
|
||||
.setDesc(comment).setRequired(Boolean.valueOf(required)).setVersion(DocGlobalConstants.DEFAULT_VERSION);
|
||||
.setDesc(comment).setRequired(Boolean.parseBoolean(required)).setVersion(DocGlobalConstants.DEFAULT_VERSION);
|
||||
paramList.add(apiParam);
|
||||
continue out;
|
||||
}
|
||||
|
@ -562,13 +560,13 @@ public class SpringBootDocBuildTemplate implements IDocBuildTemplate {
|
|||
}
|
||||
ApiParam param = ApiParam.of().setField(paramName)
|
||||
.setType(DocClassUtil.processTypeNameForParams(simpleName))
|
||||
.setDesc(comment).setRequired(Boolean.valueOf(required)).setVersion(DocGlobalConstants.DEFAULT_VERSION);
|
||||
.setDesc(comment).setRequired(Boolean.parseBoolean(required)).setVersion(DocGlobalConstants.DEFAULT_VERSION);
|
||||
paramList.add(param);
|
||||
paramAdded = true;
|
||||
} else if (validatorAnnotations.contains(annotationName)) {
|
||||
ApiParam param = ApiParam.of().setField(paramName)
|
||||
.setType(DocClassUtil.processTypeNameForParams(simpleName))
|
||||
.setDesc(comment).setRequired(Boolean.valueOf(required)).setVersion(DocGlobalConstants.DEFAULT_VERSION);
|
||||
.setDesc(comment).setRequired(Boolean.parseBoolean(required)).setVersion(DocGlobalConstants.DEFAULT_VERSION);
|
||||
paramList.add(param);
|
||||
paramAdded = true;
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue