Claus Ibsen created CAMEL-24915:
-----------------------------------
Summary: 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
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)