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
  • #4912
Closed
Open
Issue created Jan 02, 2020 by Administrator@rootContributor5 of 6 checklist items completed5/6 checklist items

[Python] Multilevel inheritance discriminator support

Created by: eak24

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • What's the version of OpenAPI Generator used? 4.2.3
  • Have you search for related issues/PRs? Yes - they are #4446
  • What's the actual output vs expected output?
  • [Optional] Bounty to sponsor the fix (example)
Description

@spacether

When using OAS to describe a complex polymorphic graph, the client is currently unable to serialize grandchildren of any given type (subclasses of subclasses.) I have made a recursive model lookup function, which recursively looks at the discriminators of the subclasses (discriminated classes) until the leaf nodes, but that has very bad performance, reducing performance to 1/100 of normal deserialization. There is a lot of repeated work done for the same model over and over, so I added caching, and the performance is now roughly 1/10 of what it was. Ideally, there would be some way to specify the whole type mapping dictionary.

openapi-generator version

4.2.3

OpenAPI declaration file content or url
components:
  schemas:
    Animal:
      type: object
      required:
      - type_key
      properties:
        type_key:
          type: string
      mapping:
        pet: '#/components/schemas/Pet'
    Pet:
      type: object
      properties:
        type_key:
          type: string
      discriminator:
        propertyName: type_key
        mapping:
          cat: '#/components/schemas/Cat'
    Cat:
      type: object
      properties:
        type_key:
          age: number
Suggest a fix

See Description

Assignee
Assign to
Time tracking