From 35f07421e4f3f069e37ebb91b1682486cce130d7 Mon Sep 17 00:00:00 2001 From: Tomas Langer Date: Thu, 21 Nov 2024 18:13:40 +0100 Subject: [PATCH] Fix to correctly create references for config documentation provider implementations. --- .../io/helidon/config/metadata/docs/CmModule.java | 5 +++++ .../io/helidon/config/metadata/docs/ConfigDocs.java | 12 +++++++++--- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/config/metadata/docs/src/main/java/io/helidon/config/metadata/docs/CmModule.java b/config/metadata/docs/src/main/java/io/helidon/config/metadata/docs/CmModule.java index 602a44bad09..94d9520222f 100644 --- a/config/metadata/docs/src/main/java/io/helidon/config/metadata/docs/CmModule.java +++ b/config/metadata/docs/src/main/java/io/helidon/config/metadata/docs/CmModule.java @@ -66,4 +66,9 @@ public List getTypes() { public void setTypes(List types) { this.types = types; } + + @Override + public String toString() { + return module; + } } diff --git a/config/metadata/docs/src/main/java/io/helidon/config/metadata/docs/ConfigDocs.java b/config/metadata/docs/src/main/java/io/helidon/config/metadata/docs/ConfigDocs.java index 2f8d3c6a842..8278667b8ac 100644 --- a/config/metadata/docs/src/main/java/io/helidon/config/metadata/docs/ConfigDocs.java +++ b/config/metadata/docs/src/main/java/io/helidon/config/metadata/docs/ConfigDocs.java @@ -32,10 +32,12 @@ import java.util.Comparator; import java.util.Enumeration; import java.util.HashMap; +import java.util.HashSet; import java.util.LinkedList; import java.util.List; import java.util.ListIterator; import java.util.Map; +import java.util.Set; import java.util.function.Function; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -205,10 +207,13 @@ public void process() { // map of annotated types to documentation Map configuredTypes = new HashMap<>(); + Set allTypes = new HashSet<>(); for (CmModule module : allModules) { for (CmType type : module.getTypes()) { configuredTypes.put(type.getAnnotatedType(), type); + allTypes.add(type.getAnnotatedType()); + allTypes.add(type.getType()); } } @@ -225,7 +230,7 @@ public void process() { List generatedFiles = new LinkedList<>(); for (CmModule module : allModules) { - moduleDocs(configuredTypes, typeTemplate, path, module, generatedFiles); + moduleDocs(allTypes, configuredTypes, typeTemplate, path, module, generatedFiles); } // sort alphabetically by page title @@ -320,14 +325,15 @@ private static String title(String typeName) { return title; } - private static void moduleDocs(Map configuredTypes, + private static void moduleDocs(Set allTypes, + Map configuredTypes, Template template, Path modulePath, CmModule module, List generatedFiles) { Function exists = type -> { // 1: check if part of this processing - if (configuredTypes.containsKey(type)) { + if (allTypes.contains(type)) { return true; } // 2: check if exists in target directory