Skip to content

[BUG][JAVA][SPRING] jackson-databind-nullable still pinned to 0.2.8 in all JavaSpring pom-sb4 templates, breaking openApiNullable with useJackson3 #24975

Description

@motiqa

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 master templates, 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:

  • 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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions