Bug Report Checklist
Description
PR #24501 bumped jackson-databind-nullable from 0.2.8 to 0.2.11, but in JavaSpring it updated only the pom-sb3.mustache variants. All three pom-sb4.mustache templates still pin 0.2.8.
That is precisely the combination which requires 0.2.11:
useJackson3 can only be set together with useSpringBoot4, so Jackson 3 users always get pom-sb4.mustache.
- In 0.2.8,
JsonNullableModule extends com.fasterxml.jackson.databind.Module (Jackson 2) and therefore cannot be registered on a Jackson 3 mapper.
- Jackson 3 support (
JsonNullableJackson3Module extends tools.jackson.databind.JacksonModule) was added in jackson-databind-nullable 0.2.10.
Net effect: generating with useSpringBoot4=true, useJackson3=true, openApiNullable=true produces models that correctly import tools.jackson.databind.annotation.JsonDeserialize and use org.openapitools.jackson.nullable.JsonNullable, but a pom.xml that resolves a Jackson-2-only nullable module. There is no supported way to register it, so JsonNullable properties cannot be serialized or deserialized at all.
Current state on master:
| Template |
Pinned version |
JavaSpring/libraries/spring-boot/pom-sb3.mustache |
0.2.11 |
JavaSpring/libraries/spring-boot/pom-sb4.mustache |
0.2.8 |
JavaSpring/libraries/spring-cloud/pom-sb3.mustache |
0.2.11 |
JavaSpring/libraries/spring-cloud/pom-sb4.mustache |
0.2.8 |
JavaSpring/libraries/spring-http-interface/pom-sb3.mustache |
0.2.11 |
JavaSpring/libraries/spring-http-interface/pom-sb4.mustache |
0.2.8 |
kotlin-spring/libraries/spring-boot/pom-sb4.mustache |
0.2.11 |
kotlin-spring had both its sb3 and sb4 templates updated in that same PR, which suggests the JavaSpring sb4 files were simply overlooked.
openapi-generator version
Reproduced with 7.23.0 and 7.25.0 (latest release). Not a regression: the sb4 templates have pinned 0.2.8 since Spring Boot 4 support was introduced in #22854.
OpenAPI declaration file content or url
Any spec with an optional nullable property reproduces it:
openapi: 3.0.3
info:
title: minimal
version: "1.0.0"
paths: {}
components:
schemas:
Thing:
type: object
properties:
name:
type: string
nullable: true
Generation Details
{
"useSpringBoot4": true,
"useJackson3": true,
"openApiNullable": true,
"interfaceOnly": true
}
Steps to reproduce
openapi-generator-cli generate -g spring -i spec.yaml -o out -c config.json
grep -A 2 jackson-databind-nullable out/pom.xml
Actual output:
<artifactId>jackson-databind-nullable</artifactId>
<version>0.2.8</version>
Expected output:
<artifactId>jackson-databind-nullable</artifactId>
<version>0.2.11</version>
Suggested fix
A one-line change in each of the three JavaSpring/libraries/*/pom-sb4.mustache, mirroring what #24501 already applied to the pom-sb3.mustache files:
<artifactId>jackson-databind-nullable</artifactId>
- <version>0.2.8</version>
+ <version>0.2.11</version>
Related issues/PRs
Bug Report Checklist
mastertemplates, see table below; reproduced with releases 7.23.0 and 7.25.0)Description
PR #24501 bumped
jackson-databind-nullablefrom 0.2.8 to 0.2.11, but inJavaSpringit updated only thepom-sb3.mustachevariants. All threepom-sb4.mustachetemplates still pin 0.2.8.That is precisely the combination which requires 0.2.11:
useJackson3can only be set together withuseSpringBoot4, so Jackson 3 users always getpom-sb4.mustache.JsonNullableModule extends com.fasterxml.jackson.databind.Module(Jackson 2) and therefore cannot be registered on a Jackson 3 mapper.JsonNullableJackson3Module extends tools.jackson.databind.JacksonModule) was added in jackson-databind-nullable 0.2.10.Net effect: generating with
useSpringBoot4=true,useJackson3=true,openApiNullable=trueproduces models that correctly importtools.jackson.databind.annotation.JsonDeserializeand useorg.openapitools.jackson.nullable.JsonNullable, but apom.xmlthat resolves a Jackson-2-only nullable module. There is no supported way to register it, soJsonNullableproperties cannot be serialized or deserialized at all.Current state on
master:JavaSpring/libraries/spring-boot/pom-sb3.mustacheJavaSpring/libraries/spring-boot/pom-sb4.mustacheJavaSpring/libraries/spring-cloud/pom-sb3.mustacheJavaSpring/libraries/spring-cloud/pom-sb4.mustacheJavaSpring/libraries/spring-http-interface/pom-sb3.mustacheJavaSpring/libraries/spring-http-interface/pom-sb4.mustachekotlin-spring/libraries/spring-boot/pom-sb4.mustachekotlin-springhad both its sb3 and sb4 templates updated in that same PR, which suggests theJavaSpringsb4 files were simply overlooked.openapi-generator version
Reproduced with 7.23.0 and 7.25.0 (latest release). Not a regression: the sb4 templates have pinned 0.2.8 since Spring Boot 4 support was introduced in #22854.
OpenAPI declaration file content or url
Any spec with an optional nullable property reproduces it:
Generation Details
{ "useSpringBoot4": true, "useJackson3": true, "openApiNullable": true, "interfaceOnly": true }Steps to reproduce
Actual output:
Expected output:
Suggested fix
A one-line change in each of the three
JavaSpring/libraries/*/pom-sb4.mustache, mirroring what #24501 already applied to thepom-sb3.mustachefiles:Related issues/PRs
openApiNullablewithuseJackson3#23324 / feat(spring): enableopenApiNullablewithuseJackson3#23331 — lifted the restriction soopenApiNullablecan be used withuseJackson3JavaSpringsb4 templatesOpenAPITools/jackson-databind-nullablev0.2.10 — addedJsonNullableJackson3Module