[BUG][KOTLIN] Jackson3 option does not discover modules like Jackson2 does
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
調査の方向性
kotlin-client/jvm-common/infrastructure/Serializer.kt.mustache から始め、useJackson3 が false のときに生成される Jackson 2 の出力と useJackson3 ブロックを比較します。報告されたオプションを使用して jvm-spring-restclient クライアントを生成し、Jackson 3 が JsonNullableJackson3Module などのクラスパスモジュールを検出し、JsonNullable フィールドを正しく処理することを確認します。
索引モデルが issue の本文から書いたものです。
説明
Bug Report Checklist
- Have you provided a full/minimal spec to reproduce the issue?
- Have you validated the input using an OpenAPI validator?
- Have you tested with the latest master to confirm the issue still exists?
- Have you searched for related issues/PRs?
- What's the actual output vs expected output?
- [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description
Serializer generated with useJackson3: true is different from the one generated for Jackson 2: it does not load modules.
Any third-party Jackson 3 module on the classpath is silently ignored. Concrete case: org.openapitools:jackson-databind-nullable:0.2.11 ships META-INF/services/tools.jackson.databind.JacksonModule → JsonNullableJackson3Module, which never gets registered, so JsonNullable fields serialize/deserialize wrongly
openapi-generator version
7.25.0; not a regression, rather a bug in a new feature added in #24709
OpenAPI declaration file content or url
N/A (the bug is in the infrastructure code, not in models)
Generation Details
eneratorName: kotlin
configOptions:
library: jvm-spring-restclient
serializationLibrary: jackson
useSpringBoot3: true
useSpringBoot4: true
useJackson3: true
Steps to reproduce
Open <pkg>/infrastructure/Serializer.kt
Actual:
val jacksonObjectMapper: JsonMapper = jsonMapper {
addModule(kotlinModule())
...
}
Expected: parity with the Jackson 2 output, which is generated from the same template with
useJackson3: false
val jacksonObjectMapper: ObjectMapper = jacksonObjectMapper()
.findAndRegisterModules()
...
Related issues/PRs
#24709
Suggest a fix
Change kotlin-client/jvm-common/infrastructure/Serializer.kt.mustache; add findAndAddModules() as the first line of the {{#useJackson3}} jsonMapper { … } block.
- 主要言語
- Java
- スター
- 26.8k
- フォーク
- 7.7k
- 平均マージ
- 3日 16時間
- マージ済み PR(30日)
- 122
環境構築
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
OpenAPITools/openapi-generator のほかの issue
-
Issue: Bug
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
OpenAPITools/openapi-generator#25021 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
OpenAPITools/openapi-generator#24997 ·
メンテナーはふだん 1 日以内に返信
-
[BUG][KOTLIN] Fails to compile after updating to 7.25.0 with useJackson3=false useSpringBoot4=trueオープンIssue: Bug
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
OpenAPITools/openapi-generator#24842 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 86/100
OpenAPITools/openapi-generator#24830 ·
メンテナーはふだん 1 日以内に返信
-
Issue: Bug
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
OpenAPITools/openapi-generator#24816 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
OpenAPITools/openapi-generator の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
apache/arrow-java#1311 ·
メンテナーはふだん 2 日以内に返信
-
bug triage
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
メンテナーはふだん 1 日以内に返信
-
security
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
IBM/networking-java-sdk#204 ·