[
https://issues.apache.org/jira/browse/CAMEL-24826?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18117237#comment-18117237
]
Claus Ibsen commented on CAMEL-24826:
-------------------------------------
Fixed by https://github.com/apache/camel/pull/26616
_Claude Code on behalf of davsclaus_
> camel validate: flag a ternary operator in a Simple expression, it is not
> supported and comes out as literal text
> -----------------------------------------------------------------------------------------------------------------
>
> Key: CAMEL-24826
> URL: https://issues.apache.org/jira/browse/CAMEL-24826
> Project: Camel
> Issue Type: Improvement
> Components: camel-core, camel-jbang
> Reporter: Claus Ibsen
> Assignee: Adriano Machado
> Priority: Major
> Fix For: 4.23.0
>
>
> Found twice while writing examples for CAMEL-24808 and in the local-model
> benchmark.
> Simple has no ternary operator, but a model, and a human copying from another
> language, writes one:
> {code}
> setBody:
> expression:
> simple:
> expression: "${body.size()} == 0 ? ${null} : ${body[0]}"
> {code}
> At runtime this evaluates to the literal text "1 == 0 ? : {sku=CAMEL-MUG,
> qty=42}" and is silently used as the body; a nested form inside a function
> fails at runtime with "Unknown function". *camel validate yaml* (and the
> validate tool of the MCP server) accepts both.
> Proposal: the Simple language validator (parse or a dedicated check) reports
> a " ? " with a " : " at the top level of an expression as "Simple has no
> ternary operator; use a choice, or a jsonpath/groovy expression", with the
> position. Same message from the MCP validate tool.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)