Repository navigation
feat(java): support useJackson3 for rest-assured library - #25077
Conversation
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+.
There was a problem hiding this comment.
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' |
There was a problem hiding this comment.
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>
| git push origin master 2>&1 | grep -v 'To https' | |
| git push origin master |
There was a problem hiding this comment.
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> |
There was a problem hiding this comment.
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>
| <version>8.0.3.Final</version> | |
| <version>6.2.5.Final</version> |
There was a problem hiding this comment.
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"); |
There was a problem hiding this comment.
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>
There was a problem hiding this comment.
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" |
There was a problem hiding this comment.
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>
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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>
There was a problem hiding this comment.
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] | |
There was a problem hiding this comment.
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>
| |**status** | [**StatusEnum**](#StatusEnum) | Order Status | [optional] | | |
| |**status** | [**StatusEnum**](#enum-statusenum) | Order Status | [optional] | |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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>
There was a problem hiding this comment.
Shared model template; the Jackson 2 sample has the same imports. Out of scope.
| |**justSymbol** | [**JustSymbolEnum**](#JustSymbolEnum) | | [optional] | | ||
| |**arrayEnum** | [**List<ArrayEnumEnum>**](#List<ArrayEnumEnum>) | | [optional] | |
There was a problem hiding this comment.
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<ArrayEnumEnum>**](#List<ArrayEnumEnum>) | | [optional] |
+
</file context>
| |**justSymbol** | [**JustSymbolEnum**](#JustSymbolEnum) | | [optional] | | |
| |**arrayEnum** | [**List<ArrayEnumEnum>**](#List<ArrayEnumEnum>) | | [optional] | | |
| |**justSymbol** | [**JustSymbolEnum**](#enum-justsymbolenum) | | [optional] | | |
| |**arrayEnum** | [**List<ArrayEnumEnum>**](#enum-listarrayenumenum) | | [optional] | |
There was a problem hiding this comment.
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", |
There was a problem hiding this comment.
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>
| "com.squareup.okio" % "okio" % "1.17.5" % "compile", | |
| + "com.squareup.okio" % "okio" % "3.6.0" % "compile", |
There was a problem hiding this comment.
The okio line in build.sbt.mustache predates this PR. Happy to pin it to 3.6.0 if a maintainer asks.
|
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 |
Honors
useJackson3=trueforgeneratorName=javawithlibrary=rest-assured, which previously threw.JacksonObjectMapperextendsJackson3Mapperwith aJackson3ObjectMapperFactory, built throughJsonMapper.builder(); usesJsonNullableJackson3ModulewhenopenApiNullableis on.RFC3339InstantDeserializerandRFC3339JavaTimeModuleare not generated (jsr310 is in Jackson 3 databind). Joda is not supported on this path.pom.xml,build.gradleandbuild.sbtswitch to thetools.jacksonBOM, rest-assured 6.0.1 and Java 17. Annotations stay oncom.fasterxml.jackson.annotation.rest-assuredandrest-assured-jacksonproduces no diff.Tests: new
JavaClientCodegenTest#testRestAssuredWithJackson3; the newrest-assured-jackson3sample compiles withmvn compile.Closes #25076
PR checklist
bin/generate-samples.sh,export_docs_generators.sh) and committed all changed files.Summary by cubic
Honors
useJackson3=trueforgeneratorName=javawithlibrary=rest-assured, which previously threw.JacksonObjectMapperextendsJackson3Mapperand uses aJackson3ObjectMapperFactorybuilt throughJsonMapper.builder(), withJsonNullableJackson3ModulewhenopenApiNullableis on.tools.jacksonBOM, rest-assured 6.0.1, and require Java 17+; Joda time is not supported on this path.rest-assuredsamples produces no diff, and the newrest-assured-jackson3sample compiles withmvn compile.Closes #25076.
Written for commit cb50628. Summary will update on new commits.