Description
Missing default null value for Object in generated model for webclient
openapi-generator version
Bug reproduced since 7.13.0 and in latest version 7.22.0.
Generation was correct in 7.12.0 version.
OpenAPI declaration file content or url
Using openapi example
properties:
records:
type: 'null'
Generation Details
I got generated correct DTO in 7.12.0 version.
@Nullable
private Object records = null;
But since 7.13.0 and in latest version 7.22.0 where is no null value in generated pojo.
If not modify openapi schema generated dto will not compiled couse of missing ModelNull
@jakarta.annotation.Nullable
private **ModelNull** records = null;
If I change openapi
properties:
records:
default: null
type: object
I got generated, but without default null value
@jakarta.annotation.Nullable
private Object records;
Steps to reproduce
Using openapi-generator-maven-plugin
<execution>
<id>webclient-generation</id>
<phase>generate-sources</phase>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<skip>${skip.webclient}</skip>
<inputSpec>${inputSpec}</inputSpec>
<generatorName>java</generatorName>
<templateDirectory>${webclient.templateDirectory}</templateDirectory>
<generateModelTests>false</generateModelTests>
<generateApiTests>false</generateApiTests>
<generateSupportingFiles>true</generateSupportingFiles>
<modelPackage>${webclient.base-package}.dto</modelPackage>
<apiPackage>${webclient.base-package}.api</apiPackage>
<invokerPackage>${webclient.base-package}.invoker</invokerPackage>
<configOptions>
<library>webclient</library>
<sourceFolder>webclient</sourceFolder>
<implFolder>webclient</implFolder>
<useSwaggerAnnotations>false</useSwaggerAnnotations>
<jackson>true</jackson>
<withXml>false</withXml>
<supportAsync>true</supportAsync>
<useSpringBoot3>true</useSpringBoot3>
<useJakartaEe>true</useJakartaEe>
<openApiNullable>false</openApiNullable>
</configOptions>
<openapiNormalizer>
REF_AS_PARENT_IN_ALLOF=true
</openapiNormalizer>
</configuration>
</execution>
Suggest a fix
In generated webclient model in DTO should be default null value for Object type
@Nullable
private Object records = null;
Description
Missing default null value for Object in generated model for webclient
openapi-generator version
Bug reproduced since 7.13.0 and in latest version 7.22.0.
Generation was correct in 7.12.0 version.
OpenAPI declaration file content or url
Using openapi example
Generation Details
I got generated correct DTO in 7.12.0 version.
But since 7.13.0 and in latest version 7.22.0 where is no null value in generated pojo.
If not modify openapi schema generated dto will not compiled couse of missing ModelNull
If I change openapi
I got generated, but without default null value
Steps to reproduce
Using openapi-generator-maven-plugin
Suggest a fix
In generated webclient model in DTO should be default null value for Object type