Bug Report Checklist
Description
When useJspecify is enabled, all generated packages are @NullMarked.
However, optional request parameters are not marked with @Nullable, causing verification failures when they are not provided.
openapi-generator version
org.openapitools:openapi-generator-maven-plugin:7.22.0
OpenAPI declaration file content or url
openapi: 3.1.0
info:
title: Test
version: v1
paths:
/test:
get:
parameters:
- name: optional
in: query
required: false
schema:
type: string
responses:
200:
description: success
content:
'application/json':
schema:
type: string
Generation Details
<configuration>
<inputSpec>src/main/resources/test.yaml</inputSpec>
<generatorName>java</generatorName>
<library>resttemplate</library>
<apiPackage>com.example</apiPackage>
<invokerPackage>com.example.client</invokerPackage>
<modelPackage>com.example.model</modelPackage>
<generateModelTests>false</generateModelTests>
<generateModelDocumentation>false</generateModelDocumentation>
<generateApiTests>false</generateApiTests>
<generateApiDocumentation>false</generateApiDocumentation>
<ignoreFileOverride>.openapi-generator-ignore</ignoreFileOverride>
<configOptions>
<generateClientAsBean>true</generateClientAsBean>
<openApiNullable>false</openApiNullable>
<useAbstractionForFiles>true</useAbstractionForFiles>
<useJackson3>true</useJackson3>
<useJakartaEe>true</useJakartaEe>
<useJspecify>true</useJspecify>
<useSpringBoot4>true</useSpringBoot4>
</configOptions>
</configuration>
Steps to reproduce
Generate with the above settings.
Observed output
@org.jspecify.annotations.NullMarked
package com.example;
package com.example;
// [...]
/**
*
*
* <p><b>200</b> - success
* @param optional (optional)
* @return String
* @throws RestClientException if an error occurs while attempting to invoke the API
*/
public String testGet(String optional) throws RestClientException {
return testGetWithHttpInfo(optional).getBody();
}
Expected output
public String testGet(@Nullable String optional) throws RestClientException {
return testGetWithHttpInfo(optional).getBody();
}
Bug Report Checklist
Description
When
useJspecifyis enabled, all generated packages are@NullMarked.However, optional request parameters are not marked with
@Nullable, causing verification failures when they are not provided.openapi-generator version
org.openapitools:openapi-generator-maven-plugin:7.22.0OpenAPI declaration file content or url
Generation Details
Steps to reproduce
Generate with the above settings.
Observed output
Expected output