Skip to content

feat(jackson3): add jackson3 support for Java Client generator - WebClient#23031

Merged
wing328 merged 5 commits intoOpenAPITools:masterfrom
phoval:feature/java_jackson3_webclient
Mar 9, 2026
Merged

feat(jackson3): add jackson3 support for Java Client generator - WebClient#23031
wing328 merged 5 commits intoOpenAPITools:masterfrom
phoval:feature/java_jackson3_webclient

Conversation

@phoval
Copy link
Copy Markdown
Contributor

@phoval phoval commented Feb 22, 2026

PR checklist

  • Read the contribution guidelines.
  • Pull Request title clearly describes the work in the pull request and Pull Request description provides details about how to validate the work. Missing information here may result in delayed response from the community.
  • Run the following to build the project and update samples:
    ./mvnw clean package || exit
    ./bin/generate-samples.sh ./bin/configs/*.yaml || exit
    ./bin/utils/export_docs_generators.sh || exit
    
    (For Windows users, please run the script in WSL)
    Commit all changed files.
    This is important, as CI jobs will verify all generator outputs of your HEAD commit as it would merge with master.
    These must match the expectations made by your contribution.
    You may regenerate an individual generator by passing the relevant config(s) as an argument to the script, for example ./bin/generate-samples.sh bin/configs/java*.
    IMPORTANT: Do NOT purge/delete any folders/files (e.g. tests) when regenerating the samples as manually written tests may be removed.
  • File the PR against the correct branch: master (upcoming 7.x.0 minor release - breaking changes with fallbacks), 8.0.x (breaking changes without fallbacks)
  • If your PR solves a reported issue, reference it using GitHub's linking syntax (e.g., having "fixes #22294" present in the PR description)
  • If your PR is targeting a particular programming language, @mention the technical committee members, so they are more likely to review the pull request.

Summary by cubic

Adds Jackson 3 support to the Java WebClient generator with Spring Boot 4, using Spring’s Jackson 3 codecs and Jakarta EE. Includes a new Petstore sample with Maven CI (Java 17/21) and adds it to the JDK17 samples workflow.

  • New Features

    • New option: useJackson3 (requires useSpringBoot4; incompatible with openApiNullable).
    • Auto-enables Jakarta EE when useSpringBoot4 is true.
    • WebClient switches between Jackson 2 (ObjectMapper + Jackson2JsonEncoder/Decoder) and Jackson 3 (JsonMapper + JacksonJsonEncoder/Decoder); all Jackson imports (incl. XML) use jacksonPackage.
    • Dependencies: add jackson-core/databind from Jackson 3; keep com.fasterxml jackson-annotations with its own version; remove jackson-jaxrs-json-provider. Versions align with Spring Boot 4.0.3 (or 3.5.11 without Spring Boot 4), Jakarta Annotations 3.0.0, Swagger annotations 1.6.16/2.2.43. Non-Jackson3 samples use Jackson 2.21.1 with separate jackson-annotations.
    • New webclient-springBoot4-jackson3 config and Petstore sample; added to samples JDK17 workflow and sample Maven CI (Java 17/21).
  • Bug Fixes

    • Restored FindBugs JSR 305 dependency to retain nullability annotations.

Written for commit 726f6c6. Summary will update on new commits.

@phoval phoval changed the title Feature/java jackson3 webclient feat(jackson3): add jackson3 support for Java Client generator - WebClient Feb 22, 2026
Copy link
Copy Markdown
Contributor

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

6 issues found across 860 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. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="samples/client/petstore/java/restclient-springBoot4-jackson2/docs/FakeApi.md">

<violation number="1" location="samples/client/petstore/java/restclient-springBoot4-jackson2/docs/FakeApi.md:1007">
P2: The generated example uses `Arrays.asList(-efg)`, which is invalid Java syntax. The enum value "-efg" maps to `EnumClass._EFG`, so the example should reference the enum constant instead of the raw token.</violation>
</file>

<file name="modules/openapi-generator/src/main/resources/Java/libraries/restclient/pom.mustache">

<violation number="1" location="modules/openapi-generator/src/main/resources/Java/libraries/restclient/pom.mustache:351">
P2: When useJackson3 is enabled, the template still includes jackson-databind-nullable, which depends on Jackson 2 (com.fasterxml.jackson.*). This will conflict with Jackson 3’s tools.jackson.* packages and can cause compilation/runtime failures. Guard this dependency for Jackson 3 or provide a compatible alternative.</violation>
</file>

<file name="samples/client/petstore/java/restclient-springBoot4-jackson2/README.md">

<violation number="1" location="samples/client/petstore/java/restclient-springBoot4-jackson2/README.md:100">
P2: README example uses `HttpStatusCodeException` without importing it, so the snippet won’t compile when copied.</violation>
</file>

<file name="samples/client/petstore/java/restclient-springBoot4-jackson2/build.sbt">

<violation number="1" location="samples/client/petstore/java/restclient-springBoot4-jackson2/build.sbt:1">
P2: Invalid comment syntax in build.sbt; '#' is not a Scala comment and will cause sbt parsing to fail.</violation>
</file>

<file name="modules/openapi-generator/src/main/resources/Java/libraries/webclient/ApiClient.mustache">

<violation number="1" location="modules/openapi-generator/src/main/resources/Java/libraries/webclient/ApiClient.mustache:169">
P2: Jackson 3 createDefaultMapper omits JsonNullableModule registration, so openApiNullable types won’t serialize/deserialize correctly.</violation>
</file>

<file name="modules/openapi-generator/src/main/resources/Java/libraries/restclient/ApiClient.mustache">

<violation number="1" location="modules/openapi-generator/src/main/resources/Java/libraries/restclient/ApiClient.mustache:195">
P2: Jackson3 createDefaultMapper builds a JsonMapper without registering JsonNullableModule when openApiNullable is enabled, unlike the Jackson2 branch. JsonNullable requires its module to be registered to serialize/deserialize nullable fields, so Jackson3-generated clients will mishandle JsonNullable values.</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
  • Add one-off context when rerunning by tagging @cubic-dev-ai with guidance or docs links (including llms.txt)
  • 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.

@phoval phoval force-pushed the feature/java_jackson3_webclient branch 2 times, most recently from 4b3e61f to 3cdbb71 Compare March 6, 2026 07:36
@phoval phoval force-pushed the feature/java_jackson3_webclient branch 5 times, most recently from 7fea6c1 to 22e948f Compare March 7, 2026 07:56
@phoval phoval force-pushed the feature/java_jackson3_webclient branch from 2d6a1df to f03bda6 Compare March 7, 2026 19:06
@phoval phoval force-pushed the feature/java_jackson3_webclient branch from f03bda6 to 726f6c6 Compare March 7, 2026 19:16
@wing328 wing328 merged commit 0d2ff8c into OpenAPITools:master Mar 9, 2026
111 checks passed
@wing328 wing328 added this to the 7.21.0 milestone Mar 9, 2026
davidricodias pushed a commit to davidricodias/openapi-generator that referenced this pull request Mar 11, 2026
…lient (OpenAPITools#23031)

* feat(jackson3): add jackson3 support for Java Client generator - WebClient

* chore: generate bin/generate-samples.sh bin/configs/java-*

* fix: add back FindBugs JSR 305 dependency

* chore: generate bin/generate-samples.sh bin/configs/java-*

* chore: generate bin/generate-samples.sh bin/configs/java-*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants