Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ISSUE #4988] Fix swagger doc registered appName use contextPath #4989

Open
wants to merge 23 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
0f83b53
[ISSUE #4988] Fix swagger doc registered appName use contextPath
GOODBOY008 Aug 10, 2023
e712d58
[ISSUE #4988] Fix swagger doc registered appName use contextPath
GOODBOY008 Aug 10, 2023
bdd9d48
Merge branch 'master' into master-4988
li-keguo Aug 14, 2023
ccf8b12
Merge branch 'master' into master-4988
loongs-zhang Aug 24, 2023
09c13f1
Merge branch 'master' into master-4988
kimmking Jan 30, 2024
fa73f34
Update PullSwaggerDocServiceImpl.java
kimmking Jan 30, 2024
3c701e3
Update PullSwaggerDocServiceImpl.java
kimmking Jan 30, 2024
eefd1b1
Merge branch 'master' into master-4988
loongs-zhang Feb 20, 2024
1461ffe
Merge branch 'master' into master-4988
Aias00 Aug 14, 2024
f8847ae
Merge branch 'master' into master-4988
Aias00 Aug 30, 2024
db4ed22
Merge branch 'master' into master-4988
Aias00 Nov 20, 2024
5ae539e
Merge branch 'master' into master-4988
Aias00 Dec 5, 2024
4c7e478
Merge branch 'master' into master-4988
Aias00 Dec 5, 2024
eef22fc
Merge branch 'master' into master-4988
Aias00 Dec 6, 2024
df97584
Merge branch 'master' into master-4988
Aias00 Dec 9, 2024
7b83947
Merge branch 'master' into master-4988
Aias00 Dec 14, 2024
e49dc74
Merge branch 'master' into master-4988
Aias00 Dec 17, 2024
b179977
Merge branch 'master' into master-4988
Aias00 Dec 19, 2024
a32fbb5
Merge branch 'master' into master-4988
Aias00 Dec 26, 2024
7171bec
Merge branch 'master' into master-4988
Aias00 Dec 27, 2024
c4802bc
Merge branch 'master' into master-4988
Aias00 Dec 31, 2024
ea9d2a5
Merge branch 'master' into master-4988
Aias00 Dec 31, 2024
6bcc068
Merge branch 'master' into master-4988
Aias00 Jan 2, 2025
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
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import java.util.Objects;
import java.util.Set;
import javax.annotation.Resource;

import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.math.NumberUtils;
Expand Down Expand Up @@ -123,7 +124,7 @@ private boolean canPull(final UpstreamInstance instance, final TagVO tagVO) {
}

private TagVO saveTagVOAndAcquireLock(final UpstreamInstance instance) {
List<TagVO> tagVOList = tagService.findByQuery(instance.getContextPath(), AdminConstants.TAG_ROOT_PARENT_ID);
List<TagVO> tagVOList = tagService.findByQuery(instance.getClusterName(), AdminConstants.TAG_ROOT_PARENT_ID);
if (CollectionUtils.isNotEmpty(tagVOList)) {
TagVO tagVO = tagVOList.get(0);
TagDO.TagExt tagExt = convertTagExt(tagVO.getExt());
Expand All @@ -142,7 +143,7 @@ private TagVO saveTagVOAndAcquireLock(final UpstreamInstance instance) {
private TagVO createRootTagAndAcquireLock(final UpstreamInstance instance) {
TagDTO tagDTO = new TagDTO();
tagDTO.setTagDesc(instance.getClusterName());
tagDTO.setName(instance.getContextPath());
tagDTO.setName(instance.getClusterName());
tagDTO.setParentTagId(AdminConstants.TAG_ROOT_PARENT_ID);
TagDO.TagExt tagExt = new TagDO.TagExt();
tagExt.setDocLock(this.generateDocLock());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,16 @@ public void registerApiDocument(final ApiDocRegisterDTO apiDocRegisterDTO) {
tags = apiDocRegisterDTO.getTags();
}
for (String tag : tags) {
List<TagVO> byQuery = tagService.findByQuery(tag);
// tag value is contextPath,so remove first char '/'
String appName = tag.substring(1);
List<TagVO> 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);
Expand All @@ -76,8 +78,7 @@ public void registerApiDocument(final ApiDocRegisterDTO apiDocRegisterDTO) {
apiDTO.setTagIds(tagsIds);
apiService.createOrUpdate(apiDTO);
} else if (apiDocRegisterDTO.getEventType().equals(EventType.OFFLINE)) {
String contextPath = apiDocRegisterDTO.getContextPath();
apiService.offlineByContextPath(contextPath);
apiService.offlineByContextPath(apiDocRegisterDTO.getContextPath());
}
}

Expand Down