[Kotlin] Models with "additionalProperties" result in invalid Kotlin code
Created by: jonpeterson
Description
When using the kotlin-spring
generator, OpenAPI models including additionalProperties
are generated as invalid Kotlin code.
openapi-generator version
5.4.0 and 6.0.1
OpenAPI declaration file content or url
components:
schemas:
MyObject:
type: object
properties:
value:
type: string
additionalProperties: true
required:
- value
...is generated into...
data class MyObject(
@field:JsonProperty("value", required = true) val `value`: kotlin.String,
) : kotlin.collections.HashMap<String, kotlin.Any>{
}
Note the missing ()
after kotlin.collections.HashMap<String, kotlin.Any>
.
Suggest a fix/enhancement
I'd propose the fix as just adding the missing ()
to the kotlin-spring
's dataClass.mustache
file, but I'm not sure if it should be fixed there or in the general Kotlin code for the variable being provided to the template.