Repository navigation
[kotlin][client] Support useJackson3 for the jvm-spring-webclient library - #25748
Open
robertunter wants to merge 6 commits into
Open
robertunter wants to merge 6 commits into
robertunter wants to merge 6 commits into
Conversation
…rary useSpringBoot4 now auto-enables Jackson 3 for jvm-spring-webclient (as for jvm-spring-restclient); an explicit useJackson3=false is honored and useJackson3=true without useSpringBoot4 is rejected. The api template uses the Spring 7 JacksonJsonEncoder/Decoder, and the Java 17 toolchain is also emitted for useSpringBoot4.
Contributor
There was a problem hiding this comment.
All reported issues were addressed across 50 files
Reply to a comment to ask cubic a question or push back. It learns from your replies.
View guided diff | Re-trigger cubic
…n3 sample Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
robertunter
marked this pull request as draft
November 19, 2026 13:34
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
robertunter
marked this pull request as ready for review
November 19, 2026 18:07
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #25078
What
Allows
useJackson3for the Kotlin client libraryjvm-spring-webclient, generating theSpring 7 Jackson 3 codecs. Previously
useJackson3was only wired up forjvm-okhttp4andjvm-spring-restclient, so webclient users had no way to move off Jackson 2.No new option is introduced —
useJackson3anduseSpringBoot4already exist; this onlywidens where they apply.
Behavior
Mirrors the existing
jvm-spring-restclientcontract (#24709 / #25130):useSpringBoot4=trueonjvm-spring-webclientnow auto-enables Jackson 3.useJackson3=falseis honored, keeping the Jackson 2 codecs.useJackson3=truewithoutuseSpringBoot4is rejected with anIllegalArgumentException,since the
JacksonJsonEncoder/JacksonJsonDecodertypes only exist in Spring 7.library=jvm-spring-webclient+useSpringBoot4=truewill now get Jackson 3 instead ofJackson 2. Code that uses
Serializer.jacksonObjectMapperdirectly (now atools.jacksonJsonMapper) may need adjusting. Opt out withuseJackson3=false; this is also requiredto keep using
openApiNullable=truewithuseSpringBoot4=true.This matches what
jvm-spring-restclientalready does — thereuseSpringBoot4=truehas auto-enabled Jackson 3 since #24709 — so the two Spring libraries stay consistent rather than diverging.How
KotlinClientCodegen.java: the auto-enable branch and both validation checks now acceptjvm-spring-webclientalongsidejvm-spring-restclient; the "requires useSpringBoot4"message is generalised to name the actual library.
libraries/jvm-spring-webclient/api.mustache: importsJacksonJsonEncoder/JacksonJsonDecoderand registers them via
defaultCodecs().jacksonJsonEncoder(...)/.jacksonJsonDecoder(...)whenuseJackson3is set, otherwise the existingJackson2Json*path.
com.fasterxml.jackson.annotation.JsonPropertystays, as Jackson 3 keeps the 2.xannotations package.
build.gradle.mustache: the Java 17 toolchain block is now emitted foruseSpringBoot4as well, without duplicating it when both Boot flags are set.
useSpringBoot4option text updated;docs/generators/kotlin.mdre-exported.
Tests
Five new cases in
KotlinClientCodegenModelTestcovering auto-enable, the explicituseJackson3=falseopt-out, the two rejection paths, unchanged Spring Boot 3 output, andan explicit
useSpringBoot4=falsenot enabling Jackson 3.→ 115 tests, 0 failures.
Samples
New sample
samples/client/petstore/kotlin-jvm-spring-4-webclient-jackson3, modelled onkotlin-jvm-spring-4-restclient-jackson3, plus itsbin/configsentry and an entry in.github/workflows/samples-kotlin-client.yaml. All existing Kotlin samples are byte-identical.The new sample builds on JDK 17 (
./gradlew build -x test→ BUILD SUCCESSFUL) againstSpring Boot 4.1.0 / Spring Framework 7.0.8.
PR checklist
cc @karismann @Zomzog @andrewemery @4brunu @yutaka0m @stefankoppier @e5l @AndreyVMarkelov
Summary by cubic
Adds
useJackson3support for the Kotlinjvm-spring-webclientlibrary so generated clients can use Spring 7's Jackson 3 codecs instead of Jackson 2.useSpringBoot4=truenow auto-enables Jackson 3, matchingjvm-spring-restclient. An explicituseJackson3=falsekeeps the Jackson 2 codecs, anduseJackson3=truewithoutuseSpringBoot4fails withIllegalArgumentException. Projects already usingjvm-spring-webclientwithuseSpringBoot4=truewill switch from Jackson 2 to Jackson 3; setuseJackson3=falseto stay on Jackson 2.Changes
api.mustachetemplate based onuseJackson3.useSpringBoot4in the generatedbuild.gradle.useSpringBoot4=false, plus a new petstore samplekotlin-jvm-spring-4-webclient-jackson3.Written for commit f5bf981. Summary will update on new commits.