-
-
Notifications
You must be signed in to change notification settings - Fork 7.3k
Description
Bug Report Checklist
- Have you provided a full/minimal spec to reproduce the issue?
- Have you validated the input using an OpenAPI validator (example)?
- 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
The openApiNullable option on the jaxrs-spec generator doesn't appear to be used. It would be nice to have this functionality since I want to have request objects which have nullable fields so that I can know whether or not a field is being set to null or if it simply wasn't provided in the payload if it's optional. I see that other Java generators seem to support this option so it would be nice to have.
openapi-generator version
5.0.1
OpenAPI declaration file content or url
N/A. I didn't think it was necessary to add the full spec, but I can if needed.
Generation Details
Using the Maven plugin with the following configuration:
<configuration>
<inputSpec>${project.basedir}/src/main/resources/openapi.yaml</inputSpec>
<output>${project.build.directory}/generated-sources/openapi</output>
<apiPackage>com.foo.bar.web.api.v1</apiPackage>
<modelPackage>com.foo.bar.web.api.v1</modelPackage>
<generatorName>jaxrs-spec</generatorName>
<configOptions>
<interfaceOnly>true</interfaceOnly>
<generateBuilders>false</generateBuilders>
<useSwaggerAnnotations>false</useSwaggerAnnotations>
<openApiNullable>true</openApiNullable>
<generatePom>false</generatePom>
</configOptions>
</configuration>
Steps to reproduce
- Create a schema which has at least 1 nullable property.
- Run the openapi generator maven plugin with the provided configuration.
- The resulting POJO's do not use
JsonNullable
Suggest a fix
I'm a new user so I don't fully understand how this works, but it looks like this is probably just an update to some templates? I see the openApiNullable option referenced in other generators such as the one for Java clients.