feat(kotlin-client): add Jackson 3 support with useJackson3 option#23161
Draft
yonatankarp wants to merge 3 commits intoOpenAPITools:masterfrom
Draft
feat(kotlin-client): add Jackson 3 support with useJackson3 option#23161yonatankarp wants to merge 3 commits intoOpenAPITools:masterfrom
yonatankarp wants to merge 3 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
2bdb660 to
4535b51
Compare
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.
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
AbstractKotlinCodegenJackson 3 infrastructure into the kotlin client generatoruseJackson3=true(requiresserializationLibrary=jackson), all templates use thetools.jacksonpackage instead ofcom.fasterxml.jackson, andbuild.gradlepullsjackson-module-kotlin 3.0.1without the separate JSR-310 moduleuseJackson3CLI option with validation (requires jackson serialization, incompatible withopenApiNullable)com.fasterxml.jacksonwith{{jacksonPackage}}in all model, serializer, and library-specific templatesJavaTimeModuleconditional (not needed in Jackson 3) for jvm-ktorkotlin-jackson3sample config, generated sample, CI workflow entry, and regenerated docsTest plan
useJackson3with non-jackson serialization and withopenApiNullableimport tools.jackson.annotation.JsonProperty(notcom.fasterxml.jackson)build.gradlecontainstools.jackson.module:jackson-module-kotlinand nojackson-datatype-jsr310samples-kotlin-clientworkflowSummary by cubic
Adds Jackson 3 support to the Kotlin client via a new useJackson3 option. Switches templates to tools.jackson for databind/core/module, keeps annotations at com.fasterxml.jackson.annotation, updates Gradle deps, and adjusts the serializer for Jackson 3 API changes.
New Features
Migration
Written for commit e657ce3. Summary will update on new commits.