feat(template): added hideDefaultGroup default value is false
Configurable for default group display, added hideDefaultGroup default value is false. Closes https://gitee.com/smart-doc-team/smart-doc/issues/I4IIC4
This commit is contained in:
parent
ae1738e9b8
commit
88add1c32e
|
@ -163,6 +163,14 @@ public class ApiConfig {
|
|||
* project group
|
||||
*/
|
||||
private String group;
|
||||
|
||||
/**
|
||||
* 是否隐藏默认分组
|
||||
*
|
||||
* @since 2.3.2
|
||||
*/
|
||||
private boolean hideDefaultGroup;
|
||||
|
||||
/**
|
||||
* @since 1.7.5
|
||||
* project name
|
||||
|
@ -482,6 +490,15 @@ public class ApiConfig {
|
|||
return this;
|
||||
}
|
||||
|
||||
public boolean isHideDefaultGroup() {
|
||||
return hideDefaultGroup;
|
||||
}
|
||||
|
||||
public ApiConfig setHideDefaultGroup(boolean hideDefaultGroup) {
|
||||
this.hideDefaultGroup = hideDefaultGroup;
|
||||
return this;
|
||||
}
|
||||
|
||||
public List<ApiReqParam> getRequestParams() {
|
||||
return requestParams;
|
||||
}
|
||||
|
|
|
@ -116,13 +116,20 @@ public interface IDocBuildTemplate<T> {
|
|||
return apiDocList;
|
||||
}
|
||||
List<ApiGroup> groups = apiConfig.getGroups();
|
||||
ApiDoc defaultGroup = ApiDoc.buildGroupApiDoc("default");
|
||||
List<ApiDoc> finalApiDocs = new ArrayList<>();
|
||||
finalApiDocs.add(defaultGroup);
|
||||
|
||||
ApiDoc defaultGroup = ApiDoc.buildGroupApiDoc("default");
|
||||
// show default group
|
||||
AtomicInteger order = new AtomicInteger(1);
|
||||
defaultGroup.setOrder(order.getAndIncrement());
|
||||
if (!apiConfig.isHideDefaultGroup()) {
|
||||
finalApiDocs.add(defaultGroup);
|
||||
defaultGroup.setOrder(order.getAndIncrement());
|
||||
if (CollectionUtil.isEmpty(groups)) {
|
||||
defaultGroup.getChildrenApiDocs().addAll(apiDocList);
|
||||
}
|
||||
}
|
||||
|
||||
if (CollectionUtil.isEmpty(groups)) {
|
||||
defaultGroup.getChildrenApiDocs().addAll(apiDocList);
|
||||
return finalApiDocs;
|
||||
}
|
||||
Map<String, String> hasInsert = new HashMap<>();
|
||||
|
|
Loading…
Reference in New Issue