From e712d586ee478d9cd991b1e6e2c37151ee4f4627 Mon Sep 17 00:00:00 2001 From: gongzhongqiang Date: Thu, 10 Aug 2023 17:30:28 +0800 Subject: [PATCH] [ISSUE #4988] Fix swagger doc registered appName use contextPath --- .../manager/impl/PullSwaggerDocServiceImpl.java | 1 - .../manager/impl/RegisterApiDocServiceImpl.java | 10 +++++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/shenyu-admin/src/main/java/org/apache/shenyu/admin/service/manager/impl/PullSwaggerDocServiceImpl.java b/shenyu-admin/src/main/java/org/apache/shenyu/admin/service/manager/impl/PullSwaggerDocServiceImpl.java index 2ca4e34b3438..6ea2de9f51cf 100644 --- a/shenyu-admin/src/main/java/org/apache/shenyu/admin/service/manager/impl/PullSwaggerDocServiceImpl.java +++ b/shenyu-admin/src/main/java/org/apache/shenyu/admin/service/manager/impl/PullSwaggerDocServiceImpl.java @@ -25,7 +25,6 @@ import java.util.Set; import javax.annotation.Resource; -import io.vertx.core.json.Json; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.math.NumberUtils; diff --git a/shenyu-admin/src/main/java/org/apache/shenyu/admin/service/manager/impl/RegisterApiDocServiceImpl.java b/shenyu-admin/src/main/java/org/apache/shenyu/admin/service/manager/impl/RegisterApiDocServiceImpl.java index 5b7064b491fb..f73be9045bf7 100644 --- a/shenyu-admin/src/main/java/org/apache/shenyu/admin/service/manager/impl/RegisterApiDocServiceImpl.java +++ b/shenyu-admin/src/main/java/org/apache/shenyu/admin/service/manager/impl/RegisterApiDocServiceImpl.java @@ -60,16 +60,16 @@ public void registerApiDocument(final ApiDocRegisterDTO apiDocRegisterDTO) { tags = apiDocRegisterDTO.getTags(); } for (String tag : tags) { - // tag is contextPath,so remove first char '/' - tag = tag.substring(1); - List byQuery = tagService.findByQuery(tag); + // tag value is contextPath,so remove first char '/' + String appName = tag.substring(1); + List byQuery = tagService.findByQuery(appName); if (CollectionUtils.isNotEmpty(byQuery)) { tagsIds.addAll(byQuery.stream().map(TagVO::getId).collect(Collectors.toList())); } else { TagDTO tagDTO = new TagDTO(); String id = UUIDUtils.getInstance().generateShortUuid(); - tagDTO.setTagDesc(tag); - tagDTO.setName(tag); + tagDTO.setTagDesc(appName); + tagDTO.setName(appName); tagDTO.setId(id); tagService.createRootTag(tagDTO, null); tagsIds.add(id);