Skip to content

Conversation

@antechrestos
Copy link
Contributor

@antechrestos antechrestos commented Jan 30, 2026

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 jacksonPackage so as to ease template migration:

  • when useJackson3 is clear, jacksonPackage is valued to com.fasterxml.jackson
  • when useJackson3 is set, jacksonPackage is valued to tools.jackson

I added tests for SpringCodegen in order to test that the jackson 3 import is well added.

This option is only available alongside with useSpringBoot4 and without openApiNullable as this late one brings a jackson 2 module.

add support for RestClient in spring-http-interfaces

The client for spring http interface should use RestClient instead of WebClient in non reactive mode; the WebClient is the reactive implementation of spring clients. As RestClient was added in spring 6.1 / spring boot 3.2, I updated the pom-sb3 dependencies to 3.2.0. Also updated spring cloud to 2023.0.0 for compability with spring boot 3.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.xml as dependencies change in springboot 4.

PR checklist

  • built locally
  • re generated samples
  • regenerated documentation (java camel server inherits from spring
  • test on a personnal project in spring boot 4

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

    • New options: useJackson3 to use tools.jackson and useSpringBoot4 to target Spring Boot 4 (enables Jakarta, SB4 POMs).
    • Template toggles for Jackson 2/3 imports (models, YAML/XML, date format, app config).
    • Added SB4 POMs for spring-boot, spring-cloud, and spring-http-interface; bumped SB3 templates to Spring Boot 3.3.13 and Spring Cloud 2023.0.0.
    • Non‑reactive spring-http-interface now uses RestClient + RestClientAdapter; reactive stays on WebClient.
    • Tests for correct Jackson import handling.
  • Migration

    • To use Jackson 3, set useSpringBoot4=true and useJackson3=true; SB4 POMs are used automatically.
    • Choose either useSpringBoot3 or useSpringBoot4 (not both). useJackson3 is only supported with Spring Boot 4.
    • useJackson3 is incompatible with openApiNullable; disable openApiNullable or keep Jackson 2.
    • For non‑reactive spring-http-interface clients, provide a RestClient bean and remove WebClient usage; no change for reactive.

Written for commit 2044ad8. Summary will update on new commits.

Copy link

@cubic-dev-ai cubic-dev-ai bot left a 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.

@Picazsoo
Copy link
Contributor

Picazsoo commented Jan 30, 2026

I wonder what use the HttpInterfacesAbstractConfigurator has in practice. I would expect majority of the developers to write their own configuration class such as:

@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.

@antechrestos antechrestos force-pushed the features/add-suppport-for-useJackson3-option-for-spring-generator branch 3 times, most recently from d76e18d to 07a641f Compare January 30, 2026 20:56
@antechrestos
Copy link
Contributor Author

antechrestos commented Jan 30, 2026

@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...

@Picazsoo
Copy link
Contributor

Yes, I understand you are simply working with the current state and bringing it up to date. No problem with that (-: !

@antechrestos
Copy link
Contributor Author

@cubic-dev-ai rerun a review

@cubic-dev-ai
Copy link

cubic-dev-ai bot commented Feb 2, 2026

@cubic-dev-ai rerun a review

@antechrestos I have started the AI code review. It will take a few minutes to complete.

Copy link

@cubic-dev-ai cubic-dev-ai bot left a 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.

@antechrestos antechrestos force-pushed the features/add-suppport-for-useJackson3-option-for-spring-generator branch from 07a641f to 0ca6b0b Compare February 2, 2026 11:28
@antechrestos
Copy link
Contributor Author

@cubic-dev-ai rerun a review

@cubic-dev-ai
Copy link

cubic-dev-ai bot commented Feb 2, 2026

@cubic-dev-ai rerun a review

@antechrestos I have started the AI code review. It will take a few minutes to complete.

Copy link

@cubic-dev-ai cubic-dev-ai bot left a 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.

@antechrestos antechrestos force-pushed the features/add-suppport-for-useJackson3-option-for-spring-generator branch from 0ca6b0b to 428be16 Compare February 2, 2026 13:12
@antechrestos
Copy link
Contributor Author

@cubic-dev-ai rerun a review

@cubic-dev-ai
Copy link

cubic-dev-ai bot commented Feb 2, 2026

@cubic-dev-ai rerun a review

@antechrestos I have started the AI code review. It will take a few minutes to complete.

Copy link

@cubic-dev-ai cubic-dev-ai bot left a 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.

@antechrestos antechrestos force-pushed the features/add-suppport-for-useJackson3-option-for-spring-generator branch from 428be16 to 3bb2650 Compare February 2, 2026 13:57
@antechrestos
Copy link
Contributor Author

@cubic-dev-ai rerun a review

@cubic-dev-ai
Copy link

cubic-dev-ai bot commented Feb 2, 2026

@cubic-dev-ai rerun a review

@antechrestos I have started the AI code review. It will take a few minutes to complete.

Copy link

@cubic-dev-ai cubic-dev-ai bot left a 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.

@antechrestos antechrestos force-pushed the features/add-suppport-for-useJackson3-option-for-spring-generator branch 3 times, most recently from be25047 to 4a7f65b Compare February 3, 2026 09:08
@wing328
Copy link
Member

wing328 commented Feb 3, 2026

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|
Copy link
Member

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?

Copy link
Contributor Author

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.

Copy link

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.

Copy link
Contributor Author

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

Copy link
Contributor Author

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

Copy link
Contributor Author

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?

Copy link
Contributor

@Picazsoo Picazsoo Feb 3, 2026

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?

Copy link
Contributor Author

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

Copy link
Contributor Author

@antechrestos antechrestos Feb 3, 2026

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.

Copy link
Contributor Author

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

@antechrestos antechrestos force-pushed the features/add-suppport-for-useJackson3-option-for-spring-generator branch 3 times, most recently from 2a71f2f to 3a5da09 Compare February 3, 2026 17:26
@jpfinne
Copy link
Contributor

jpfinne commented Feb 4, 2026

@antechrestos can you add @JsonProperty on setters when using Jackson 3? See #22757

@antechrestos antechrestos force-pushed the features/add-suppport-for-useJackson3-option-for-spring-generator branch from 3a5da09 to 6cbf3f5 Compare February 4, 2026 07:48
@antechrestos
Copy link
Contributor Author

@antechrestos can you add @JsonProperty on setters when using Jackson 3? See #22757

No problem, however by regenerating spring samples, I will have more than 1200 impacted files

This is done

@antechrestos antechrestos force-pushed the features/add-suppport-for-useJackson3-option-for-spring-generator branch from 6cbf3f5 to 8a3c101 Compare February 4, 2026 08:05
@antechrestos
Copy link
Contributor Author

@antechrestos can you add @JsonProperty on setters when using Jackson 3? See #22757

@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

@Picazsoo
Copy link
Contributor

Picazsoo commented Feb 4, 2026

This PR can serve as a good basis for implementation (I mean inspiration) of the same in kotlin-spring codegen, am I right?

@antechrestos
Copy link
Contributor Author

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.

@antechrestos
Copy link
Contributor Author

@wing328 @ML-Marco what is missing for this contribution? @jpfinne wanted to also address a missing JsonProperty annotation on generated setters for spring , yet this was already missing in jackson 2 so I chose not ad it in this contribution and do it in a dedicated one

@antechrestos antechrestos force-pushed the features/add-suppport-for-useJackson3-option-for-spring-generator branch 2 times, most recently from 78c869e to 4479b13 Compare February 4, 2026 11:48
* 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
@antechrestos antechrestos force-pushed the features/add-suppport-for-useJackson3-option-for-spring-generator branch from 4479b13 to 2044ad8 Compare February 4, 2026 12:09
@antechrestos
Copy link
Contributor Author

@ML-Marco remarks taken.

  • fix error messages typo
  • upgrade springboot parent version
  • removed milestone repositories
  • removed yaml dependency
  • upgrade swagger annotation version
  • removed use of variable useJackson3 for open api nullable as it was always true
  • fixes maven properties for compile

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants