[BUG][KOTLIN] kotlin-spring is not picking up additionalModelTypeAnnotations config
Bug Report Checklist
- [ x] Have you provided a full/minimal spec to reproduce the issue?
- [x ] Have you validated the input using an OpenAPI validator (example)?
- [x ] Have you tested with the latest master to confirm the issue still exists?
- [x ] Have you searched for related issues/PRs?
- [x ] What's the actual output vs expected output?
- [ ] [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description
The generation of de model data classes in kotlin is not picking up de configuration of the property configOptions.put("additionalModelTypeAnnotations", "@com.fasterxml.jackson.annotation.JsonInclude(com.fasterxml.jackson.annotation.JsonInclude.Include.NON_NULL)")
The data classes are created without the annotation using the build.gradle.kts file
openapi-generator version
plugins {
java-library
id("org.openapi.generator") version "7.4.0"
kotlin("jvm") version "1.9.23"
}
OpenAPI declaration file content or url
Generation Details
The bug occurs when creating the model data classes. When these classes are generated then in de build folder you can check if the annotation is added on the data class. This flow works for Java classes but not for Kotlin classes. And in our case we need kotlin data classes
Steps to reproduce
openApiGenerate {
generatorName.set("kotlin-spring")
inputSpec.set("
run gradle assemble and view the model data classes. In these classes you don't see the annotation.
Alternative with only Java does work. When you follow these step with generatorName.set("spring") ... etc
then the java classes for the model are created with the annotation above the class
Related issues/PRs
[BUG] Openapi-generator - generating springboot model class with lombok annotation #17780
Suggest a fix
Hello, any update on this?