Repository navigation
[kotlin][client] Respect explicit useJackson3=false with useSpringBoot4 on jvm-spring-restclient - #25130
Merged
wing328 merged 1 commit intoOct 7, 2026
Conversation
…t4 on jvm-spring-restclient (OpenAPITools#24842) Signed-off-by: seonwoo_jung <79202163+seonwooj0810@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
1 issue found across 2 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/KotlinClientCodegen.java">
<violation number="1" location="modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/KotlinClientCodegen.java:444">
P2: `setUseJackson3(false)` leaves no map entry, so this check treats the caller's explicit choice as omitted and enables Jackson 3 for Boot 4. Track setter-configured values too.</violation>
</file>
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
| } | ||
|
|
||
| // super.processOpts() always writes useJackson3 back, so remember whether the user set it | ||
| boolean useJackson3Configured = additionalProperties.containsKey(USE_JACKSON_3); |
Contributor
There was a problem hiding this comment.
P2: setUseJackson3(false) leaves no map entry, so this check treats the caller's explicit choice as omitted and enables Jackson 3 for Boot 4. Track setter-configured values too.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/KotlinClientCodegen.java, line 444:
<comment>`setUseJackson3(false)` leaves no map entry, so this check treats the caller's explicit choice as omitted and enables Jackson 3 for Boot 4. Track setter-configured values too.</comment>
<file context>
@@ -440,6 +440,9 @@ public void processOpts() {
}
+ // super.processOpts() always writes useJackson3 back, so remember whether the user set it
+ boolean useJackson3Configured = additionalProperties.containsKey(USE_JACKSON_3);
+
super.processOpts();
</file context>
Member
|
thanks for the PR cc @karismann (2019/03) @Zomzog (2019/04) @andrewemery (2019/10) @4brunu (2019/11) @yutaka0m (2020/03) @stefankoppier (2022/06) @e5l (2024/10) |
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.
Fixes #24842
Since #24709,
useSpringBoot4=trueonjvm-spring-restclientswitches to Jackson 3 even when the user explicitly setsuseJackson3=false. The check used!isUseJackson3(), which cannot tell "not set" from "explicitly false". It can't becauseAbstractKotlinCodegen.processOpts()always writesuseJackson3back intoadditionalProperties. Projects that compiled with 7.24.0 against their own Jackson 2 build (see the issue) now get atools.jacksonSerializer.ktandJacksonJsonHttpMessageConverter.The fix records whether
useJackson3was configured beforesuper.processOpts(). Jackson 3 is only auto-enabled when the option was not set. WithuseSpringBoot4=truealone, the output is unchanged and still Jackson 3 by default. An explicituseJackson3=falsenow generates the Jackson 2 serializer, theMappingJackson2HttpMessageConverterconstructor and the Jackson 2 Gradle dependencies.Verification done:
KotlinClientCodegenModelTest.shouldRespectExplicitJackson3FalseWithSpringBoot4. It fails without the change becausePetApi.kthas noMappingJackson2HttpMessageConverter, and passes with it.KotlinClientCodegenModelTest(69) andKotlinClientCodegenApiTest(31) pass, including the existingshouldAutoEnableJackson3WithSpringBoot4.kotlin-jvm-spring-4-restclient-jackson3,kotlin-jvm-spring-3-restclientandkotlin-jackson3: no sample diff.export_docs_generators.sh: no doc diff.useSpringBoot4=true,useJackson3=false(with and withoutuseSpringBoot3=true)../gradlew compileKotlinsucceeds against Spring Boot 4.1.0 + Jackson 2.22.1 (Gradle 8.14.5, JDK 21).PR checklist
modules/openapi-generator, regenerated the affected Kotlin samples (no changes) and exported docs (no changes).Summary by cubic
Fixes #24842 by honoring an explicit
useJackson3=falseonjvm-spring-restclientinstead of overriding it whenuseSpringBoot4=trueis set. Since #24709,processOpts()always wroteuseJackson3back, so the generator couldn't tell "not set" from "explicitly false" and auto-enabled Jackson 3. The check now records whether the option was configured beforeprocessOpts()runs. WithuseSpringBoot4=truealone, the output is unchanged and still defaults to Jackson 3; an explicituseJackson3=falsenow generates the Jackson 2 serializer, theMappingJackson2HttpMessageConverterconstructor, and the Jackson 2 Gradle dependencies.useJackson3=falsewithuseSpringBoot4=true.Written for commit daf9dc0. Summary will update on new commits.