Repository navigation
Closed
Labels
Description
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: objectI 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;
Activity
anupamchaubey commentedon Jun 6, 2026
I'm looking into this regression regarding the ModelNull generation bug for the Java webclient.
wing328 commentedon Aug 15, 2026
I added a test via #24701 to cover null type only in properties.
please give it a try with the latest master to see if you still experience the same issue
happy to reopen the issue if needed.
renechoi commentedon Sep 9, 2026
Still reproduces on master (7.26.0-20260909.075159). One property, java webclient, only the quoting differs:
type: 'null'givesprivate ModelNull records = null;and noModelNull.javais generated.type: nullgivesprivate JsonNullable<Object> records.The fixture in #24701 uses the unquoted form, which YAML reads as a null scalar, so that schema carries no type at all. That is why the sample shows
Objectand the round-trippedapi/openapi.yamlhas notypeline for it.okhttp-gson matches. typescript-axios emits
Null.Bisect to 7.17.0 and the normalizer path: #24520