Bug Report Checklist
Description
If the parent of a type is generated as interface the subtype is generated with a constructor call to the parent interface which doesn't compile:
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type", visible = true)
@JsonSubTypes(
JsonSubTypes.Type(value = SubtypeA::class, name = "subtypeA"),
JsonSubTypes.Type(value = SubtypeB::class, name = "subtypeB")
)
interface ParentSchema{
val id: kotlin.String
val type: DiscriminatingType
}
data class SubtypeA(
@get:NotNull
@field:JsonProperty("id") override val id: kotlin.String,
@get:NotNull
@field:Valid
@field:JsonProperty("type") override val type: DiscriminatingType,
@field:JsonProperty("subtypeAproperty") val subtypeAproperty: kotlin.Int? = null
) : ParentSchema(){
}
Note: ParentSchema(). The () prevent compilation
openapi-generator version
openapi-generator-maven-plugin:5.0.0
OpenAPI declaration file content or url
Sample spec
Related issues/PRs
Similar: #3587
Suggest a fix
I worked around it by removing the () from dataClass.mustache. This wouldn't work if the parent is a class.
Bug Report Checklist
Description
If the parent of a type is generated as interface the subtype is generated with a constructor call to the parent interface which doesn't compile:
Note:
ParentSchema(). The()prevent compilationopenapi-generator version
openapi-generator-maven-plugin:5.0.0
OpenAPI declaration file content or url
Sample spec
Related issues/PRs
Similar: #3587
Suggest a fix
I worked around it by removing the
()fromdataClass.mustache. This wouldn't work if the parent is a class.