You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Adriano Machado (Jira)" <ji...@apache.org> on 2026/09/20 00:57:00 UTC
[jira] [Commented] (CAMEL-24845) Simple: the suggestion for ${jsonpath:$.status} is the same text (did you mean ${jsonpath:$.status}?); the function is ${jsonpath($.status)}
[ https://issues.apache.org/jira/browse/CAMEL-24845?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18117208#comment-18117208 ]
Adriano Machado commented on CAMEL-24845:
-----------------------------------------
PR: https://github.com/apache/camel/pull/26615
Root cause: {{SimpleSyntaxHints.unknownFunction}} builds the did-you-mean from {{closest()}}, whose longest-known-prefix branch returns the name *itself* when the name is a known function. {{functionName()}} stops at the colon, so {{jsonpath:$.status}} yields the name {{jsonpath}}, which matches itself, and the hint is reassembled into the text that was just rejected. Nothing asserted that the suggestion differed from the input.
The fix suggests {{${jsonpath($.status)}}} for the colon shape and {{${jsonpath(exp)}}} for the bare name, covering jq, jsonpath, xpath and simpleJsonpath, and never returns a suggestion equal to the rejected text.
Two notes on the description:
* *bean is not affected.* {{BeanFunctionFactory}} matches {{"bean:"}} and there is no {{bean(}} form, so {{${bean:myBean}}} is correct and must not be rewritten. The colon-taking set is closed: bean, date, date-with-timezone, env, sysenv, file, properties, propertiesExist, ref, type, plus the {{int:}}/{{long:}}/{{boolean:}}/{{string:}} result-type prefixes.
* *A second defect found nearby.* The "is a language, not a simple function: another language cannot be nested inside ${...}" message still listed jsonpath, xpath and jq. That text arrived with CAMEL-24703, but QueryLanguageFunctionFactory (CAMEL-22894) had already made all four real Simple functions, so {{${jsonpath}}} was told the opposite of what this ticket asks for. Fixed in the same PR.
Also fixed: {{${jq:.name}}} previously produced no hint at all, and {{${json:$.status}}} (the json alias) suggested the invalid {{${jsonpath:$.status}}}.
_Claude Code on behalf of Adriano Machado (@ammachado)_
_This was generated by an AI agent and may contain inaccuracies. Please verify before relying on it._
> Simple: the suggestion for ${jsonpath:$.status} is the same text (did you mean ${jsonpath:$.status}?); the function is ${jsonpath($.status)}
> --------------------------------------------------------------------------------------------------------------------------------------------
>
> Key: CAMEL-24845
> URL: https://issues.apache.org/jira/browse/CAMEL-24845
> Project: Camel
> Issue Type: Bug
> Components: camel-core, camel-jbang
> Reporter: Claus Ibsen
> Assignee: Adriano Machado
> Priority: Major
>
> Writing a jsonpath inside Simple the way the other functions with a colon are written:
> {code:yaml}
> - filter:
> simple: "${jsonpath:$.status} == 'paid'"
> {code}
> {{camel validate yaml}} and the runtime answer
> {code}
> Line 8: Simple syntax error: Unknown function: jsonpath:$.status (did you mean ${jsonpath:$.status}?)
> {code}
> The suggestion is the text that was rejected, so the reader (and a model, three attempts in a row in the round-2 benchmark, filter-and-multicast) keeps writing it. The working form is the function call: {{${jsonpath($.status)}}} (verified on 4.23.0-SNAPSHOT, logs "paid"). The suggestion logic that wraps an unknown function in ${} should recognise the {{name:arg}} shape for the functions that take their argument in parentheses (jsonpath, jq, xpath, bean?) and suggest {{${jsonpath($.status)}}}, with the same for the other languages Simple can embed.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)