davsclaus commented on code in PR #28242:
URL: https://github.com/apache/camel/pull/28242#discussion_r4345790415


##########
dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/ai/CatalogDocs.java:
##########
@@ -1636,11 +1634,53 @@ private static void addCommonModelFields(JsonObject 
result, BaseModel<?> model)
         }
         if (!model.getBodyTypes().isEmpty()) {
             // what the body is after the step and what it needs, which the 
options do not say (CAMEL-24961)
-            result.put("bodyTypes", 
JsonMapper.asJsonObjectBodyTypes(model.getBodyTypes()));
+            result.put("bodyTypes", bodyTypes(model.getBodyTypes()));
             result.put("bodyTypesHint", BODY_TYPES_HINT);
         }
     }
 
+    /**
+     * The body types a line per side, as compact as the options are: the 
carriers, the Java type, the format, the
+     * description, the body for other option values, and the options that 
make it not known (CAMEL-24961).
+     */
+    static JsonObject bodyTypes(Map<String, BodyTypeModel> bodyTypes) {
+        JsonObject answer = new JsonObject();
+        for (Map.Entry<String, BodyTypeModel> entry : bodyTypes.entrySet()) {
+            BodyTypeModel side = entry.getValue();
+            StringBuilder line = new 
StringBuilder(carriers(side.getCarriers(), side.getJavaType()));
+            if (side.getFormat() != null) {
+                line.append(", as ").append(side.getFormat());
+            }
+            if (side.getDescription() != null) {
+                line.append(". ").append(side.getDescription());
+            }
+            if (!side.getByOption().isEmpty()) {
+                List<String> values = new ArrayList<>();
+                for (BodyTypeModel.OptionBodyTypeModel option : 
side.getByOption()) {
+                    values.add(option.getOption() + "=" + option.getValue() + 
": "
+                               + carriers(option.getCarriers(), 
option.getJavaType()));
+                }
+                line.append(". With ").append(String.join("; ", values));
+            }
+            if (!side.getDependsOn().isEmpty()) {
+                line.append(". Not known when ").append(String.join(" or ", 
side.getDependsOn())).append(" is set");

Review Comment:
   Applied in 4017dd4f313b: `carriers()` and the `dependsOn` list now share one 
`orList` helper, so the jms producerIn line reads "Not known when 
jmsMessageType, messageConverter or transferExchange is set". `CatalogDocsTest` 
checks that line.
   
   _Claude Code on behalf of @davsclaus._



-- 
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