Skip to content

[KotlinSpring] Generated model is invalid if 'inheritance' is used #1205

@mikezx6r

Description

@mikezx6r
Description

The Kotlin Spring generator currently generates inheritance of data classes if a schema/type uses allOf and $ref. Kotlin data classes do not support inheritance, so this is invalid code.

The generator will need to generate properties from the main object, as well as the sub-object directly.

openapi-generator version

3.2.3, 3.3.0 and 3.3.1-SNAPSHOT

OpenAPI declaration file content or url

https://gitlab.com/mikezx6r/openapi-test/blob/master/src/main/resources/api.yml

Command line used for generation

Using Gradle. kotlin-spring language. Refer to https://gitlab.com/mikezx6r/openapi-test/blob/master/build.gradle for specifics.

Steps to reproduce

./gradlew oAGenerate and view the models generated into the src/main/generated-kotlin folder

Related issues/PRs
Suggest a fix/enhancement

The data class needs to contain all the properties from itself as well as from the 'child' class directly.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions