jamesnetherton opened a new pull request, #30376: URL: https://github.com/apache/camel/pull/30376
[CAMEL-27176](https://issues.apache.org/jira/browse/CAMEL-27176) Moves `camel-jq` from jackson-jq 1 on Jackson 2 to jackson-jq 2 (`2.0.0-alpha2`) with its Jackson 3 provider, so `camel-jq` no longer brings Jackson 2. jackson-jq 2 is only available as an alpha so far. The PR uses `2.0.0-alpha2`. ### Changes - **Dependencies:** the `net.thisptr.jackson.jq.v2` artifacts (core, the Jackson 3 provider, the joni regex implementation and the `jackson-jq-ext-module-*` modules) replace `net.thisptr:jackson-jq` and `jackson-jq-extra`. `camel-jackson3` replaces `camel-jackson`. - **Scope → Environment:** the jackson-jq 1 `Scope` is replaced by the v2 `Environment`. A custom one can still be bound in the registry, and is used as-is because a built environment cannot be changed. `JqFunctions.newEnvironmentBuilder(camelContext)` gives a builder with the jq builtins, the Camel functions and the modules on the classpath. - **Camel functions** (`header`, `property`, `variable`, `constant`, `body`): ported to the v2 `Function` SPI. They are registered through the jackson-jq ServiceLoader lookup and also defined on the environments Camel builds, so they win over a function with the same signature from another jar or the registry, as before. - **Registry functions:** a function bound as `name/arity` takes that number of arguments, and one bound under its name alone takes any number, as before. - **Input:** a Jackson 2 node is read as its JSON text, as in `camel-jsonpath`. The source is evaluated once. - **camel-kamelet-main:** `camel run` maps the `net.thisptr.jackson.jq.v2` package to the v2 artifacts. - **camel-aws-bedrock:** a test with a mocked client checks that jq reads the AI21 completions, which are Jackson 3 nodes. ### User-facing changes (in the 4.24 upgrade guide) - An expression without a `resultType` returns a `tools.jackson.databind.JsonNode`. - `constant` takes a JSON value: `constant("sweden")` instead of `constant(sweden)`. - `hostname` no longer exists. - The `jackson-jq-extra` functions moved to jq modules, which an expression must import, e.g. `import "jackson-jq/uuid" as uuid; .id = uuid::uuid4`. - Java extensions must be ported: registry functions implement `net.thisptr.jackson.jq.v2.spi.Function`, and a custom root scope becomes an `Environment<tools.jackson.databind.JsonNode>`. `getScope()`/`setScope()`/`getRootScope()` become `getEnvironment()`/`setEnvironment()`. _Claude Code on behalf of jamesnetherton_ 🤖 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]
