Skip to content

feat(java): support useJackson3 for rest-assured library - #25077

Merged
wing328 merged 3 commits into
OpenAPITools:masterfrom
austek:feat/java_rest_assured_use_jackson3
Oct 3, 2026
Merged

wing328 merged 3 commits into
OpenAPITools:masterfrom
austek:feat/java_rest_assured_use_jackson3

Conversation

@austek

@austek austek commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

Honors useJackson3=true for generatorName=java with library=rest-assured, which previously threw.

  • JacksonObjectMapper extends Jackson3Mapper with a Jackson3ObjectMapperFactory, built through JsonMapper.builder(); uses JsonNullableJackson3Module when openApiNullable is on.
  • RFC3339InstantDeserializer and RFC3339JavaTimeModule are not generated (jsr310 is in Jackson 3 databind). Joda is not supported on this path.
  • pom.xml, build.gradle and build.sbt switch to the tools.jackson BOM, rest-assured 6.0.1 and Java 17. Annotations stay on com.fasterxml.jackson.annotation.
  • Jackson 2 output is unchanged; regenerating rest-assured and rest-assured-jackson produces no diff.

Tests: new JavaClientCodegenTest#testRestAssuredWithJackson3; the new rest-assured-jackson3 sample compiles with mvn compile.

Closes #25076

PR checklist

  • Read the contribution guidelines.
  • Built the project, regenerated samples and docs (bin/generate-samples.sh, export_docs_generators.sh) and committed all changed files.

Summary by cubic

Honors useJackson3=true for generatorName=java with library=rest-assured, which previously threw.

  • JacksonObjectMapper extends Jackson3Mapper and uses a Jackson3ObjectMapperFactory built through JsonMapper.builder(), with JsonNullableJackson3Module when openApiNullable is on.
  • The pom, gradle, and sbt templates switch to the tools.jackson BOM, rest-assured 6.0.1, and require Java 17+; Joda time is not supported on this path.
  • Jackson 2 output is unchanged; regenerating existing rest-assured samples produces no diff, and the new rest-assured-jackson3 sample compiles with mvn compile.

Closes #25076.

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

Review in cubic

Generate JacksonObjectMapper against Jackson3Mapper and the tools.jackson packages, and switch the pom, gradle and sbt templates to the Jackson 3 BOM and rest-assured 6.x. Requires Java 17+.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

9 issues found across 189 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="samples/client/petstore/java/rest-assured-jackson3/git_push.sh">

<violation number="1" location="samples/client/petstore/java/rest-assured-jackson3/git_push.sh:54">
P2: This pipeline returns `grep`’s status, so a failed push that prints any non-`To https` output can make the script exit successfully. Preserve the `git push` status or remove the output filter so callers can detect failures.</violation>
</file>

<file name="samples/client/petstore/java/rest-assured-jackson3/docs/Order.md">

<violation number="1" location="samples/client/petstore/java/rest-assured-jackson3/docs/Order.md:14">
P3: The `StatusEnum` link does not match the heading anchor, so clicking it will not jump to the enum definition. Link to `#enum-statusenum` instead.</violation>
</file>

<file name="samples/client/petstore/java/rest-assured-jackson3/src/main/java/org/openapitools/client/model/AdditionalPropertiesAnyType.java">

<violation number="1" location="samples/client/petstore/java/rest-assured-jackson3/src/main/java/org/openapitools/client/model/AdditionalPropertiesAnyType.java:23">
P3: `Map` and `HashMap` are each imported twice; remove the second pair to keep the generated source free of redundant imports.</violation>
</file>

<file name="samples/client/petstore/java/rest-assured-jackson3/pom.xml">

<violation number="1" location="samples/client/petstore/java/rest-assured-jackson3/pom.xml:265">
P2: Hibernate Validator 8 cannot process the `javax.validation` constraints supplied by the 2.0.2 API. Use a Bean Validation 2-compatible provider, such as Hibernate Validator 6.2.x, so validation works in this sample.</violation>
</file>

<file name="samples/client/petstore/java/rest-assured-jackson3/docs/EnumArrays.md">

<violation number="1" location="samples/client/petstore/java/rest-assured-jackson3/docs/EnumArrays.md:10">
P3: Both enum links point to fragments that do not match the headings’ generated IDs, so clicking either property type does not jump to its enum section. Link to `#enum-justsymbolenum` and `#enum-listarrayenumenum` instead.</violation>
</file>

<file name="samples/client/petstore/java/rest-assured-jackson3/src/main/java/org/openapitools/client/api/FakeApi.java">

