Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • O openapi-generator
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,476
    • Issues 3,476
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 402
    • Merge requests 402
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • OpenAPI Tools
  • openapi-generator
  • Issues
  • #3058
Closed
Open
Issue created Jun 02, 2019 by Administrator@rootContributor

[BUG] Multi Level Inheritance not generated correctly

Created by: rlsf

As can be seen in these issues: https://github.com/OpenAPITools/openapi-generator/issues/1685 https://github.com/OpenAPITools/openapi-generator/issues/2928

there is a problem with generating multi-level hierarchy with OpenAPI 4.x.x and 5.x.x. the problem exists in numerous languages that we tested so we guess that it is a problem with the main code.

For example for the yaml below taken from issue 1685 version 3.3.4 generates the expected

class Animal {…}
class Cat extends Animal {…}
class Dog extends Animal {…}
class BigDog extends Dog {…}

While 4.xx and 5.xx generate

class Animal {…}
class Cat extends Animal {…}
class Dog extends Animal {…}
class BigDog {…}

generation was executed using the maven-openapi-generator of the respective version (4.x.x and 5.x.x)

openapi: 3.0.0
info:
  title: Sample API
  description: API description in Markdown.
  version: 1.0.0
paths:
  /animals:
    get:
      summary: Returns all animals.
      description: Optional extended description in Markdown.
      responses:
        200:
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Animal'
components:
  schemas:
    Dog:
      allOf:
        - $ref: '#/components/schemas/Animal'
        - type: object
          properties:
            breed:
              type: string
    Cat:
      allOf:
        - $ref: '#/components/schemas/Animal'
        - type: object
          properties:
            breed:
              type: string
    BigDog:
      allOf:
        - $ref: '#/components/schemas/Dog'
        - type: object
          discriminator:
            propertyName: dogType
            required:
              - dogType
          properties:
            dogType:
              type: string
            declawed:
              type: boolean
    Animal:
      type: object
      discriminator:
        propertyName: className
      required:
        - className
      properties:
        className:
          type: string
        color:
          type: string
          default: red
Assignee
Assign to
Time tracking