CAMEL-22857 Convert camel to Jackson 3 - use jackson 3 in all camel components, use camel-jackson3 over camel-jackson#21800
CAMEL-22857 Convert camel to Jackson 3 - use jackson 3 in all camel components, use camel-jackson3 over camel-jackson#21800cunningt wants to merge 3 commits intoapache:mainfrom
Conversation
|
🌟 Thank you for your contribution to the Apache Camel project! 🌟 🐫 Apache Camel Committers, please review the following items:
|
b3b7d82 to
ee069f2
Compare
7963816 to
9b64b99
Compare
|
Are we planning to do this for 4.19? There wont be any Jackson 3 support in Quarkus until 4.x is released later this year. |
9b64b99 to
b664822
Compare
gnodet
left a comment
There was a problem hiding this comment.
In-depth Review of Jackson 3 Migration
Overall this is a thorough and well-executed migration across 500+ files. The import renames, API changes (e.g., JsonSerializer → ValueSerializer, fields() → properties(), etc.), and ObjectMapper immutability patterns are generally handled well. CI passes on both JDK 21 and JDK 25.
Bugs Found
1. CBORDataFormat: prettyPrint rebuild result discarded
In components/camel-cbor/src/main/java/org/apache/camel/component/cbor/CBORDataFormat.java, the prettyPrint block does:
objectMapper.rebuild()
.enable(SerializationFeature.INDENT_OUTPUT)
.build();The result of .build() is not assigned back to objectMapper, so INDENT_OUTPUT is silently lost. Compare with the enableFeatures/disableFeatures blocks in the same file which correctly do objectMapper = objectMapper.rebuild()...build().
2. ObjectMapperHelper (LevelDB): customModule registration discarded
In components/camel-leveldb/src/main/java/.../ObjectMapperHelper.java:
if (customModule != null) {
objectMapper.rebuild().addModule(customModule);
}
return objectMapper;Two issues: (a) .build() is never called, and (b) the result is never assigned back. The custom module is completely ignored. Should be:
if (customModule != null) {
objectMapper = objectMapper.rebuild().addModule(customModule).build();
}Concerns
3. Inconsistent asText() vs asString() usage
In Jackson 3, JsonNode.asText() was renamed to asString(). The PR mixes both:
DefaultJsonUriSchemaLoader.javausesnode.get("$schema").asText()(Jackson 2 name)AsNestedPropertyDeserializer.javausesnode.asText()(Jackson 2 name)YamlTestSupport.groovyusesSCHEMA_NODE.get('$schema').asString()(Jackson 3 name)
While asText() may still work as a deprecated alias, the PR should be consistent and use asString() everywhere.
4. Unused properties in parent POM
Two new properties appear unused:
nitrite-version(3.4.4) — no nitrite files changed in this PRjackson-datatype-version(3.0.0-rc2) — not referenced by any${jackson-datatype-version}
5. Alpha dependency: jackson-jq
jackson-jq-version is set to 2.0.0-alpha1. If the alpha API changes before GA, it could break the build.
6. Public API change (intentional but needs documentation)
Multiple components now expose tools.jackson.databind.ObjectMapper instead of com.fasterxml.jackson.databind.ObjectMapper in their public APIs (json-validator, salesforce, servicenow, ocsf). This is binary-incompatible. Should be documented in the migration guide/release notes.
Positive Observations
- Import migration is thorough — no stale
com.fasterxml.jacksonreferences in new code JavaTimeModuleremovals are correct (Jackson 3 has built-in java.time support)- Velocity templates for Salesforce code generation properly handle the annotation package split
networknt json-schema-validatormigration (1.5.9 → 3.0.0) is done comprehensively- Jackson 2 coexistence for remaining components (
camel-opensearch,camel-jslt) is correctly handled with version pinning
b664822 to
846d00a
Compare
|
Fixed 1-4.
Double checked jackson-jq and 2.0.0-alpha1 is still the only 2.0.0 release. The 2.0.0 milestone is necessary because it provides Jackson 3 support. |
Description
There are five components that cannot upgrade to Jackson 3. They are still using Jackson 2 but since Jackson 2 and Jackson 3 maintain different package names there do not seem to be any issues with them staying on Jackson 2 temporarily
Target
mainbranch)Tracking
Apache Camel coding standards and style
[x ] I checked that each commit in the pull request has a meaningful subject line and body.
[x ] I have run
mvn clean install -DskipTestslocally from root folder and I have committed all auto-generated changes.