<violation number="1" location="samples/client/petstore/java/rest-assured-jackson3/src/main/java/org/openapitools/client/api/FakeApi.java:737">
P2: Adding `binaryMultiPart` still sends `application/x-www-form-urlencoded`, so servers cannot parse the multipart file body. Select multipart encoding when the file parameter is used.</violation>
</file>

<file name="modules/openapi-generator/src/main/resources/Java/libraries/rest-assured/build.gradle.mustache">

<violation number="1" location="modules/openapi-generator/src/main/resources/Java/libraries/rest-assured/build.gradle.mustache:33">
P2: This selects the Java 17 Jackson 3 stack for `target=android`, but the Android branch still compiles with Java 8, so generated Android builds cannot compile. Reject this combination or update the Android build path for Java 17.</violation>
</file>

<file name="samples/client/petstore/java/rest-assured-jackson3/.travis.yml">

<violation number="1" location="samples/client/petstore/java/rest-assured-jackson3/.travis.yml:12">
P2: This CI matrix runs `gradle test` on JDK 8–12, but this sample requires Java 17: the generated build.gradle sets `sourceCompatibility = JavaVersion.VERSION_17` for the main `java` block and pom.xml pins `maven-compiler-plugin` to source/target 17. `javac` on JDK ≤12 cannot compile Java 17 source, so every job in this matrix fails. Use a JDK 17 (or newer) entry and run `./gradlew test` (the wrapper this file chmods in `before_install`) instead of the system `gradle`.</violation>
</file>

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

<violation number="1" location="samples/client/petstore/java/rest-assured-jackson3/build.sbt:20">
P3: The three build files for this sample pin conflicting okio versions: build.sbt uses `okio % 1.17.5` while pom.xml and build.gradle use `okio 3.6.0` for the same dependency set. A user building this sample with sbt gets a 2019-era okio alongside rest-assured 6.0.1 and Jackson 3.1.6. Align the sbt file (and the generated `build.sbt.mustache`) with the 3.6.0 used elsewhere.</violation>
</file>

Reply with feedback, questions, or to request a fix.

Re-trigger cubic


# Pushes (Forces) the changes in the local repository up to the remote repository
echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git"
git push origin master 2>&1 | grep -v 'To https'

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2: This pipeline returns grep’s status, so a failed push that prints any non-To https output can make the script exit successfully. Preserve the git push status or remove the output filter so callers can detect failures.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At samples/client/petstore/java/rest-assured-jackson3/git_push.sh, line 54:

<comment>This pipeline returns `grep`’s status, so a failed push that prints any non-`To https` output can make the script exit successfully. Preserve the `git push` status or remove the output filter so callers can detect failures.</comment>

<file context>
@@ -0,0 +1,54 @@
+
+# Pushes (Forces) the changes in the local repository up to the remote repository
+echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git"
+git push origin master 2>&1 | grep -v 'To https'
</file context>
Suggested change
git push origin master 2>&1 | grep -v 'To https'
git push origin master

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Shared template (git_push.sh.mustache), identical in every generated sample. Out of scope for this PR.

<dependency>
<groupId>org.hibernate.validator</groupId>
<artifactId>hibernate-validator</artifactId>
<version>8.0.3.Final</version>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2: Hibernate Validator 8 cannot process the javax.validation constraints supplied by the 2.0.2 API. Use a Bean Validation 2-compatible provider, such as Hibernate Validator 6.2.x, so validation works in this sample.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At samples/client/petstore/java/rest-assured-jackson3/pom.xml, line 265:

<comment>Hibernate Validator 8 cannot process the `javax.validation` constraints supplied by the 2.0.2 API. Use a Bean Validation 2-compatible provider, such as Hibernate Validator 6.2.x, so validation works in this sample.</comment>

<file context>
@@ -0,0 +1,288 @@
+        <dependency>
+            <groupId>org.hibernate.validator</groupId>
+            <artifactId>hibernate-validator</artifactId>
+            <version>8.0.3.Final</version>
+        </dependency>
+        <!-- test dependencies -->
</file context>
Suggested change
<version>8.0.3.Final</version>
<version>6.2.5.Final</version>

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Same pom block as the existing rest-assured-jackson sample, from the shared performBeanValidation template. Out of scope for this PR.


