You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Claus Ibsen (Jira)" <ji...@apache.org> on 2022/10/10 07:18:00 UTC

[jira] [Updated] (CAMEL-18576) Property value can't finish with }}

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

Claus Ibsen updated CAMEL-18576:
--------------------------------
    Priority: Minor  (was: Major)

> Property value can't finish with }}
> -----------------------------------
>
>                 Key: CAMEL-18576
>                 URL: https://issues.apache.org/jira/browse/CAMEL-18576
>             Project: Camel
>          Issue Type: Bug
>            Reporter: Marco Martins
>            Priority: Minor
>
> 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)