[BUG] openApiNullable=false is ignored by spring generator
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
Output with 7.13:
@Parameter(name = "comment", description = "", in = ParameterIn.QUERY) @Valid @RequestParam(value = "comment", required = false) String comment
Output with 7.14:
@Parameter(name = "comment", description = "", in = ParameterIn.QUERY) @Valid @RequestParam(value = "comment", required = false) @Nullable String comment
openapi-generator version
7.14
OpenAPI declaration file content or url
Generation Details
Steps to reproduce
Related issues/PRs
I believe the root of the problem was introduced here in nullableAnnotation.mustache, where @Nullable is added regardless of the openApiNullable setting.
So far this hasn't caused problems for us, but through this commit since 7.14 this nullableAnnotation is being used in many places where it now causes a problem for us.
Suggest a fix
openApiNullable is a different thing from the nullable annotations that have been introduced. As described here it is for "Enable OpenAPI Jackson Nullable library.".
Same problem here.
Working code with version 7.13 results in a compile error with 7.14:
Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type 'Organization?'
The issue and its fix will most likely be tracked here.
Fixed in 7.16. Thanks!