[REQ][Kotlin][jvm-spring-webclient] Support for useSpringBoot4 and useJackson3

オープン
#25,078 コメント 0 件 リアクション 1 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
45/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
活発
技術スタック
kotlin, spring, spring-boot
領域
tooling

調査の方向性

Start at the Kotlin generator path for library=jvm-spring-webclient and inspect how useSpringBoot3, Jackson types, WebClient codecs, and generated build dependencies are selected. Compare the existing Spring Boot 3 handling with the requested useSpringBoot4 and useJackson3 options, then verify generated code and dependencies for both flags and their defaults.

索引モデルが issue の本文から書いたものです。

説明

Enhancement: Feature
Is your feature request related to a problem? Please describe.

Spring Boot 4 (Spring Framework 7) is now GA and uses Jackson 3 (tools.jackson.*) as its default JSON library, while Jackson 2 support in Spring Framework 7 is deprecated.

The Kotlin client generator with library=jvm-spring-webclient currently offers only useSpringBoot3. The generated code is tied to Spring Boot 3 and Jackson 2, so it uses:

  • com.fasterxml.jackson.databind.ObjectMapper and related com.fasterxml.jackson.databind.* types
  • Jackson2JsonEncoder / Jackson2JsonDecoder for WebClient codecs
  • com.fasterxml.jackson.module:jackson-module-kotlin and jackson-datatype-jsr310 in the generated build files

This causes problems when the generated client is used in a Spring Boot 4 application:

  • Two Jackson major versions end up on the classpath (Jackson 2 for the generated client and Jackson 3 for the application).
  • The application's auto-configured JsonMapper and its customizations can't be reused by the generated client.
  • The generated code depends on deprecated Spring APIs (Jackson2JsonEncoder / Jackson2JsonDecoder), which will likely be removed in a future Spring release.

I'm always frustrated when I have to post-process generated sources or maintain custom templates just to make the client compile cleanly and work with Spring Boot 4.

Describe the solution you'd like

Add two new options for the Kotlin client generator with library=jvm-spring-webclient:

  1. useSpringBoot4 (default false): generates code and build files targeting Spring Boot 4 / Spring Framework 7.
  2. useJackson3 (default false, possibly implied by useSpringBoot4): generates code using Jackson 3, including:
    • tools.jackson.databind.json.JsonMapper (immutable, built via builder) instead of ObjectMapper
    • JacksonJsonEncoder / JacksonJsonDecoder instead of Jackson2JsonEncoder / Jackson2JsonDecoder
    • the tools.jackson.module:jackson-module-kotlin dependency
    • no separate jackson-datatype-jsr310, since Java time support is built into Jackson 3 core
    • annotations kept as com.fasterxml.jackson.annotation.*, which Jackson 3 still uses

The generated client would then be able to accept a JsonMapper from the application context, as it can with an ObjectMapper today.

Example configuration:

generatorName: kotlin
library: jvm-spring-webclient
additionalProperties:
  useSpringBoot4: true
  useJackson3: true
  serializationLibrary: jackson

Describe alternatives you've considered

  • Keeping Jackson 2 alongside Jackson 3: this works for now, but it duplicates dependencies, splits mapper configuration, and relies on deprecated Spring APIs.
  • Custom templates (templateDir): this is possible, but every user has to maintain a fork of the templates and keep it in sync with upstream changes.
  • Switching to kotlinx_serialization: this means a large change to the existing models and doesn't fit projects standardized on Jackson.
  • Using a different library (e.g. jvm-spring-restclient): this isn't an option for reactive code based on WebClient.

Additional context

Component Version
OpenAPI Generator 7.x.x
Spring Boot 4.0.x
Kotlin 2.x

Question: Is this on the roadmap, and roughly when could support for useSpringBoot4 / useJackson3 in jvm-spring-webclient be expected?

If it helps, I'm happy to contribute a PR given some guidance on the preferred approach:

  • Should useJackson3 be a separate flag, or implied by useSpringBoot4?
  • Should the implementation be aligned with how other Spring-based generators handle Spring Boot 4 / Jackson 3?
主要言語
Java
スター
26.9k
フォーク
7.8k
平均マージ
2日 10時間
マージ済み PR(30日)
180

環境構築

Codespaces で開く

このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

OpenAPITools/openapi-generator のほかの issue

OpenAPITools/openapi-generator の issue をすべて見る

似ている issue

Java の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。