Skip to content

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

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

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