Skip to content

[kotlin] register service-loaded Jackson modules with useJackson3 - #24876

Open
kdelay wants to merge 1 commit into
OpenAPITools:masterfrom
kdelay:fix/issue-24859-kotlin-jackson3-find-modules
Open

[kotlin] register service-loaded Jackson modules with useJackson3#24876
kdelay wants to merge 1 commit into
OpenAPITools:masterfrom
kdelay:fix/issue-24859-kotlin-jackson3-find-modules

Conversation

@kdelay

@kdelay kdelay commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

The Jackson 2 branch of Serializer.kt.mustache calls findAndRegisterModules(), so modules published via META-INF/services are registered. The Jackson 3 branch added in #24709 only calls addModule(kotlinModule()), so they are silently dropped.

Measured with jackson-databind 3.1.5 and jackson-databind-nullable:0.2.11, which ships that service file:

  • JsonMapper.builder().build() -> {"name":{"present":true,"undefined":false}}
  • .findAndAddModules().build() -> {"name":"x"}

Adding a module explicitly and by discovery registers it once, so addModule(kotlinModule()) stays.

Both jackson3 samples regenerated; ./gradlew compileKotlin on kotlin-jackson3 passes. The new test fails on master.

Fixes #24859

/cc @jimschubert @stefankoppier


Summary by cubic

Registers service-loaded Jackson modules when generating Kotlin clients with useJackson3, fixing #24859.

The Jackson 3 branch of Serializer.kt only added the Kotlin module, so third-party modules published via META-INF/services were silently dropped. It now calls findAndAddModules() to match Jackson 2 behavior. Explicit module registration is still deduplicated, so addModule(kotlinModule()) remains.

Written for commit 70a8db9. Summary will update on new commits.

Review in cubic

The Jackson 2 branch of Serializer.kt.mustache calls findAndRegisterModules(),
so any module published through META-INF/services is picked up. The Jackson 3
branch only called addModule(kotlinModule()), so those modules were dropped.

Fixes OpenAPITools#24859

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 4 files

Re-trigger cubic

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG][KOTLIN] Jackson3 option does not discover modules like Jackson2 does

1 participant