Skip to content
This repository was archived by the owner on Dec 4, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion src/main/java/com/ly/doc/builder/openapi/OpenApiBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

import com.ly.doc.constants.DocGlobalConstants;
import com.ly.doc.constants.Methods;
import com.ly.doc.constants.OpenApiTagNameTypeEnum;
import com.ly.doc.constants.ParamTypeConstants;
import com.ly.doc.helper.JavaProjectBuilderHelper;
import com.ly.doc.model.ApiConfig;
Expand Down Expand Up @@ -159,7 +160,17 @@ public Map<String, Object> buildPathUrlsRequest(ApiConfig apiConfig, ApiMethodDo
// } else {
// request.put("tags", new String[]{tag});
// }
request.put("tags", apiMethodDoc.getTagRefs().stream().map(TagDoc::getTag).toArray());
OpenApiTagNameTypeEnum openApiTagNameType = apiConfig.getOpenApiTagNameType();
switch (openApiTagNameType) {
case DESCRIPTION:
request.put("tags", new String[] { apiDoc.getDesc() });
break;
case PACKAGE_NAME:
request.put("tags", new String[] { apiDoc.getPackageName() });
break;
default:
request.put("tags", apiMethodDoc.getTagRefs().stream().map(TagDoc::getTag).toArray());
}
request.put("requestBody", this.buildRequestBody(apiConfig, apiMethodDoc));
request.put("parameters", this.buildParameters(apiMethodDoc));
request.put("responses", this.buildResponses(apiConfig, apiMethodDoc, apiExceptionStatuses));
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/com/ly/doc/model/ApiConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -1201,6 +1201,9 @@ public void setAllowSelfReference(boolean allowSelfReference) {
}

public OpenApiTagNameTypeEnum getOpenApiTagNameType() {
if (Objects.isNull(openApiTagNameType)) {
return OpenApiTagNameTypeEnum.CLASS_NAME;
}
return openApiTagNameType;
}

Expand Down
3 changes: 3 additions & 0 deletions src/main/java/com/ly/doc/model/openapi/OpenApiTag.java
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@ public static OpenApiTag of(String name, String description) {
* @return OpenApiTag
*/
public static OpenApiTag of(OpenApiTagNameTypeEnum openApiTagNameType, ApiDoc apiDoc) {
if (Objects.isNull(openApiTagNameType)) {
return of(apiDoc.getName(), apiDoc.getDesc());
}
switch (openApiTagNameType) {
case DESCRIPTION:
return new OpenApiTag(apiDoc.getDesc(), apiDoc.getDesc());
Expand Down