public TestEndpointParametersOper(RequestSpecBuilder reqSpec) {
this.reqSpec = reqSpec;
reqSpec.setContentType("application/x-www-form-urlencoded");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2: Adding binaryMultiPart still sends application/x-www-form-urlencoded, so servers cannot parse the multipart file body. Select multipart encoding when the file parameter is used.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At samples/client/petstore/java/rest-assured-jackson3/src/main/java/org/openapitools/client/api/FakeApi.java, line 737:

<comment>Adding `binaryMultiPart` still sends `application/x-www-form-urlencoded`, so servers cannot parse the multipart file body. Select multipart encoding when the file parameter is used.</comment>

<file context>
@@ -0,0 +1,1442 @@
+
+        public TestEndpointParametersOper(RequestSpecBuilder reqSpec) {
+            this.reqSpec = reqSpec;
+            reqSpec.setContentType("application/x-www-form-urlencoded");
+            reqSpec.setAccept("application/json");
+            this.respSpec = new ResponseSpecBuilder();
</file context>

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Existing api.mustache behavior, unchanged by this PR. Out of scope.

rest_assured_version = "5.5.6"
{{/useJackson3}}
{{#useJackson3}}
rest_assured_version = "6.0.1"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2: This selects the Java 17 Jackson 3 stack for target=android, but the Android branch still compiles with Java 8, so generated Android builds cannot compile. Reject this combination or update the Android build path for Java 17.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At modules/openapi-generator/src/main/resources/Java/libraries/rest-assured/build.gradle.mustache, line 33:

<comment>This selects the Java 17 Jackson 3 stack for `target=android`, but the Android branch still compiles with Java 8, so generated Android builds cannot compile. Reject this combination or update the Android build path for Java 17.</comment>

<file context>
@@ -26,11 +26,22 @@ ext {
     rest_assured_version = "5.5.6"
+    {{/useJackson3}}
+    {{#useJackson3}}
+    rest_assured_version = "6.0.1"
+    {{/useJackson3}}
     junit_version = "5.10.3"
</file context>

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Valid. -Ptarget=android is a Gradle runtime flag on the legacy AGP 1.5 path, so the generator cannot reject it. Jackson 3 needs Java 17, so the Android target is not supported with useJackson3.

- openjdk11
- openjdk10
- openjdk9
- openjdk8

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2: This CI matrix runs gradle test on JDK 8–12, but this sample requires Java 17: the generated build.gradle sets sourceCompatibility = JavaVersion.VERSION_17 for the main java block and pom.xml pins maven-compiler-plugin to source/target 17. javac on JDK ≤12 cannot compile Java 17 source, so every job in this matrix fails. Use a JDK 17 (or newer) entry and run ./gradlew test (the wrapper this file chmods in before_install) instead of the system gradle.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At samples/client/petstore/java/rest-assured-jackson3/.travis.yml, line 12:

<comment>This CI matrix runs `gradle test` on JDK 8–12, but this sample requires Java 17: the generated build.gradle sets `sourceCompatibility = JavaVersion.VERSION_17` for the main `java` block and pom.xml pins `maven-compiler-plugin` to source/target 17. `javac` on JDK ≤12 cannot compile Java 17 source, so every job in this matrix fails. Use a JDK 17 (or newer) entry and run `./gradlew test` (the wrapper this file chmods in `before_install`) instead of the system `gradle`.</comment>

<file context>
@@ -0,0 +1,22 @@
+  - openjdk11
+  - openjdk10
+  - openjdk9
+  - openjdk8
+before_install:
+  # ensure gradlew has proper permission
</file context>

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Shared travis.mustache, not specific to this library. Out of scope.

|**petId** | **Long** | | [optional] |
|**quantity** | **Integer** | | [optional] |
|**shipDate** | **OffsetDateTime** | | [optional] |
|**status** | [**StatusEnum**](#StatusEnum) | Order Status | [optional] |

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P3: The StatusEnum link does not match the heading anchor, so clicking it will not jump to the enum definition. Link to #enum-statusenum instead.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At samples/client/petstore/java/rest-assured-jackson3/docs/Order.md, line 14:

<comment>The `StatusEnum` link does not match the heading anchor, so clicking it will not jump to the enum definition. Link to `#enum-statusenum` instead.</comment>

<file context>
@@ -0,0 +1,28 @@
+|**petId** | **Long** |  |  [optional] |
+|**quantity** | **Integer** |  |  [optional] |
+|**shipDate** | **OffsetDateTime** |  |  [optional] |
+|**status** | [**StatusEnum**](#StatusEnum) | Order Status |  [optional] |
+|**complete** | **Boolean** |  |  [optional] |
+
</file context>
Suggested change
|**status** | [**StatusEnum**](#StatusEnum) | Order Status | [optional] |
|**status** | [**StatusEnum**](#enum-statusenum) | Order Status | [optional] |

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Shared model_doc template. Out of scope for this PR.

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import java.util.HashMap;
import java.util.Map;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P3: Map and HashMap are each imported twice; remove the second pair to keep the generated source free of redundant imports.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At samples/client/petstore/java/rest-assured-jackson3/src/main/java/org/openapitools/client/model/AdditionalPropertiesAnyType.java, line 23:

<comment>`Map` and `HashMap` are each imported twice; remove the second pair to keep the generated source free of redundant imports.</comment>

<file context>
@@ -0,0 +1,146 @@
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonValue;
+import java.util.HashMap;
+import java.util.Map;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+import com.fasterxml.jackson.annotation.JsonTypeName;
</file context>

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Shared model template; the Jackson 2 sample has the same imports. Out of scope.

Comment on lines +10 to +11
|**justSymbol** | [**JustSymbolEnum**](#JustSymbolEnum) | | [optional] |
|**arrayEnum** | [**List&lt;ArrayEnumEnum&gt;**](#List&lt;ArrayEnumEnum&gt;) | | [optional] |

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P3: Both enum links point to fragments that do not match the headings’ generated IDs, so clicking either property type does not jump to its enum section. Link to #enum-justsymbolenum and #enum-listarrayenumenum instead.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At samples/client/petstore/java/rest-assured-jackson3/docs/EnumArrays.md, line 10:

<comment>Both enum links point to fragments that do not match the headings’ generated IDs, so clicking either property type does not jump to its enum section. Link to `#enum-justsymbolenum` and `#enum-listarrayenumenum` instead.</comment>

<file context>
@@ -0,0 +1,32 @@
+
+| Name | Type | Description | Notes |
+|------------ | ------------- | ------------- | -------------|
+|**justSymbol** | [**JustSymbolEnum**](#JustSymbolEnum) |  |  [optional] |
+|**arrayEnum** | [**List&lt;ArrayEnumEnum&gt;**](#List&lt;ArrayEnumEnum&gt;) |  |  [optional] |
+
</file context>
Suggested change
|**justSymbol** | [**JustSymbolEnum**](#JustSymbolEnum) | | [optional] |
|**arrayEnum** | [**List&lt;ArrayEnumEnum&gt;**](#List&lt;ArrayEnumEnum&gt;) | | [optional] |
|**justSymbol** | [**JustSymbolEnum**](#enum-justsymbolenum) | | [optional] |
|**arrayEnum** | [**List&lt;ArrayEnumEnum&gt;**](#enum-listarrayenumenum) | | [optional] |

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Same shared model_doc template. Out of scope for this PR.

"com.fasterxml.jackson.core" % "jackson-annotations" % "2.21",
"tools.jackson.core" % "jackson-databind" % "3.1.6",
"org.openapitools" % "jackson-databind-nullable" % "0.2.11",
"com.squareup.okio" % "okio" % "1.17.5" % "compile",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P3: The three build files for this sample pin conflicting okio versions: build.sbt uses okio % 1.17.5 while pom.xml and build.gradle use okio 3.6.0 for the same dependency set. A user building this sample with sbt gets a 2019-era okio alongside rest-assured 6.0.1 and Jackson 3.1.6. Align the sbt file (and the generated build.sbt.mustache) with the 3.6.0 used elsewhere.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At samples/client/petstore/java/rest-assured-jackson3/build.sbt, line 20:

<comment>The three build files for this sample pin conflicting okio versions: build.sbt uses `okio % 1.17.5` while pom.xml and build.gradle use `okio 3.6.0` for the same dependency set. A user building this sample with sbt gets a 2019-era okio alongside rest-assured 6.0.1 and Jackson 3.1.6. Align the sbt file (and the generated `build.sbt.mustache`) with the 3.6.0 used elsewhere.</comment>

<file context>
@@ -0,0 +1,27 @@
+      "com.fasterxml.jackson.core" % "jackson-annotations" % "2.21",
+      "tools.jackson.core" % "jackson-databind" % "3.1.6",
+      "org.openapitools" % "jackson-databind-nullable" % "0.2.11",
+      "com.squareup.okio" % "okio" % "1.17.5" % "compile",
+      "jakarta.validation" % "jakarta.validation-api" % "3.0.2" % "compile",
+      "org.hibernate" % "hibernate-validator" % "6.0.19.Final" % "compile",
</file context>
Suggested change
"com.squareup.okio" % "okio" % "1.17.5" % "compile",
+ "com.squareup.okio" % "okio" % "3.6.0" % "compile",

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The okio line in build.sbt.mustache predates this PR. Happy to pin it to 3.6.0 if a maintainer asks.

@wing328

wing328 commented Oct 3, 2026 •

Copy link
Copy Markdown
Member

tested samples/client/petstore/java/rest-assured-jackson3/ locally and the project compiles without issues. will add it to the java github workflow so that it's tested moving forward.

update: merged #25110

@wing328
wing328 merged commit e60bfb7 into OpenAPITools:master Oct 3, 2026
84 of 85 checks passed
@austek
austek deleted the feat/java_rest_assured_use_jackson3 branch October 3, 2026 17:31
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.

[REQ][JAVA][rest-assured] Support useJackson3

2 participants