[ 
https://issues.apache.org/jira/browse/CAMEL-24915?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18118155#comment-18118155
 ] 

Claus Ibsen commented on CAMEL-24915:
-------------------------------------

Parked for now, with the reasoning recorded.

Measured cost: across the s10/s11 benchmark series the refusal happened 11 
times, and in 11 of 11 the very next tool call wrote the long form correctly - 
the hint from CAMEL-24702 does its job. So the shortcut buys one round trip, 
not a passing step; it is ergonomics, not correctness.

Against it: the schema side needs the shared ExpressionSubElementDefinition 
definition to become anyOf [boolean, object], and a value that is either a 
boolean or an expression object is awkward for tooling - editors, completion, 
Kaoto and any generator that walks the schema have to handle both shapes for 
the same property.

Decision: keep this open as a candidate, to be considered together with the 
other quick shortcuts for the YAML DSL rather than one at a time, so the anyOf 
cost is paid once for a set of shortcuts that is worth it as a whole. Lowered 
to Minor to reflect that.

> camel-yaml-dsl: accept a plain value for handled and the other expression 
> sub-elements as a constant
> ----------------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-24915
>                 URL: https://issues.apache.org/jira/browse/CAMEL-24915
>             Project: Camel
>          Issue Type: Improvement
>          Components: camel-yaml-dsl
>            Reporter: Claus Ibsen
>            Priority: Major
>
> In the local-model benchmark (s11: 5 runs of four HTTP rungs) the single most 
> common validation failure was `handled: true` under `onException`:
> {code:yaml}
> - onException:
>     exception:
>       - org.apache.camel.http.base.HttpOperationFailedException
>     handled: true
>     ...
> {code}
> The YAML DSL refuses it, because `handled` is an 
> `ExpressionSubElementDefinition` and requires an expression:
> {noformat}
> handled: a plain value (true) found, an expression expected: write handled: 
> {constant: {expression: "true"}}
> {noformat}
> It happened 9 times across 20 runs, and it is what a human writes too - the 
> Java DSL is `.handled(true)`.
> Proposal: when an expression sub-element (`handled`, `continued`, 
> `retryWhile`, `completionPredicate`, ...) is given a plain scalar, read it as 
> a constant expression, the same value the long form produces. The refusal 
> message already says that is what the long form means, so there is no other 
> sensible reading of a scalar there.
> Touches the generated `ExpressionSubElementDefinitionDeserializers` (so the 
> generator, not the generated file) and the JSON schema, which must allow a 
> scalar next to the object form.
> Evidence: the s11 traces under the AI route benchmark; see also CAMEL-24886.



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

Reply via email to