Claus Ibsen created CAMEL-24917:
-----------------------------------
Summary: camel-yaml-dsl-validator: a to: uri that holds an
expression says to use toD:
Key: CAMEL-24917
URL: https://issues.apache.org/jira/browse/CAMEL-24917
Project: Camel
Issue Type: Improvement
Components: camel-yaml-dsl
Reporter: Claus Ibsen
>From the same benchmark runs: two runs of the http-client rung called
{noformat}
http://localhost:8080/stock/$%7Bbody.sku%7D
{noformat}
The route used {{to:}} with a uri that holds {{$\{body.sku\}}}. A static
{{to:}} does not evaluate the expression, so the placeholder is url-encoded
into the path and every call fails - hundreds of redeliveries before anyone
reads the log.
A uri with {{$\{...\}}} in it on {{to:}} is almost always meant to be {{toD:}}
(or {{toD}} with the uri in {{$\{...\}}}). Proposal: the YAML DSL validator
says so, so {{camel validate}} and the camel-jbang MCP write/edit tools catch
it before the route ever runs:
{noformat}
to: the uri holds an expression ($\{body.sku\}) but to: sends to a fixed
endpoint; write toD: to build the uri per message
{noformat}
The same check would fit as a startup WARN in core for the cases the validator
does not see (Java DSL, XML), but the static check is where it pays.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)