fix: fix null exception to group in smart-doc.json
This commit is contained in:
parent
1330e887c8
commit
be9d40ecf0
|
@ -131,7 +131,7 @@ public class BaseDocBuilderTemplate {
|
|||
} else {
|
||||
return allInOneName + suffix;
|
||||
}
|
||||
} else if (fileName.equals(suffix)) {
|
||||
} else if (StringUtil.isNotEmpty(fileName) && fileName.endsWith(suffix)) {
|
||||
return fileName;
|
||||
} else {
|
||||
return fileName + suffix;
|
||||
|
|
|
@ -117,11 +117,15 @@ public interface IDocBuildTemplate<T> {
|
|||
|
||||
List<ApiGroup> groups = apiConfig.getGroups();
|
||||
ApiDoc defaultGroup = ApiDoc.buildGroupApiDoc("default");
|
||||
|
||||
List<ApiDoc> finalApiDocs = new ArrayList<>();
|
||||
finalApiDocs.add(defaultGroup);
|
||||
AtomicInteger order = new AtomicInteger(1);
|
||||
defaultGroup.setOrder(order.getAndIncrement());
|
||||
if (CollectionUtil.isEmpty(groups)) {
|
||||
defaultGroup.getChildrenApiDocs().addAll(apiDocList);
|
||||
return finalApiDocs;
|
||||
}
|
||||
|
||||
groups.forEach(group -> {
|
||||
|
||||
ApiDoc groupApiDoc = ApiDoc.buildGroupApiDoc(group.getName());
|
||||
|
@ -129,6 +133,7 @@ public interface IDocBuildTemplate<T> {
|
|||
finalApiDocs.add(groupApiDoc);
|
||||
apiDocList.forEach(doc -> {
|
||||
|
||||
// not match, add default group
|
||||
if (!DocUtil.isMatch(group.getApis(), doc.getPackageName())) {
|
||||
defaultGroup.getChildrenApiDocs().add(doc);
|
||||
doc.setOrder(defaultGroup.getChildrenApiDocs().size());
|
||||
|
|
|
@ -19,7 +19,10 @@ for(revisionLog in revisionLogList){
|
|||
<%
|
||||
for(apiGroup in apiDocList){
|
||||
%>
|
||||
== ${apiGroup.group}
|
||||
<%
|
||||
if(apiGroupLP.size > 1) {%>
|
||||
==${apiGroup.group}
|
||||
<%} %>
|
||||
<%
|
||||
for(api in apiGroup.childrenApiDocs){
|
||||
%>
|
||||
|
|
|
@ -16,7 +16,10 @@ ${revisionLog.version}|${revisionLog.revisionTime}|${revisionLog.status}|${revis
|
|||
<%
|
||||
for(apiGroup in apiDocList){
|
||||
%>
|
||||
<%
|
||||
if(apiGroupLP.size > 1) {%>
|
||||
# ${apiGroup.group}
|
||||
<%}%>
|
||||
<%
|
||||
for(api in apiGroup.childrenApiDocs){
|
||||
%>
|
||||
|
|
Loading…
Reference in New Issue