davsclaus opened a new pull request, #28253: URL: https://github.com/apache/camel/pull/28253
Follow-up of #28210, addressing the [review of @oscerd](https://github.com/apache/camel/pull/28210#issuecomment) as promised there. ## Changes 1. **An index after a filter** (`JsonPathChecks.filterProblem`): the `resultType: java.util.Map` advice is given only when the index ends the path. For `$[?(@.sku == 'X')][0].qty` the answer is now the path without the index (`$[?(@.sku == 'X')].qty`) and a `resultType` of the value's type, such as `java.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. 2. **In a `when` or `filter`** (found with `SimpleChecks.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} == null` recipe. The one-element texts (`ONE_ELEMENT`, `JSONPATH_ONE_ELEMENT`, `filterNote`, `listHint`) say that the result is null also when several elements match. 3. **`noKeysHint`**: `${body[qty]}` on a List or array leads to the jsonpath filter first, then `[0][qty]`, the same way `listHint` does for `${body.qty}`. Both use one helper. 4. **Tests**: `addFilterNote` is tested without the download gate. New `JsonPathChecksTest` cases cover `[0].qty`, `||` as a value, an index in a `filter`, and the valid neighbour `$.orders[?(@.id == 1)].items[0]`. 5. `CatalogDocsTest` uses the imported `CamelCatalog`/`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](https://claude.com/claude-code) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
