Bug Report Checklist
Description
Even after setting <openApiNullable>false</openApiNullable> in the Kotlin generate-sources config options, the generated model classes contain annotation @field:JsonSetter(nulls = Nulls.FAIL) for non-required fields.
openapi-generator version
7.23.0
OpenAPI declaration file content or url
type: object
properties:
id:
type: string
Generation Details
<execution>
<id>KOTLIN</id>
<phase>generate-sources</phase>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<inputSpec>${openapi.output}</inputSpec>
...
<generatorName>kotlin-spring</generatorName>
<generateSupportingFiles>false</generateSupportingFiles>
<configOptions>
<useBeanValidation>false</useBeanValidation>
<useJackson3>true</useJackson3>
<useSpringBoot4>true</useSpringBoot4>
<enumPropertyNaming>original</enumPropertyNaming>
<useTags>true</useTags>
<openApiNullable>false</openApiNullable>
</configOptions>
</configuration>
</execution>
Steps to reproduce
- Setup a project with Kotlin OpenAPI generator with the provided configuration.
- Create a schema with non-required field not annotated as
nullable: true
- Generate the Kotlin classes and observe that the generated class contains
@field:JsonSetter(nulls = Nulls.FAIL) annotation.
Related issues/PRs
#23804
Suggest a fix
With the openApiNullable = false setting, the JsonSetter(nulls = Nulls.FAIL) annotation should not be included in the generated classes the same way it works for Java.
Bug Report Checklist
Description
Even after setting
<openApiNullable>false</openApiNullable>in the Kotlin generate-sources config options, the generated model classes contain annotation@field:JsonSetter(nulls = Nulls.FAIL)for non-required fields.openapi-generator version
7.23.0
OpenAPI declaration file content or url
Generation Details
Steps to reproduce
nullable: true@field:JsonSetter(nulls = Nulls.FAIL)annotation.Related issues/PRs
#23804
Suggest a fix
With the openApiNullable = false setting, the
JsonSetter(nulls = Nulls.FAIL)annotation should not be included in the generated classes the same way it works for Java.