Skip to content

[Java] [apache-httpclient] Add support for Jackson3 for apache httpclient generator (fixes #22294)#23446

Open
maksimkurb wants to merge 12 commits intoOpenAPITools:masterfrom
maksimkurb:feature/java-apache-httpclient-useJackson3
Open

[Java] [apache-httpclient] Add support for Jackson3 for apache httpclient generator (fixes #22294)#23446
maksimkurb wants to merge 12 commits intoOpenAPITools:masterfrom
maksimkurb:feature/java-apache-httpclient-useJackson3

Conversation

@maksimkurb
Copy link
Copy Markdown

@maksimkurb maksimkurb commented Apr 3, 2026

This PR continues work of #23071 and adds Jackson3 support for the apache-httpclient library.
Related issue: #22294

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 #123" 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.

@bbdouglas (2017/07) @sreeshas (2017/08) @jfiala (2017/08) @lukoyanov (2017/09) @cbornet (2017/09) @jeff9finger (2018/01) @karismann (2019/03) @Zomzog (2019/04) @lwlee2608 (2019/10) @martin-mfg (2023/08)


Summary by cubic

Adds Jackson 3 support to the Java apache-httpclient generator and enables OpenAPI Nullable with JsonNullableJackson3Module across Jackson 3 clients. Fixes #22294.

  • New Features

    • Enable useJackson3=true for apache-httpclient (Java 17); configures JsonMapper, DateTimeFeature, and EnumFeature.
    • Add OpenAPI Nullable for Jackson 3 via JsonNullableJackson3Module in apache-httpclient, native, and Spring resttemplate/webclient/restclient.
    • New sample samples/client/petstore/java/apache-httpclient-jackson3 with Gradle/Maven; CI builds it on JDK 17/21.
    • Tests cover Jackson 3 + OpenAPI Nullable; docs updated to list apache-httpclient support.
  • Dependencies

    • Jackson 3 uses tools.jackson (jackson-core, jackson-databind 3.1.0) with com.fasterxml.jackson.core:jackson-annotations 2.21; add org.openapitools:jackson-databind-nullable:0.2.10 when openApiNullable=true.
    • Gradle/Maven templates switch to Java 17 when useJackson3 is set; otherwise remain on Java 8. Gradle tests use JUnit Platform.
    • echo_api apache-httpclient sample updated to JUnit 5.

Written for commit cac750d. Summary will update on new commits.

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.

1 issue found across 231 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 (unresolved 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/apache-httpclient-jackson3/docs/FakeApi.md">

<violation number="1" location="samples/client/petstore/java/apache-httpclient-jackson3/docs/FakeApi.md:1007">
P2: Java example uses invalid enum literal `-efg`; should reference the generated enum constant (e.g., `EnumClass._EFG`).</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

String enumQueryString = "_abc"; // String | Query parameter enum test (string)
Integer enumQueryInteger = 1; // Integer | Query parameter enum test (double)
Double enumQueryDouble = 1.1D; // Double | Query parameter enum test (double)
List<EnumClass> enumQueryModelArray = Arrays.asList(-efg); // List<EnumClass> |
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai bot Apr 3, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: Java example uses invalid enum literal -efg; should reference the generated enum constant (e.g., EnumClass._EFG).

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At samples/client/petstore/java/apache-httpclient-jackson3/docs/FakeApi.md, line 1007:

<comment>Java example uses invalid enum literal `-efg`; should reference the generated enum constant (e.g., `EnumClass._EFG`).</comment>

<file context>
@@ -0,0 +1,1541 @@
+        String enumQueryString = "_abc"; // String | Query parameter enum test (string)
+        Integer enumQueryInteger = 1; // Integer | Query parameter enum test (double)
+        Double enumQueryDouble = 1.1D; // Double | Query parameter enum test (double)
+        List<EnumClass> enumQueryModelArray = Arrays.asList(-efg); // List<EnumClass> | 
+        List<String> enumFormStringArray = Arrays.asList("$"); // List<String> | Form parameter enum test (string array)
+        String enumFormString = "_abc"; // String | Form parameter enum test (string)
</file context>
Fix with Cubic

@maksimkurb
Copy link
Copy Markdown
Author

@cubic-dev-ai Please review everything except samples/ directory, as samples/ folder contains too much codegenerated files and you only have a limit of 75 files

@cubic-dev-ai
Copy link
Copy Markdown
Contributor

cubic-dev-ai bot commented Apr 3, 2026

@cubic-dev-ai Please review everything except samples/ directory, as samples/ folder contains too much codegenerated files and you only have a limit of 75 files

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

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.

4 issues found across 231 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 (unresolved 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=".github/workflows/samples-java-client-jdk17.yaml">

<violation number="1" location=".github/workflows/samples-java-client-jdk17.yaml:17">
P2: Workflow path/matrix uses `samples/client/others/java/apache-httpclient-jackson3`, but the sample exists under `samples/client/petstore/java/apache-httpclient-jackson3`, so CI will miss changes or fail when running the matrix entry.</violation>
</file>

<file name="samples/client/echo_api/java/apache-httpclient/build.gradle">

<violation number="1" location="samples/client/echo_api/java/apache-httpclient/build.gradle:143">
P2: JUnit 5 test configuration is applied globally, including Android target builds, which can break Android test/build behavior.</violation>
</file>

<file name="samples/client/petstore/java/apache-httpclient-jackson3/build.sbt">

<violation number="1" location="samples/client/petstore/java/apache-httpclient-jackson3/build.sbt:1">
P2: build.sbt contains an invalid `#` comment, which will cause SBT parsing to fail and make the sample non-buildable.</violation>
</file>

<file name="docs/generators/java-microprofile.md">

<violation number="1" location="docs/generators/java-microprofile.md:100">
P2: `useJackson3` is documented as incompatible with `openApiNullable`, but the apache-httpclient templates now support JsonNullable with Jackson 3, so the docs are misleading.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

@@ -0,0 +1 @@
# TODO
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai bot Apr 3, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: build.sbt contains an invalid # comment, which will cause SBT parsing to fail and make the sample non-buildable.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At samples/client/petstore/java/apache-httpclient-jackson3/build.sbt, line 1:

<comment>build.sbt contains an invalid `#` comment, which will cause SBT parsing to fail and make the sample non-buildable.</comment>

<file context>
@@ -0,0 +1 @@
+# TODO
</file context>
Fix with Cubic

@maksimkurb
Copy link
Copy Markdown
Author

Hi @wing328 , I've received an email that you have approved workflow run and then CI/CD failed. I've pushed a commit with chmod +x on the gradle wrapper and another shell script in generated sample

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.

[REQ] Jackson3 support for java libraries

1 participant