gnodet-bot commented on code in PR #28044:
URL: https://github.com/apache/camel/pull/28044#discussion_r4306191629


##########
dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/ai/CatalogDocs.java:
##########
@@ -630,6 +635,35 @@ private static JsonObject eipDoc(
         return result;
     }
 
+    /**
+     * The top-level entries of the YAML DSL whose model is an application 
model of the catalog (models-app), not an EIP
+     * model: camel_catalog_doc and camel_catalog_find did not find 
sslContextParameters (CAMEL-25735).
+     */
+    static final List<String> APP_ENTRIES = List.of("sslContextParameters");
+
+    /** The application model of the catalog for a top-level entry (any case), 
or null. */
+    static EipModel appModel(CamelCatalog catalog, String name) {
+        String entry = APP_ENTRIES.stream().filter(e -> 
e.equalsIgnoreCase(name)).findFirst().orElse(null);
+        if (entry == null) {
+            return null;
+        }
+        try (InputStream is = catalog.getVersionManager()
+                .getResourceAsStream("org/apache/camel/catalog/models-app/" + 
entry + ".json")) {
+            if (is == null) {
+                return null;
+            }
+            EipModel model = JsonMapper.generateEipModel(new 
String(is.readAllBytes(), StandardCharsets.UTF_8));
+            // the description comes from the javadoc, with its XML example 
escaped
+            if (model.getDescription() != null) {
+                model.setDescription(model.getDescription().replace("&lt;", 
"<").replace("&gt;", ">")
+                        .replace("&quot;", "\"").replace("&amp;", "&"));
+            }
+            return model;
+        } catch (Exception e) {

Review Comment:
   🔍 **Nit:** Silent exception swallow — no diagnostic when `appModel()` fails. 
`CatalogDocs` has no logger; adding one and logging at DEBUG here (mirroring 
`CatalogSamples`) would make future catalog misses diagnosable without any user 
impact. Not a blocker, consistent with the class's style.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to