fix(kotlin-spring): use Jackson 3 annotation package in model imports#23406
Open
yonatankarp wants to merge 1 commit intoOpenAPITools:masterfrom
Open
fix(kotlin-spring): use Jackson 3 annotation package in model imports#23406yonatankarp wants to merge 1 commit intoOpenAPITools:masterfrom
yonatankarp wants to merge 1 commit intoOpenAPITools:masterfrom
Conversation
023d654 to
dc3ff1e
Compare
…ring Boot 4 Spring Boot 4's BOM does not manage tools.jackson.* artifacts, so Jackson 3 dataformat and module dependencies need explicit versions. Also fixes the hardcoded YAMLMapper import in homeController.mustache to use the jacksonPackage template variable. Note: Jackson annotations stay in com.fasterxml.jackson.annotation even for Jackson 3 — only core, databind, dataformat and module jars moved to the tools.jackson group.
dc3ff1e to
9e9bff4
Compare
Contributor
|
If you added a test, it would be good to revert the implementation (leave the test intact), push, let the test fail and the again restore the fix and push and let the test pass. That way it is somewhat proven that the test passes because it tests for the issue. |
Contributor
Author
|
@Picazsoo it was done like that, I squashed them before I asked for a review, but next time I'm happy to keep the commits separated 😄 |
Contributor
|
Sorry, that did not occur to me |
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
importMappinginKotlinSpringServerCodegento derive Jackson annotation package fromuseJackson3flag instead of hardcodingcom.fasterxml.jacksontools.jackson.core:jackson-annotationsdependency to all Spring Boot 4 build templates (Gradle + Maven) for spring-boot, spring-cloud, and spring-declarative-http-interface librariescom.fasterxml.jackson.dataformat.yaml.YAMLMapperimport inhomeController.mustacheto use{{jacksonPackage}}tools.jackson.annotationwhen Jackson 3 is enabledkotlin-springboot-4sample with corrected imports and dependenciesBug
When using
useSpringBoot4: true/useJackson3: truewith the kotlin-spring generator:com.fasterxml.jackson.annotation.*(Jackson 2) instead oftools.jackson.annotation.*(Jackson 3)tools.jackson.core:jackson-annotationsdependency, causing compile failures even after fixing the importsSummary by cubic
Fix Kotlin Spring generation for Jackson 3 on Spring Boot 4: keep model annotations in
com.fasterxml.jackson.annotation, use{{jacksonPackage}}forYAMLMapper, and pin Jackson 3 dataformat/module versions. Tests and Spring Boot 4 samples updated.Bug Fixes
KotlinSpringServerCodegen: always importJsonProperty/JsonCreator/JsonValuefromcom.fasterxml.jackson.annotation(annotations did not move in Jackson 3).homeController.mustache: import{{jacksonPackage}}.dataformat.yaml.YAMLMapper.Dependencies
3.1.0fortools.jackson.dataformat:jackson-dataformat-yaml,tools.jackson.dataformat:jackson-dataformat-xml, andtools.jackson.module:jackson-module-kotlinviaval jackson3Version/<jackson3.version>.tools.jackson.core:jackson-annotations.Written for commit 9e9bff4. Summary will update on new commits.