Migrate from JSON-B to Jackson - #2543
Conversation
|
@geoand ,so, I would probably do this as the intermediary first step, and when we have some basic usable Quarkus migration to Jackson 3, I would migrate this to Jackson 3. I guess that shouldn't be too hard at that point, or? |
|
I've sent quarkusio/quarkus#55086 with the quarkus work. I ran the Quarkus tests (incl. native) locally and they pass. |
|
Sure, that should work |
|
@jmartisk - at the moment the TCK is disabled. We need to get this (#2392) in so we can test this against the TCK. I did it locally and I get some failures in the tests. From a spec p.o.v we support using JsonB annotations (as this is part of the MicroProfile landscape). So as an example we can use JsonbAdapter (rather than the graphql adapter) and this should still work. Those are some of the TCK failures |
|
You mean that the TCK tests JsonbAdapter functionality? That's the one thing that I dropped support for. I guess we could try to reintroduce it somehow, but without actually using JSON-B it might be problematic |
|
Yes. In general though the spec add full support for JsonB. The adaptor part is not yet in the spec, only in the SmallRye Spec and TCK extension tests. But those are not run either (as they all run under the TCK test). |
|
Hi @jmartisk, I pushed a fix commit on top of your Jackson migration. I tested this PR locally by merging it with the TCK re-enablement PR (#2392) and running the full TCK. The original PR had 8 TCK failures, all traced back to Here's what the fix commit addresses: 1. Restore 2. Remove 3. Add 4. Fix micrometer property name typo After these fixes, all 387 TCK tests pass when merged with #2392. |
|
The core SmallRye builds (JDK 17, 21, 25) all pass after the rebase. The remaining Quarkus test failures are a pre-existing issue from the Jackson migration — they're not related to the rebase or the fix commit. The root cause is the breaking client API change where Affected Quarkus test files:
These tests need to be updated in the Quarkus extension to use |
|
For Quarkus-side tests, you should use my branch quarkusio/quarkus#55175 |
The Jackson migration PR dropped @JsonbTypeAdapter support entirely, but this annotation is part of the MicroProfile spec (JSON-B) and must keep working. This commit restores it by converting @JsonbTypeAdapter to the internal AdaptWith model at schema-build time, and ensures the runtime adapter invocation works with Jackson instead of relying on JSON-B to handle it automatically. Fixes: - Restore @JsonbTypeAdapter handling in AdaptWithHelper (schema builder) - Remove isJsonB() exclusion in InputFieldsInfo so JsonB adapters are invoked explicitly at runtime (Jackson does not handle them) - Add ComplexMapKeys module to JacksonCreator for Map fields with non-trivial key types that Jackson cannot deserialize by default - Fix micrometer property name typo (verison -> version)
- Replace .collect(Collectors.toList()) with .toList() (JDK 17+) - Add missing imports in ResponseImpl and JsonbAnnotationIntrospectorTest - Use property for jakarta.json.bind-api version instead of hardcoding
phillip-kruger
left a comment
There was a problem hiding this comment.
Thanks @jmartisk and @mskacelik !
Breaking Changes
Client API type changes
.containsKey()) must switch to Jackson equivalents (.get().asText(), .get().asInt(), .get(), .has())
Server SPI change
Map<String, ObjectMapper> instead of Map<String, Jsonb>
Dependency changes
What Still Works (No Changes Needed)
via the compatibility module
natively
Considerations
formatting, null handling)
jakarta.json.Json.createObjectBuilder(), switch to Jackson ObjectMapper.createObjectNode()