-
-
Notifications
You must be signed in to change notification settings - Fork 7.4k
feature(jackson3) add jackson3 support for spring generator #22854
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
feature(jackson3) add jackson3 support for spring generator #22854
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
15 issues found across 87 files
Note: This PR contains a large number of files. cubic only reviews up to 75 files per PR, so some files may not have been reviewed.
Prompt for AI agents (all issues)
Check if these issues are valid — if so, understand the root cause of each and fix them.
<file name="samples/client/petstore/spring-http-interface-noResponseEntity-jackson-3/README.md">
<violation number="1" location="samples/client/petstore/spring-http-interface-noResponseEntity-jackson-3/README.md:17">
P2: README example passes a WebClient to HttpInterfacesAbstractConfigurator, but the generated configurator expects a RestClient, so the example will not compile.</violation>
</file>
<file name="samples/client/petstore/spring-http-interface-noResponseEntity-jackson-3/src/main/java/org/openapitools/api/FakeApi.java">
<violation number="1" location="samples/client/petstore/spring-http-interface-noResponseEntity-jackson-3/src/main/java/org/openapitools/api/FakeApi.java:213">
P2: MultipartFile parameter is declared with @RequestPart, but the request content type is set to application/x-www-form-urlencoded. File uploads in Spring use multipart/form-data, so this mismatch prevents sending the binary part correctly and can lead to 415/empty file data.</violation>
</file>
<file name="modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-cloud/pom-sb3.mustache">
<violation number="1" location="modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-cloud/pom-sb3.mustache:134">
P2: Jackson 3 dependencies are added without a managed version; when useJackson3 is enabled the generated POM lacks a version or BOM for tools.jackson.*, which will cause Maven build failures.</violation>
</file>
<file name="modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-http-interface/httpInterfacesConfiguration.mustache">
<violation number="1" location="modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-http-interface/httpInterfacesConfiguration.mustache:41">
P2: Non-reactive template now requires RestClient (Spring 6.1+), breaking generated code for Spring Boot 3.0/3.1 users without a fallback or version guard.</violation>
</file>
<file name="CONTRIBUTING.md">
<violation number="1" location="CONTRIBUTING.md:15">
P3: Introduced typo in contribution guideline text (“staonrt a discussi”), which should remain “start a discussion.”</violation>
</file>
<file name="modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-http-interface/pom4.mustache">
<violation number="1" location="modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-http-interface/pom4.mustache:98">
P2: `jackson-databind-nullable` is a Jackson 2 module (`com.fasterxml.jackson`) but is always added even when `useJackson3` is enabled, which uses `tools.jackson` artifacts. This mixes incompatible Jackson versions and prevents registering the nullable module with a Jackson 3 `ObjectMapper`.</violation>
</file>
<file name="modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-http-interface/pom.mustache">
<violation number="1" location="modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-http-interface/pom.mustache:58">
P2: The template enables servlet (`spring-boot-starter-web`) when `reactive=false`, but generated code uses `RestClient`, which was introduced in Spring Framework 6.1 (Boot 3.2+). The default parent remains Spring Boot 3.1.3 (Spring 6.0), so non-reactive generated projects will fail to compile due to missing `RestClient`.</violation>
</file>
<file name="samples/client/petstore/spring-http-interface-noResponseEntity-jackson-3/src/main/java/org/openapitools/api/StoreApi.java">
<violation number="1" location="samples/client/petstore/spring-http-interface-noResponseEntity-jackson-3/src/main/java/org/openapitools/api/StoreApi.java:39">
P2: `orderId` uses `String` for DELETE but `Long` for GET on the same `{order_id}` path variable, creating an inconsistent API contract for the same endpoint and conflicting with the Javadoc’s integer ID expectation.</violation>
</file>
<file name="modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-boot/pom-sb4.mustache">
<violation number="1" location="modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-boot/pom-sb4.mustache:234">
P2: jackson-databind-nullable 0.2.8 is a Jackson 2 module but is always added even in useJackson3 mode, leading to Jackson 2/3 API incompatibility when registering JsonNullableModule.</violation>
</file>
<file name="samples/client/petstore/spring-http-interface-noResponseEntity-jackson-3/pom.xml">
<violation number="1" location="samples/client/petstore/spring-http-interface-noResponseEntity-jackson-3/pom.xml:63">
P1: Missing version for tools.jackson.datatype:jackson-datatype-jsr310; without dependencyManagement this will fail Maven resolution.</violation>
<violation number="2" location="samples/client/petstore/spring-http-interface-noResponseEntity-jackson-3/pom.xml:67">
P2: jackson-databind-nullable 0.2.8 is a Jackson 2 module (com.fasterxml.jackson.*) and will not integrate with Jackson 3 (tools.jackson.*) ObjectMapper used by this jackson-3 sample, causing incompatible dependencies.</violation>
</file>
<file name="modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-boot/pom-sb3.mustache">
<violation number="1" location="modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-boot/pom-sb3.mustache:184">
P2: Jackson 3 (`tools.jackson.*`) dependencies are added without versions; Spring Boot 3.1.3 only manages `com.fasterxml.jackson.*`, so `useJackson3` builds will fail to resolve these artifacts unless versions/BOM are added.</violation>
</file>
<file name="modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-boot/pom.mustache">
<violation number="1" location="modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-boot/pom.mustache:198">
P3: Unreachable mustache block: this dependency is wrapped in {{^useJackson3}}, so the inner {{#useJackson3}} groupId section can never render. This dead code is confusing and likely a logic oversight.</violation>
<violation number="2" location="modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-boot/pom.mustache:199">
P2: Jackson 3 dependencies are added without versions, but Spring Boot 2.7.x parent does not manage tools.jackson.* artifacts. Projects generated with useJackson3 will fail Maven resolution with missing version errors.</violation>
<violation number="3" location="modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-boot/pom.mustache:288">
P2: When `useJackson3` is enabled, the template switches core Jackson dependencies to `tools.jackson.*` but still includes `jackson-databind-nullable` 0.2.8 (a Jackson 2 `com.fasterxml.jackson` module). This creates an incompatible dependency mix and will fail when trying to register the JsonNullable module with a Jackson 3 ObjectMapper.</violation>
</file>
Since this is your first cubic review, here's how it works:
- cubic automatically reviews your code and comments on bugs and improvements
- Teach cubic by replying to its comments. cubic learns from your replies and gets better over time
- Ask questions if you need clarification on any suggestion
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
samples/client/petstore/spring-http-interface-noResponseEntity-jackson-3/pom.xml
Show resolved
Hide resolved
samples/client/petstore/spring-http-interface-noResponseEntity-jackson-3/README.md
Outdated
Show resolved
Hide resolved
...ng-http-interface-noResponseEntity-jackson-3/src/main/java/org/openapitools/api/FakeApi.java
Outdated
Show resolved
Hide resolved
modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-cloud/pom-sb3.mustache
Outdated
Show resolved
Hide resolved
...in/resources/JavaSpring/libraries/spring-http-interface/httpInterfacesConfiguration.mustache
Show resolved
Hide resolved
modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-boot/pom-sb3.mustache
Outdated
Show resolved
Hide resolved
modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-boot/pom.mustache
Show resolved
Hide resolved
modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-boot/pom.mustache
Outdated
Show resolved
Hide resolved
modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-boot/pom.mustache
Outdated
Show resolved
Hide resolved
|
I wonder what use the @Configuration
class ApiClientConfig {
@Bean
PetApi petApi(WebClient webClient) {
return HttpServiceProxyFactory
.builder(WebClientAdapter.forClient(webClient))
.build()
.createClient(PetApi.class);
}
}I mean - the point of the declarative interface is that it should be client-agnostic. So one can grab it and instantiate their own client with it regardless whether they use WebClient, RestClient or RestTemplate... In my opinion it just makes maintenance of this generator much more costly than it needs to be for a very little benefit. And it is not flexible enough. Often one wants to use a different WebClient/RestClient per interface. And this generated one does not seem to offer that. |
d76e18d to
07a641f
Compare
|
@Picazsoo I juste adapted the existing code and did not want to bring toomuch change in this, quite already, big change 😅 In my case I only generates interface and model, and generates client in my code with interceptors, url and so on... |
|
Yes, I understand you are simply working with the current state and bringing it up to date. No problem with that (-: ! |
|
@cubic-dev-ai rerun a review |
@antechrestos I have started the AI code review. It will take a few minutes to complete. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
10 issues found across 35 files
Prompt for AI agents (all issues)
Check if these issues are valid — if so, understand the root cause of each and fix them.
<file name="modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-http-interface/README.mustache">
<violation number="1" location="modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-http-interface/README.mustache:12">
P3: Mustache conditional is malformed in README template, producing duplicated/mismatched client names (e.g., `WebClientWebClientRestClient`) and incorrect client type for non-reactive mode. Use complementary reactive/non-reactive blocks.</violation>
</file>
<file name="samples/openapi3/client/petstore/spring-cloud-3-with-optional/pom.xml">
<violation number="1" location="samples/openapi3/client/petstore/spring-cloud-3-with-optional/pom.xml:17">
P2: Spring Boot 3.2.x requires Java 17+, but the project still targets Java 8, causing incompatibility after upgrading the parent to 3.2.0.</violation>
</file>
<file name="samples/client/petstore/spring-http-interface-noResponseEntity/README.md">
<violation number="1" location="samples/client/petstore/spring-http-interface-noResponseEntity/README.md:17">
P3: Documentation says to provide a WebClient while the updated example uses RestClient, creating a mismatch about the required client type.</violation>
</file>
<file name="samples/client/petstore/spring-http-interface/README.md">
<violation number="1" location="samples/client/petstore/spring-http-interface/README.md:17">
P3: README text still instructs providing a WebClient while the example constructor now uses RestClient, leaving the documentation inconsistent.</violation>
</file>
<file name="samples/client/petstore/spring-http-interface-reactive-noResponseEntity/README.md">
<violation number="1" location="samples/client/petstore/spring-http-interface-reactive-noResponseEntity/README.md:12">
P2: README now refers to malformed client class `WebClientWebClientRestClient` instead of the correct `WebClient` for the reactive sample.</violation>
</file>
<file name="samples/client/petstore/spring-http-interface-reactive/README.md">
<violation number="1" location="samples/client/petstore/spring-http-interface-reactive/README.md:12">
P3: README now refers to a malformed/non-existent class name `WebClientWebClientRestClient`; it should reference `WebClient` to match the actual constructor usage.</violation>
</file>
<file name="modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-cloud/pom-sb3.mustache">
<violation number="1" location="modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-cloud/pom-sb3.mustache:38">
P2: Spring Boot 3.2.0 manages Spring Security 6.2.x; keeping spring-security-oauth2-client pinned to 6.1.1 will mix Spring Security versions on the classpath. Drop the explicit version (or update to the BOM-managed version) to stay compatible with the new parent.</violation>
</file>
<file name="modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-boot/pom-sb4.mustache">
<violation number="1" location="modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-boot/pom-sb4.mustache:231">
P1: Jackson 2-only jackson-databind-nullable is included even when useJackson3 is enabled, mixing incompatible Jackson major versions.</violation>
</file>
<file name="modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-http-interface/pom-sb4.mustache">
<violation number="1" location="modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-http-interface/pom-sb4.mustache:95">
P2: When useJackson3 is enabled, the template still adds jackson-databind-nullable 0.2.8, which depends on Jackson 2 (`com.fasterxml.jackson`). Jackson 3 changes packages to `tools.jackson`, so this module is incompatible and will fail to register or compile in Jackson 3 mode. Consider conditionally excluding or using a Jackson 3-compatible nullable module when useJackson3 is true.</violation>
</file>
<file name="modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-boot/openapi2SpringBoot.mustache">
<violation number="1" location="modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-boot/openapi2SpringBoot.mustache:34">
P2: jsonNullableModule returns a Jackson 2 Module instance while the signature expects Jackson 3 JacksonModule under useJackson3, causing a type mismatch and compilation failure.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-boot/pom-sb4.mustache
Show resolved
Hide resolved
samples/openapi3/client/petstore/spring-cloud-3-with-optional/pom.xml
Outdated
Show resolved
Hide resolved
samples/client/petstore/spring-http-interface-reactive-noResponseEntity/README.md
Outdated
Show resolved
Hide resolved
modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-cloud/pom-sb3.mustache
Outdated
Show resolved
Hide resolved
...api-generator/src/main/resources/JavaSpring/libraries/spring-http-interface/pom-sb4.mustache
Show resolved
Hide resolved
...pi-generator/src/main/resources/JavaSpring/libraries/spring-boot/openapi2SpringBoot.mustache
Outdated
Show resolved
Hide resolved
...napi-generator/src/main/resources/JavaSpring/libraries/spring-http-interface/README.mustache
Outdated
Show resolved
Hide resolved
samples/client/petstore/spring-http-interface-noResponseEntity/README.md
Show resolved
Hide resolved
samples/client/petstore/spring-http-interface-reactive/README.md
Outdated
Show resolved
Hide resolved
07a641f to
0ca6b0b
Compare
|
@cubic-dev-ai rerun a review |
@antechrestos I have started the AI code review. It will take a few minutes to complete. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
3 issues found across 35 files
Prompt for AI agents (all issues)
Check if these issues are valid — if so, understand the root cause of each and fix them.
<file name="samples/openapi3/client/petstore/spring-cloud-3/pom.xml">
<violation number="1" location="samples/openapi3/client/petstore/spring-cloud-3/pom.xml:18">
P2: Spring Boot 3.2 requires Java 17+, but this POM still targets Java 8, which is incompatible with the updated parent version and its dependencies.</violation>
</file>
<file name="samples/openapi3/client/petstore/spring-cloud-3-with-optional/pom.xml">
<violation number="1" location="samples/openapi3/client/petstore/spring-cloud-3-with-optional/pom.xml:17">
P2: Upgrading to Spring Boot 3.2.0 requires Java 17+, but the POM still targets Java 8 via java.version, causing an incompatible build/runtime configuration. Update the Java version to 17+ to match Spring Boot 3.2.</violation>
</file>
<file name="modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-http-interface/pom.mustache">
<violation number="1" location="modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-http-interface/pom.mustache:78">
P2: When useJackson3 is enabled, the POM adds tools.jackson.* dependencies without any version or BOM. Since this POM has no dependencyManagement and spring-boot-starter-parent only manages com.fasterxml.jackson artifacts, Maven will fail with “version missing” for these Jackson 3 dependencies.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
samples/openapi3/client/petstore/spring-cloud-3-with-optional/pom.xml
Outdated
Show resolved
Hide resolved
...openapi-generator/src/main/resources/JavaSpring/libraries/spring-http-interface/pom.mustache
Outdated
Show resolved
Hide resolved
0ca6b0b to
428be16
Compare
|
@cubic-dev-ai rerun a review |
@antechrestos I have started the AI code review. It will take a few minutes to complete. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2 issues found across 35 files
Prompt for AI agents (all issues)
Check if these issues are valid — if so, understand the root cause of each and fix them.
<file name="modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-boot/openapi2SpringBoot.mustache">
<violation number="1" location="modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-boot/openapi2SpringBoot.mustache:5">
P3: `useJackson3` adds a `JacksonModule` import but no code uses it because the jsonNullableModule bean is only generated for `{{^useJackson3}}`. This produces unused imports in generated code when `openApiNullable` and `useJackson3` are both enabled.</violation>
</file>
<file name="samples/client/petstore/spring-http-interface/README.md">
<violation number="1" location="samples/client/petstore/spring-http-interface/README.md:12">
P2: README now requires Spring’s RestClient but still links to Spring Framework 6.0.0 docs, which predate RestClient. Update the reference link to a 6.1+ version to avoid misleading users.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
...pi-generator/src/main/resources/JavaSpring/libraries/spring-boot/openapi2SpringBoot.mustache
Outdated
Show resolved
Hide resolved
428be16 to
3bb2650
Compare
|
@cubic-dev-ai rerun a review |
@antechrestos I have started the AI code review. It will take a few minutes to complete. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1 issue found across 35 files
Prompt for AI agents (all issues)
Check if these issues are valid — if so, understand the root cause of each and fix them.
<file name="modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/SpringCodegen.java">
<violation number="1" location="modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/SpringCodegen.java:499">
P2: useJackson3 only remaps JsonDeserialize; JsonProperty/JsonValue/JsonCreator still map to com.fasterxml, causing mixed Jackson 2/3 annotations in generated models when useJackson3 is enabled.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/SpringCodegen.java
Outdated
Show resolved
Hide resolved
be25047 to
4a7f65b
Compare
|
thanks for the PR cc @cachescrubber (2022/02) @welshm (2022/02) @MelleD (2022/02) @atextor (2022/02) @manedev79 (2022/02) @javisst (2022/02) @borsch (2022/02) @banlevente (2022/02) @Zomzog (2022/09) @martin-mfg (2023/08) to review |
| |useEnumCaseInsensitive|Use `equalsIgnoreCase` when String for enum comparison| |false| | ||
| |useFeignClientContextId|Whether to generate Feign client with contextId parameter.| |true| | ||
| |useFeignClientUrl|Whether to generate Feign client with url parameter.| |true| | ||
| |useJackson3|Set it in order to use jackson 3 dependencies (only allowed when `useSpringBoot4` is set and incompatible with `openApiNullable`).| |false| |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
when useSpringBoot4 is enabled, does it mean it use Jackson 2.x by default?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@wing328 you raise a good point. I did not correlate them (despite the compatibility); yet I think that using spring boot 4 should enable jackson 3 by default as it is the default behaviour in spring boot.
What do you think? For developer experience this would lower the number of parameter given to the generator by default.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is misleading. The Jackson 3 settings should not be tied to a Spring Boot 4 setting. The Java generator with the resttemplate library also uses Jackson 2 and should support Jackson 3.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ML-Marco in order not to impact too much files, I wanted to only address the spring generator.
In spring, only springboot 4 supports Jackson 3,there is no use supporting it in other spring boot version
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ML-Marco so as you suggest I do not add a correlated behavior between two parameters
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah ok I see what you mean; I was puzzled on this question. As you read, springboot strongly advise to move to jackson 3 and tells jackson 2 won't be supported in the future. Yet it is supported. For now.
So I though: is this the responsibility of a tool to take this decision? Shall it be removed when springboot does not support jackson 2 anymore?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could the jackson2 vs 3 be handled in a similar way as are the {{javax}} imports? (meaning - the value of {{javax}} is programatically subtituted to represent either jakarta or javax)
That could lead to a minimal code change across the project and maybe more maintainable template files going forward?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Picazsoo that's a great idea; I will take a look at it in spring generator and give you a feedback
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As @Picazsoo smartly spotted, introducing a template variable jacksonPackage valued to either com.fasterxml.jackson when useJackson3 is clear, or valued to tools.jackson when useJackson3 is set really ease templating.
Some use of useJackson3 remains
- for open api module dependency
- for jsr310 module dependency
- for any use of jakson Module (renamed to JacksonModule in jackson3)
For almost every other needs, setting the variable to com.fasterxml.jackson or tools.jackson allows to both solve dependency declaration and imports. This will ease a lot other templates migration.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've just updated PR description
2a71f2f to
3a5da09
Compare
|
@antechrestos can you add |
3a5da09 to
6cbf3f5
Compare
No problem, however by regenerating spring samples, I will have more than 1200 impacted files This is done |
6cbf3f5 to
8a3c101
Compare
@jpfinne I'd rather do it in a dedicated contribution so as to ease reading. I will do a dedicated contribution once this one is accepted as JsonProperty were already missing for spring generator |
|
This PR can serve as a good basis for implementation (I mean inspiration) of the same in kotlin-spring codegen, am I right? |
I think so; I may do a dedicated one once this one is accepted. |
modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/SpringCodegen.java
Outdated
Show resolved
Hide resolved
modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/SpringCodegen.java
Outdated
Show resolved
Hide resolved
...pi-generator/src/main/resources/JavaSpring/libraries/spring-boot/openapi2SpringBoot.mustache
Outdated
Show resolved
Hide resolved
...pi-generator/src/main/resources/JavaSpring/libraries/spring-boot/openapi2SpringBoot.mustache
Outdated
Show resolved
Hide resolved
modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-boot/pom-sb3.mustache
Outdated
Show resolved
Hide resolved
modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-boot/pom-sb4.mustache
Outdated
Show resolved
Hide resolved
modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-boot/pom-sb4.mustache
Outdated
Show resolved
Hide resolved
modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-boot/pom-sb4.mustache
Outdated
Show resolved
Hide resolved
modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-cloud/pom-sb3.mustache
Show resolved
Hide resolved
modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-cloud/pom-sb4.mustache
Show resolved
Hide resolved
78c869e to
4479b13
Compare
* add 'useJackson3' option * add 'useSpringBoot4' option * add support for RestClient in spring-http-interfaces * add 'jacksonPackage' template variable set from useJackson3 option See OpenAPITools#22294
4479b13 to
2044ad8
Compare
|
@ML-Marco remarks taken.
|
Description
This pull request aim to provide jackson 3 support for spring generator. as it is the recommanded way for any springboot 4 project (see #22294 )
add 'useJackson3' option
I added this option only at the spring generator level, so as not to make it visible for all java generators (as I caught sight of it when a I generated the documentation).
This option sets the variable
jacksonPackageso as to ease template migration:useJackson3is clear,jacksonPackageis valued tocom.fasterxml.jacksonuseJackson3is set,jacksonPackageis valued totools.jacksonI added tests for
SpringCodegenin order to test that the jackson 3 import is well added.This option is only available alongside with
useSpringBoot4and withoutopenApiNullableas this late one brings a jackson 2 module.add support for RestClient in spring-http-interfaces
The client for spring http interface should use
RestClientinstead ofWebClientin non reactive mode; theWebClientis the reactive implementation of spring clients. AsRestClientwas added in spring6.1/ spring boot3.2, I updated thepom-sb3dependencies to3.2.0. Also updated spring cloud to2023.0.0for compability with spring boot3.2(see compatibility matrix). Clubic AI complains about requirement pushed to jdk 17 but springboot 3 already requires jdk 17.add 'useSpringBoot4' option
I willingly introduced this option in order to limitate, for spring generator, the use of jackson 3 only when using a spring boot 4 project. This option allows to build a springboot 4
pom.xmlas dependencies change in springboot 4.PR checklist
Summary by cubic
Adds Jackson 3 support to the Spring generator with new useJackson3 and useSpringBoot4 options, and switches non‑reactive Spring HTTP interface clients to RestClient. Also adds Spring Boot 4 POM templates and updates docs, tests, and samples.
New Features
Migration
Written for commit 2044ad8. Summary will update on new commits.