[ 
https://issues.apache.org/jira/browse/CAMEL-24702?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Claus Ibsen reassigned CAMEL-24702:
-----------------------------------

    Fix Version/s: 4.23.0
         Assignee: Claus Ibsen

> camel-yaml-dsl - say that an expression is expected when a plain value is 
> used for handled/continued/retryWhile/correlationExpression (handled: true)
> -----------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-24702
>                 URL: https://issues.apache.org/jira/browse/CAMEL-24702
>             Project: Camel
>          Issue Type: Improvement
>          Components: camel-yaml-dsl
>            Reporter: Claus Ibsen
>            Assignee: Claus Ibsen
>            Priority: Major
>             Fix For: 4.23.0
>
>
> In the YAML DSL the natural way to write a handled exception clause
> {code}
> - onException:
>     exception:
>       - java.lang.Exception
>     handled: true
>     steps:
>       - log: "Error: ${exception.message}"
> {code}
> is rejected by camel validate yaml ("/0/onException/handled: boolean found, 
> object expected") and by the runtime ("Error starting Camel: Error 
> constructing YAML node id: 
> org.apache.camel.model.ExpressionSubElementDefinition"). The only accepted 
> form is the expression object, handled: {constant: "true"} (or the nested 
> constant: "true"), because handled and continued are 
> ExpressionSubElementDefinition (a predicate) in the model. Java DSL has both 
> handled(boolean) and handled(Predicate); XML has the same expression element.
> Both the schema error and the runtime error are hard to act on: neither says 
> "write handled: constant: true". In the AI authoring benchmark on 2026-09-12 
> a local model wrote handled: true, got "boolean found, object expected", then 
> tried handled: {constant: true}, logException: true, a deadLetterChannel with 
> handled: true, and gave up after seven refused writes. Humans write handled: 
> true too.
> Suggested improvement, in camel-yaml-dsl:
> * accept a boolean scalar for handled and continued (and the other 
> ExpressionSubElementDefinition predicates on onException, such as retryWhile) 
> in the deserializer, wrapping it as a constant expression; the same applies 
> to the schema generated by GenerateYamlSchemaMojo (a oneOf of boolean and the 
> expression object), so tooling keeps the type information;
> * or, if the shorthand is not wanted, make the validator message say what the 
> expected form is (for example: "handled: expected an expression, for example 
> handled: {constant: true}").
> 4.23.0-SNAPSHOT; reproducer above with a throwException route.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to