增加忽略请求参数的设置 使用 @param User user信息 @ignore 忽略user参数
This commit is contained in:
parent
cdfd663c44
commit
e96b685fdb
|
@ -378,8 +378,6 @@ public class OpenApiBuilder {
|
|||
requiredList.add(param.getField());
|
||||
}
|
||||
String field = param.getField();
|
||||
//去除filed的前缀
|
||||
field = field.replaceAll("└─", "").replaceAll(" ", "");
|
||||
|
||||
propertiesData.put(field, buildPropertiesData(param));
|
||||
}
|
||||
|
|
|
@ -47,6 +47,7 @@ import java.util.stream.Stream;
|
|||
import static com.power.doc.constants.DocGlobalConstants.FILE_CONTENT_TYPE;
|
||||
import static com.power.doc.constants.DocGlobalConstants.JSON_CONTENT_TYPE;
|
||||
import static com.power.doc.constants.DocTags.IGNORE;
|
||||
import static com.power.doc.constants.DocTags.PARAM;
|
||||
|
||||
/**
|
||||
* @author yu 2019/12/21.
|
||||
|
@ -214,12 +215,18 @@ public class SpringBootDocBuildTemplate implements IDocBuildTemplate<ApiDoc> {
|
|||
ApiRequestExample requestExample = ApiRequestExample.builder();
|
||||
out:
|
||||
for (JavaParameter parameter : parameterList) {
|
||||
|
||||
JavaType javaType = parameter.getType();
|
||||
String paramName = parameter.getName();
|
||||
String typeName = javaType.getFullyQualifiedName();
|
||||
String gicTypeName = javaType.getGenericCanonicalName();
|
||||
String rewriteClassName = null;
|
||||
|
||||
String commentClass = paramsComments.get(paramName);
|
||||
//过滤请求参数
|
||||
if(Objects.nonNull(commentClass) && commentClass.contains(IGNORE)){
|
||||
continue;
|
||||
}
|
||||
if (Objects.nonNull(commentClass) && !DocGlobalConstants.NO_COMMENTS_FOUND.equals(commentClass)) {
|
||||
String[] comments = commentClass.split("\\|");
|
||||
rewriteClassName = comments[comments.length - 1];
|
||||
|
@ -424,6 +431,9 @@ public class SpringBootDocBuildTemplate implements IDocBuildTemplate<ApiDoc> {
|
|||
out:
|
||||
for (JavaParameter parameter : parameterList) {
|
||||
String paramName = parameter.getName();
|
||||
if(Objects.nonNull(paramTagMap.get(paramName)) && paramTagMap.get(paramName).contains(IGNORE)){
|
||||
continue;
|
||||
}
|
||||
if (jsonParamSet.size() > 0 && !jsonParamSet.contains(paramName)) {
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -18,12 +18,15 @@ public class ApiParamTreeUtil {
|
|||
List<ApiParam> params = new ArrayList<>();
|
||||
// find root
|
||||
for (ApiParam apiParam : apiParamList) {
|
||||
//去除filed的前缀
|
||||
apiParam.setField(apiParam.getField().replaceAll("└─", "").replaceAll(" ", ""));
|
||||
// pid == 0
|
||||
if (apiParam.getPid() == 0) {
|
||||
params.add(apiParam);
|
||||
}
|
||||
}
|
||||
for (ApiParam apiParam : params) {
|
||||
//去除filed的前缀
|
||||
apiParam.setChildren(getChild(apiParam.getId(), apiParamList));
|
||||
}
|
||||
return params;
|
||||
|
|
|
@ -66,7 +66,7 @@ public class ApiDocTest {
|
|||
|
||||
|
||||
long start = System.currentTimeMillis();
|
||||
OpenApiBuilder.buildOpenApi(config);
|
||||
// OpenApiBuilder.buildOpenApi(config);
|
||||
HtmlApiDocBuilder.buildApiDoc(config);
|
||||
long end = System.currentTimeMillis();
|
||||
DateTimeUtil.printRunTime(end, start);
|
||||
|
|
Loading…
Reference in New Issue