feat(kotlin-client): add Spring Boot 4 support for jvm-spring-restclient#23404
Draft
yonatankarp wants to merge 8 commits intoOpenAPITools:masterfrom
Draft
feat(kotlin-client): add Spring Boot 4 support for jvm-spring-restclient#23404yonatankarp wants to merge 8 commits intoOpenAPITools:masterfrom
yonatankarp wants to merge 8 commits intoOpenAPITools:masterfrom
Conversation
Wire the existing AbstractKotlinCodegen Jackson 3 infrastructure into
the kotlin client generator. When useJackson3=true (requires
serializationLibrary=jackson), all templates use the tools.jackson
package instead of com.fasterxml.jackson, and build.gradle pulls
jackson-module-kotlin 3.0.1 without the separate JSR-310 module.
- Register useJackson3 CLI option in KotlinClientCodegen
- Add validation: requires jackson serialization, incompatible with openApiNullable
- Replace hardcoded com.fasterxml.jackson with {{jacksonPackage}} in all
model, serializer, and library-specific templates
- Make JavaTimeModule conditional (not needed in Jackson 3) for jvm-ktor
- Add Jackson 3 dependency block in build.gradle.mustache
- Add tests for validation and generated output
- Add kotlin-jackson3 sample config and generated sample
- Add sample to CI workflow matrix
- Regenerate generator docs
Jackson 3 only moves databind/core/module to tools.jackson package. The annotations artifact stays at com.fasterxml.jackson.annotation. Also add AbstractKotlinCodegen Jackson 3 infrastructure so this branch is self-contained for CI testing.
Jackson 3 moved/renamed several APIs: - findAndRegisterModules() not needed (modules auto-discovered) - SerializationFeature.WRITE_DATES_AS_TIMESTAMPS -> DateTimeFeature - DeserializationFeature.READ_UNKNOWN_ENUM_VALUES_USING_DEFAULT_VALUE -> EnumFeature Add conditionals in Serializer.kt.mustache for Jackson 2 vs 3.
Jackson 3 ObjectMapper is immutable — no more chaining .configure()
and .setSerializationInclusion(). Use jsonMapper {} builder DSL with:
- changeDefaultPropertyInclusion for NON_ABSENT inclusion
- enable/disable for DateTimeFeature, EnumFeature, DeserializationFeature
- addModule(kotlinModule()) instead of jacksonObjectMapper()
The upstream kotlin-spring PR added a guard throwing IllegalArgumentException for useJackson3 on kotlin-client. Since this branch implements that support, remove the guard while keeping the proper validation below it. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Picks up constant renaming from upstream (OpenAPITools#23188).
Add useSpringBoot4 option that auto-enables Jackson 3 and generates RestClient code using JacksonJsonHttpMessageConverter with Spring Boot 4.
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.
Summary
useSpringBoot4option for thejvm-spring-restclientlibrary, which upgrades to Spring Boot 4 and impliesuseJackson3kotlin-jvm-spring-4-restclient-jackson3sampleDependencies
Test plan
useSpringBoot4=truecorrectly impliesuseJackson3=true🤖 Generated with Claude Code
Summary by cubic
Adds Spring Boot 4 support to the Kotlin
jvm-spring-restclientgenerator via a newuseSpringBoot4option. This switches generated clients to Spring Boot 4’sRestClientwith Jackson 3 and includes a new sample with CI coverage.New Features
useSpringBoot4forjvm-spring-restclient(sets Spring Boot to 4.x).useSpringBoot4impliesuseJackson3and usesJacksonJsonHttpMessageConverterwith a sharedSerializer.{{jacksonPackage}}; Gradle pullstools.jackson.module:jackson-module-kotlin:3.0.1.kotlin-jvm-spring-4-restclient-jackson3andkotlin-jackson3; added to CI.useJackson3; tests added to validate option constraints.Migration
useSpringBoot4=true(no need to setuseJackson3; it’s implied).serializationLibrary=jackson;useJackson3is incompatible withopenApiNullable.MappingJackson2HttpMessageConverter, the Spring 4 path now usesJacksonJsonHttpMessageConverter.Written for commit 00b3413. Summary will update on new commits.