Repository navigation
Description
Bug Report Checklist
- Have you provided a full/minimal spec to reproduce the issue?
- Have you validated the input using an OpenAPI validator?
- Have you tested with the latest master to confirm the issue still exists? (verified against the current
mastertemplates, see table below; reproduced with releases 7.23.0 and 7.25.0) - Have you searched for related issues/PRs?
- What's the actual output vs expected output?
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:
useJackson3can only be set together withuseSpringBoot4, so Jackson 3 users always getpom-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: trueGeneration 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.xmlActual 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
- [SPRING] support option
openApiNullablewithuseJackson3#23324 / feat(spring): enableopenApiNullablewithuseJackson3#23331 — lifted the restriction soopenApiNullablecan be used withuseJackson3 - update jackson databind nullable to 0.2.11 #24501 — bumped to 0.2.11, but missed the
JavaSpringsb4 templates - [java] jackson databind nullable update v0.2.11 #24498 — duplicate of update jackson databind nullable to 0.2.11 #24501, not merged
OpenAPITools/jackson-databind-nullablev0.2.10 — addedJsonNullableJackson3Module
Activity
[Java][Spring] Bump jackson-databind-nullable to 0.2.11 in the Spring…