Repository navigation
CAMEL-25900: camel-jbang - AI tools: the jsonpath filter hints fit a path that goes on after the filter, and a when or filter - #28253
Conversation
…path that goes on after the filter, and a when or filter Follow-up of #28210, from the review of oscerd: - an index after a filter that ends the path is answered with resultType java.util.Map; one before a field, as in $[?(...)][0].qty, with the path without the index and the type of the value; the eval note does the same - in a when or filter, the filter alone is the condition, for an index or && and || outside the filter - the one-element texts say null also when several elements match - ${body[qty]} on a List leads to the jsonpath filter first, as ${body.qty} does - tests for the note of an evaluation without the download, [0].qty, || and $.orders[?(@.id == 1)].items[0] Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Signed-off-by: Claus Ibsen <claus.ibsen@gmail.com>
|
🌟 Thank you for your contribution to the Apache Camel project! 🌟 🐫 Apache Camel Committers, please review the following items:
|
|
🧪 CI tested the following changed modules:
🔁 1 test passed only after a retry on JDK 25 (1 retried attempt) Recovered flaky tests on JDK 25 (1)
🔬 Scalpel shadow comparison — Scalpel: 490 of 707 tested, 26 compile-only — current: 492 all testedMaveniverse Scalpel detected 490 affected modules (current approach: 492). Skip-tests mode would test 490 modules (3 direct + 488 downstream), skip tests for 26 (generated code, meta-modules) Modules only in current approach (2)
Modules Scalpel would test (490)
Modules with tests skipped (26)
💡 Manual integration tests recommended:
Build reactor — dependencies compiled but only changed modules were tested (3 modules, 6.3s total)Total reactor time: 6.3s
Top 20 slowest modules:
|
Follow-up of #28210, addressing the review of @oscerd as promised there.
Changes
JsonPathChecks.filterProblem): theresultType: java.util.Mapadvice is given only when the index ends the path. For$[?(@.sku == 'X')][0].qtythe answer is now the path without the index ($[?(@.sku == 'X')].qty) and aresultTypeof the value's type, such asjava.lang.Integer. A single match is unwrapped before the conversion, so the value comes back, not[42]converted to a Map. The eval note (ExpressionEvaluator.filterNote) reuses the same check, and gives the Map advice only for a path that ends with the filter.whenorfilter(found withSimpleChecks.isPredicate): for an index or&&/||outside the filter, the answer is that the filter alone is the condition (true when an element matches). Outside a predicate,&&/||is answered with "use the filter as the condition" in place of the Map and${body} == nullrecipe. The one-element texts (ONE_ELEMENT,JSONPATH_ONE_ELEMENT,filterNote,listHint) say that the result is null also when several elements match.noKeysHint:${body[qty]}on a List or array leads to the jsonpath filter first, then[0][qty], the same waylistHintdoes for${body.qty}. Both use one helper.addFilterNoteis tested without the download gate. NewJsonPathChecksTestcases cover[0].qty,||as a value, an index in afilter, and the valid neighbour$.orders[?(@.id == 1)].items[0].CatalogDocsTestuses the importedCamelCatalog/DefaultCamelCatalog.Tests
camel-core:SimpleTest(211),SimpleSyntaxHintsTest(33)camel-jbang-core:JsonPathChecksTest(11),ExpressionEvaluatorLanguageTest(6, the download test skipped as before),CatalogDocsTest(33)Claude Code on behalf of davsclaus
🤖 Generated with Claude Code