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

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

Okay so the best we can do for now is

a) allow to turn of nested placeholder globally
b) allow escaping property values
c) turn of nested on specific placeholder


> kamelets - JSon Property value can't finish with }}
> ---------------------------------------------------
>
>                 Key: CAMEL-18576
>                 URL: https://issues.apache.org/jira/browse/CAMEL-18576
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-core
>            Reporter: Marco Martins
>            Assignee: Claus Ibsen
>            Priority: Minor
>             Fix For: 3.20.0
>
>
> Hi, I'm using Quarkus Camel 2.12.3.Final with YAML DSL and Kamelets and I 
> have a problem passing a JSON value through URI as a query parameter when 
> trying to use the 
> [elasticsearch-search-source|https://github.com/apache/camel-kamelets/blob/main/kamelets/elasticsearch-search-source.kamelet.yaml]
>  with a basic query:
> {code:json}
> {"query":{"match_all":{}}} {code}
> Example on the YAML DSL:
>  * Scenario 1
> {code:yaml}
> query: '{"query":{"match_all":{}}}'{code}
> Gives
> {noformat}
> java.lang.IllegalArgumentException: Missing {{ from the text: 
> {"query":{"match_all":{}}}
> {noformat}
>  * Scenario 2
> {code:yaml}
> query: '{{myQuery}}'{code}
> Gives
> {noformat}
> java.lang.IllegalArgumentException: Missing {{ from the text: 
> {"query":{"match_all":{}}}
> {noformat}
>  * Scenario 3
> {code:yaml}
> query: '#property:myQuery'{code}
> Gives
> {noformat}
> java.lang.IllegalArgumentException: Property with key myQuery not found by 
> properties component
> {noformat}
> But using debug I've checked that the above exception occurs due to the same
> {noformat}
> java.lang.IllegalArgumentException: Missing {{ from the text: 
> {"query":{"match_all":{}}}
> {noformat}
>  * Scenario 4
> I've also tried to change the Kamelet YAML definition to use the RAW value 
> directly
> {code:yaml}
> - set-body: 
>   constant: "RAW({{myQuery}})"{code}
> With the same result
> {noformat}
> java.lang.IllegalArgumentException: Missing {{ from the text: 
> {"query":{"match_all":{}}}
> {noformat}
> I have a workaround if I add spaces in JSON like below it works in scenarios 
> 1 and 2.
> {code:json}
> { "query": { "match_all": { } } } {code}
> My point is, why do I have to change the JSON value to adapt to the Camel 
> parser? Also, there also might exist some other use case where the value 
> can't be changed.
> Why don't you simply have a function that does not try to resolve properties 
> as placeholders recursively? For example:
> {code:yaml}
> query: '{{raw:myQuery}}'{code}
> Or with a default value
> {code:yaml}
> query: '{{raw:myQuery:{"query":{"match_all":{}}}}}'{code}
> Or at least have a way to escape curly brackets.



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

Reply via email to