refactor(was-lib): use bundleId to dynamically match module-wide tool manifest requests
Some checks failed
Deploy to OCIWP / deploy (push) Has been cancelled

This commit is contained in:
jade
2026-08-18 21:00:09 +09:00
parent 35fa033a1c
commit de2d1061aa

View File

@@ -53,7 +53,7 @@ public class ToolManifestService {
} }
List<ToolManifestItem> tools = toolSupplier.get().stream() List<ToolManifestItem> tools = toolSupplier.get().stream()
.filter(tool -> isMatchCategory(categoryKey, tool.getCategoryKey())) .filter(tool -> isMatchCategory(categoryKey, tool.getCategoryKey(), bundleId))
.map(this::toManifestItem) .map(this::toManifestItem)
.sorted(Comparator.comparing(ToolManifestItem::name)) .sorted(Comparator.comparing(ToolManifestItem::name))
.toList(); .toList();
@@ -61,16 +61,21 @@ public class ToolManifestService {
return new ToolManifestResponse(bundleId, revision(bundleId, tools), tools); return new ToolManifestResponse(bundleId, revision(bundleId, tools), tools);
} }
private boolean isMatchCategory(String requestedCategory, String toolCategory) { private boolean isMatchCategory(String requestedCategory, String toolCategory, String bundleId) {
if (requestedCategory == null) { if (requestedCategory == null) {
return true; return true;
} }
if (requestedCategory.equalsIgnoreCase(toolCategory)) { if (requestedCategory.equalsIgnoreCase(toolCategory)) {
return true; return true;
} }
if ("sys".equalsIgnoreCase(requestedCategory)) {
return "iam".equalsIgnoreCase(toolCategory) || "pct".equalsIgnoreCase(toolCategory); // Return all tools in this module if the requested category matches the module's bundle ID
if (bundleId != null &&
(bundleId.equalsIgnoreCase(requestedCategory) ||
bundleId.equalsIgnoreCase("was-" + requestedCategory))) {
return true;
} }
return false; return false;
} }