Claus Ibsen created CAMEL-25485:
-----------------------------------
Summary: camel-jbang - the validator does not report a top-level
ternary in a Simple expression that starts with resource:
Key: CAMEL-25485
URL: https://issues.apache.org/jira/browse/CAMEL-25485
Project: Camel
Issue Type: Bug
Components: camel-jbang
Reporter: Claus Ibsen
Follow-up of CAMEL-24826 (camel validate flags a ternary operator written
outside ${...}, where it is literal text).
SimpleChecks.checkText returns early for a text that starts with "resource:",
as the expression is then loaded from a file. But the location is a Simple
template itself, so a ternary written in it is not reported:
{code}
- setBody:
expression:
simple: "resource:file:${exchangeProperty.CamelTimerCounter} == 1 ?
order.json : order-bad-email.json"
{code}
At runtime the "== 1 ? ... : ..." is literal text, and the route fails with
"Cannot load resource file:2 == 1 ? order.json : order-bad-email.json". The
right form is resource:file:${exchangeProperty.CamelTimerCounter == 1 ?
'order.json' : 'order-bad-email.json'}.
Seen in the local-model benchmark (transform-groovy step 3, failed this way
since the first series, 3 of 5 runs in the latest): the model gets only the
runtime message and does not see why.
Proposal: for a resource: text, skip the syntax check of the content as today,
but still run the top-level ternary check on the text, so camel validate and
the MCP write tool report it with the existing CAMEL-24826 message.
_Claude Code on behalf of davsclaus_
--
This message was sent by Atlassian Jira
(v8.20.10#820010)