From 3ca4985513de99153081da39ca5ccdcacaede579 Mon Sep 17 00:00:00 2001 From: Thorsten Hirsch Date: Thu, 9 Apr 2026 17:03:50 +0200 Subject: [PATCH] use node.asString() for Jackson 3, bump version to 3.1.1 --- .../src/main/resources/Java/libraries/native/JSON.mustache | 5 +++++ .../resources/Java/libraries/native/build.gradle.mustache | 2 +- .../src/main/resources/Java/libraries/native/pom.mustache | 2 +- .../petstore/java/native-jackson3-jspecify/build.gradle | 2 +- .../client/petstore/java/native-jackson3-jspecify/pom.xml | 2 +- .../src/main/java/org/openapitools/client/JSON.java | 2 +- samples/client/petstore/java/native-jackson3/build.gradle | 2 +- samples/client/petstore/java/native-jackson3/pom.xml | 2 +- .../src/main/java/org/openapitools/client/JSON.java | 2 +- 9 files changed, 13 insertions(+), 8 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/native/JSON.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/native/JSON.mustache index 3d00cafc9033..1f5ea71e2015 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/native/JSON.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/native/JSON.mustache @@ -153,7 +153,12 @@ public class JSON { // Get the value of the discriminator property, if present in the input payload. node = node.get(discriminatorName); if (node != null && node.isValueNode()) { + {{^useJackson3}} String discrValue = node.asText(); + {{/useJackson3}} + {{#useJackson3}} + String discrValue = node.asString(); + {{/useJackson3}} if (discrValue != null) { return discrValue; } diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/native/build.gradle.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/native/build.gradle.mustache index a90feb68c85e..edea9d94cc2d 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/native/build.gradle.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/native/build.gradle.mustache @@ -83,7 +83,7 @@ ext { jackson_annotations_version = "2.21" {{/useJackson3}} {{#useJackson3}} - jackson3_version = "3.1.0" + jackson3_version = "3.1.1" jackson_annotations_version = "2.21" {{/useJackson3}} {{#useJakartaEe}} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/native/pom.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/native/pom.mustache index bd6529d2e189..6192434c9f3b 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/native/pom.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/native/pom.mustache @@ -339,7 +339,7 @@ 0.2.10 {{/useJackson3}} {{#useJackson3}} - 3.1.0 + 3.1.1 2.21 {{/useJackson3}} {{#useJakartaEe}} diff --git a/samples/client/petstore/java/native-jackson3-jspecify/build.gradle b/samples/client/petstore/java/native-jackson3-jspecify/build.gradle index 58d94aee437d..2d47094785ef 100644 --- a/samples/client/petstore/java/native-jackson3-jspecify/build.gradle +++ b/samples/client/petstore/java/native-jackson3-jspecify/build.gradle @@ -66,7 +66,7 @@ artifacts { ext { - jackson3_version = "3.1.0" + jackson3_version = "3.1.1" jackson_annotations_version = "2.21" jakarta_annotation_version = "1.3.5" beanvalidation_version = "2.0.2" diff --git a/samples/client/petstore/java/native-jackson3-jspecify/pom.xml b/samples/client/petstore/java/native-jackson3-jspecify/pom.xml index 30fe32515588..311273ea9c4a 100644 --- a/samples/client/petstore/java/native-jackson3-jspecify/pom.xml +++ b/samples/client/petstore/java/native-jackson3-jspecify/pom.xml @@ -256,7 +256,7 @@ UTF-8 17 17 - 3.1.0 + 3.1.1 2.21 1.3.5 2.0.2 diff --git a/samples/client/petstore/java/native-jackson3-jspecify/src/main/java/org/openapitools/client/JSON.java b/samples/client/petstore/java/native-jackson3-jspecify/src/main/java/org/openapitools/client/JSON.java index e4f0b4e8ac0d..61ee126da289 100644 --- a/samples/client/petstore/java/native-jackson3-jspecify/src/main/java/org/openapitools/client/JSON.java +++ b/samples/client/petstore/java/native-jackson3-jspecify/src/main/java/org/openapitools/client/JSON.java @@ -110,7 +110,7 @@ String getDiscriminatorValue(JsonNode node) { // Get the value of the discriminator property, if present in the input payload. node = node.get(discriminatorName); if (node != null && node.isValueNode()) { - String discrValue = node.asText(); + String discrValue = node.asString(); if (discrValue != null) { return discrValue; } diff --git a/samples/client/petstore/java/native-jackson3/build.gradle b/samples/client/petstore/java/native-jackson3/build.gradle index f8be36507124..103f8aa97421 100644 --- a/samples/client/petstore/java/native-jackson3/build.gradle +++ b/samples/client/petstore/java/native-jackson3/build.gradle @@ -66,7 +66,7 @@ artifacts { ext { - jackson3_version = "3.1.0" + jackson3_version = "3.1.1" jackson_annotations_version = "2.21" jakarta_annotation_version = "1.3.5" beanvalidation_version = "2.0.2" diff --git a/samples/client/petstore/java/native-jackson3/pom.xml b/samples/client/petstore/java/native-jackson3/pom.xml index c4a9cbb064fd..a5e5034070a7 100644 --- a/samples/client/petstore/java/native-jackson3/pom.xml +++ b/samples/client/petstore/java/native-jackson3/pom.xml @@ -251,7 +251,7 @@ UTF-8 17 17 - 3.1.0 + 3.1.1 2.21 1.3.5 2.0.2 diff --git a/samples/client/petstore/java/native-jackson3/src/main/java/org/openapitools/client/JSON.java b/samples/client/petstore/java/native-jackson3/src/main/java/org/openapitools/client/JSON.java index efabdf554acd..e2d3d961ea97 100644 --- a/samples/client/petstore/java/native-jackson3/src/main/java/org/openapitools/client/JSON.java +++ b/samples/client/petstore/java/native-jackson3/src/main/java/org/openapitools/client/JSON.java @@ -110,7 +110,7 @@ String getDiscriminatorValue(JsonNode node) { // Get the value of the discriminator property, if present in the input payload. node = node.get(discriminatorName); if (node != null && node.isValueNode()) { - String discrValue = node.asText(); + String discrValue = node.asString(); if (discrValue != null) { return discrValue; }