Skip to content

[BUG] [Java] [RestClient] NullMarked API does not mark parameters as @Nullable #24388

Closed

Description

@GregDThomas

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?
  • Have you searched for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description

Examine the YML at https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/test/resources/3_0/java/jspecify.yaml which is used to generate the sample code at https://github.com/OpenAPITools/openapi-generator/tree/master/samples/client/petstore/java/native-jackson3-jspecify

Note that;

  • The API defines both "dtParam, "dtQuery" and "dtCookie" as not required
  • The generated package-info defines the package as NullMarked
@org.jspecify.annotations.NullMarked
private ResponseSpec fooDtParamGetRequestCreation(java.time.@Nullable Instant dtParam, java.time.@Nullable Instant dtQuery, java.time.@Nullable Instant dtCookie) throws RestClientResponseException {
  • Incorrectly does not mark the parameters to fooDtParamGet as @Nullable:
public Foo fooDtParamGet( java.time.Instant dtParam,  java.time.Instant dtQuery,  java.time.Instant dtCookie) throws RestClientResponseException {
  • Incorrectly does not mark the parameters to fooDtParamGetWithHttpInfo as @Nullable:
public ResponseEntity<Foo> fooDtParamGetWithHttpInfo( java.time.Instant dtParam,  java.time.Instant dtQuery,  java.time.Instant dtCookie) throws RestClientResponseException {
openapi-generator version

7.24.0

OpenAPI declaration file content or url
Generation Details
Steps to reproduce
Related issues/PRs
Suggest a fix

Activity

  1. added a commit that references this issue on Jul 29, 2026
    6458a03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions