gnodet-bot commented on code in PR #27532:
URL: https://github.com/apache/camel/pull/27532#discussion_r4215291439
##########
dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/TuiToolRegistry.java:
##########
@@ -1851,6 +1851,9 @@ private String callListExamples(Map<String, Object> args)
{
ex.put("bundled", ExampleHelper.isBundled(entry));
ex.put("requiresDocker", ExampleHelper.requiresDocker(entry));
ex.put("infraServices",
toJsonArray(ExampleHelper.getInfraServices(entry)));
+ if (ExampleHelper.getNeeds(entry) != null) {
+ ex.put("needs", ExampleHelper.getNeeds(entry));
Review Comment:
💡 **Nit:** Same double-call pattern here. This class already has a
`putNeeds(JsonObject, JsonObject)` helper (defined ~90 lines below) that does
exactly this — use it for consistency:
```suggestion
putNeeds(ex, entry);
```
##########
dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/ai/ToolRegistry.java:
##########
@@ -1112,6 +1112,9 @@ private static void registerExampleTools() {
jo.put("tags", entry.get("tags"));
jo.put("teaches", ExampleHelper.getTeaches(entry));
jo.put("infraServices",
ExampleHelper.getInfraServices(entry));
+ if (ExampleHelper.getNeeds(entry) != null) {
+ jo.put("needs", ExampleHelper.getNeeds(entry));
Review Comment:
💡 **Nit:** `ExampleHelper.getNeeds(entry)` is called twice — once in the
condition and once in the value. Assign to a local variable to avoid the
redundant call:
```suggestion
String needs = ExampleHelper.getNeeds(entry);
if (needs != null) {
jo.put("needs", needs);
```
--
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]