[java][resttemplate] Add support for Jackson 3 and Spring Boot 4 in Java resttemplate#23144
Conversation
…e client generation
…-support-jackson-3
There was a problem hiding this comment.
6 issues found across 562 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/resttemplate-springBoot4-jackson2/docs/EnumArrays.md">
<violation number="1" location="samples/client/petstore/java/resttemplate-springBoot4-jackson2/docs/EnumArrays.md:10">
P2: Enum property links use fragment IDs that don’t match the actual enum heading anchors, causing broken intra-doc navigation.</violation>
</file>
<file name="samples/client/petstore/java/resttemplate-springBoot4-jackson2/README.md">
<violation number="1" location="samples/client/petstore/java/resttemplate-springBoot4-jackson2/README.md:18">
P2: README lists an incorrect Java minimum version for the Spring Boot 4 sample, which will mislead users into unsupported JDKs.</violation>
</file>
<file name="samples/client/petstore/java/resttemplate-springBoot4-jackson2/docs/FakeApi.md">
<violation number="1" location="samples/client/petstore/java/resttemplate-springBoot4-jackson2/docs/FakeApi.md:1007">
P2: The generated Java example uses `Arrays.asList(-efg)`, which is invalid Java syntax; it should reference a valid enum constant (e.g., `EnumClass._EFG`) or `EnumClass.fromValue("-efg")` so the example compiles.</violation>
</file>
<file name="samples/client/petstore/java/resttemplate-springBoot4-jackson2/.travis.yml">
<violation number="1" location="samples/client/petstore/java/resttemplate-springBoot4-jackson2/.travis.yml:8">
P2: Travis CI matrix uses JDK 8–12, but this sample requires Java 17 (build.gradle sets source/target 17), so CI will fail on these runtimes.</violation>
</file>
<file name=".github/workflows/samples-java-client-jdk17.yaml">
<violation number="1" location=".github/workflows/samples-java-client-jdk17.yaml:32">
P1: New Spring Boot 4 RestTemplate samples were added to the build matrix without corresponding workflow path triggers, so PRs/commits touching only those folders can skip this CI workflow.</violation>
</file>
<file name="modules/openapi-generator/src/main/resources/Java/libraries/resttemplate/pom.mustache">
<violation number="1" location="modules/openapi-generator/src/main/resources/Java/libraries/resttemplate/pom.mustache:159">
P2: The new useSpringBoot4 properties block omits beanvalidation-version, but the Bean Validation dependency still references ${beanvalidation-version}. If useSpringBoot4 and useBeanValidation are enabled together, Maven fails with an unresolved property. Define beanvalidation-version in the useSpringBoot4 branch to avoid build failures.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
| |**justSymbol** | [**JustSymbolEnum**](#JustSymbolEnum) | | [optional] | | ||
| |**arrayEnum** | [**List<ArrayEnumEnum>**](#List<ArrayEnumEnum>) | | [optional] | |
There was a problem hiding this comment.
P2: Enum property links use fragment IDs that don’t match the actual enum heading anchors, causing broken intra-doc navigation.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At samples/client/petstore/java/resttemplate-springBoot4-jackson2/docs/EnumArrays.md, line 10:
<comment>Enum property links use fragment IDs that don’t match the actual enum heading anchors, causing broken intra-doc navigation.</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] | |
|
|
||
| Building the API client library requires: | ||
|
|
||
| 1. Java 1.8+ |
There was a problem hiding this comment.
P2: README lists an incorrect Java minimum version for the Spring Boot 4 sample, which will mislead users into unsupported JDKs.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At samples/client/petstore/java/resttemplate-springBoot4-jackson2/README.md, line 18:
<comment>README lists an incorrect Java minimum version for the Spring Boot 4 sample, which will mislead users into unsupported JDKs.</comment>
<file context>
@@ -0,0 +1,278 @@
+
+Building the API client library requires:
+
+1. Java 1.8+
+2. Maven/Gradle
+
</file context>
| 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> | |
There was a problem hiding this comment.
P2: The generated Java example uses Arrays.asList(-efg), which is invalid Java syntax; it should reference a valid enum constant (e.g., EnumClass._EFG) or EnumClass.fromValue("-efg") so the example compiles.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At samples/client/petstore/java/resttemplate-springBoot4-jackson2/docs/FakeApi.md, line 1007:
<comment>The generated Java example uses `Arrays.asList(-efg)`, which is invalid Java syntax; it should reference a valid enum constant (e.g., `EnumClass._EFG`) or `EnumClass.fromValue("-efg")` so the example compiles.</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>
| List<EnumClass> enumQueryModelArray = Arrays.asList(-efg); // List<EnumClass> | | |
| List<EnumClass> enumQueryModelArray = Arrays.asList(EnumClass._EFG); // List<EnumClass> | |
| # | ||
| language: java | ||
| jdk: | ||
| - openjdk12 |
There was a problem hiding this comment.
P2: Travis CI matrix uses JDK 8–12, but this sample requires Java 17 (build.gradle sets source/target 17), so CI will fail on these runtimes.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At samples/client/petstore/java/resttemplate-springBoot4-jackson2/.travis.yml, line 8:
<comment>Travis CI matrix uses JDK 8–12, but this sample requires Java 17 (build.gradle sets source/target 17), so CI will fail on these runtimes.</comment>
<file context>
@@ -0,0 +1,22 @@
+#
+language: java
+jdk:
+ - openjdk12
+ - openjdk11
+ - openjdk10
</file context>
| @@ -156,10 +156,14 @@ | |||
| <source>17</source> | |||
There was a problem hiding this comment.
P2: The new useSpringBoot4 properties block omits beanvalidation-version, but the Bean Validation dependency still references ${beanvalidation-version}. If useSpringBoot4 and useBeanValidation are enabled together, Maven fails with an unresolved property. Define beanvalidation-version in the useSpringBoot4 branch to avoid build failures.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At modules/openapi-generator/src/main/resources/Java/libraries/resttemplate/pom.mustache, line 159:
<comment>The new useSpringBoot4 properties block omits beanvalidation-version, but the Bean Validation dependency still references ${beanvalidation-version}. If useSpringBoot4 and useBeanValidation are enabled together, Maven fails with an unresolved property. Define beanvalidation-version in the useSpringBoot4 branch to avoid build failures.</comment>
<file context>
@@ -156,10 +156,14 @@
<target>17</target>
{{/useJakartaEe}}
- {{^useJakartaEe}}
+ {{#useSpringBoot4}}
+ <source>17</source>
+ <target>17</target>
</file context>
|
can you please review the build failure when you've time? |
I have run the tests locally and they are working fine. On GitHub, the error I see is: @wing328 Can you guide me? |
|
what about copying |
|
Note that RestTemplate is scheduled to be deprecated. So I would suggest to switch to RestClient if possible. |
True, but in my case migrating to RestClient isn't feasible at this time. |
Add option to generate Resttemplate using latest spring 7.
PR checklist
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.
master(upcoming7.x.0minor release - breaking changes with fallbacks),8.0.x(breaking changes without fallbacks)"fixes #123"present in the PR description)@bbdouglas
@sreeshas
@jfiala
@lukoyanov
@cbornet
@jeff9finger
@karismann
@Zomzog
@lwlee2608
@martin-mfg
Summary by cubic
Adds optional RestTemplate generation for Spring Framework 7 (Spring Boot 4) with Jackson 3. Opt-in only; existing defaults stay the same.
New Features
Migration
Written for commit 5bcd5c0. Summary will update on new commits.