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

Claus Ibsen resolved CAMEL-25336.
---------------------------------
    Resolution: Fixed

Merged to main for 4.23.0: https://github.com/apache/camel/pull/27369 
(e008baa436e5).

_Claude Code on behalf of davsclaus_

> camel-yaml-dsl-validator - report ${...} in a constant, which is used as 
> written and never evaluated
> ----------------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-25336
>                 URL: https://issues.apache.org/jira/browse/CAMEL-25336
>             Project: Camel
>          Issue Type: Improvement
>          Components: camel-yaml-dsl
>            Reporter: Claus Ibsen
>            Priority: Minor
>             Fix For: 4.23.0
>
>
> A constant is used as written, so a simple function inside it is not 
> evaluated:
> {code:yaml}
> - setBody:
>     expression:
>       constant: '{"error": "unknown sku ${header.sku}"}'
> {code}
> answers the literal text {{unknown sku $\{header.sku\}}}. The route runs and 
> nothing reports it. In the local-model benchmark this was written 20 times 
> across the contracts-openapi-server, contracts-openapi-client and 
> connect-stock-api rungs ({{$\{header.sku\}}}, 
> {{$\{exchangeProperty.orderId\}}}, {{$\{body[qty]\}}}).
> Proposal: the YAML validator reports a simple function in a constant and 
> shows the simple form:
> {noformat}Line 10: constant: ${header.sku} is not evaluated, a constant is 
> used as written: use simple: {expression: "{'error': 'unknown sku 
> ${header.sku}'}"} for a value with expressions{noformat}
> Not reported: a constant set to a template header (CamelVelocityTemplate, 
> CamelThymeleafTemplate, ...), whose $\{...\} the template engine evaluates; 
> {{$\{HOME\}}}-style text; property placeholders; resource: constants.
> _Claude Code on behalf of davsclaus_



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

Reply via email to