Skip to content

[Kotlin][allOf] Generated Code, Data class extends Data class #6080

Closed
@donpaul120

Description

@donpaul120
components:
  schemas:
    Pet:
      allOf:
        - $ref: '#/components/schemas/NewPet'
        - type: object
          required:
          - id
          properties:
            id:
              type: integer
              format: int64

    NewPet:
      type: object
      required:
        - name  
      properties:
        name:
          type: string
        tag:
          type: string  

The above spec generates:

data class NewPet (
   @SerializedName("name")
   val name: kotlin.String,
   @SerializedName("type")
   val type: kotlin.String,
)


data class Pet (
   @SerializedName("id")
   val id: kotlin.Int
) : Pet

In Kotlin it's impossible for a data class to extend a data class.

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