Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support discriminator for polymorphic types and support oneOf #219

Closed
bowenwr opened this issue Oct 16, 2020 · 1 comment · May be fixed by #717
Closed

Support discriminator for polymorphic types and support oneOf #219

bowenwr opened this issue Oct 16, 2020 · 1 comment · May be fixed by #717
Labels
✨ enhancement New feature or improvement 🍭 OpenAPI Compliance Supporting a new bit of the OpenAPI spec

Comments

@bowenwr
Copy link
Contributor

bowenwr commented Oct 16, 2020

Is your feature request related to a problem? Please describe.

When an endpoint returns oneOf several different classes, currently it returns an empty object. Sample component snippet:

    ReturnedObject:
      oneOf:
        - $ref: '#/components/schemas/PolymorphicType'
        - $ref: '#/components/schemas/AnotherPolymorphicType'

Describe the solution you'd like

Support discriminators to be able to deserialize polymorphic types.

@bowenwr bowenwr added the ✨ enhancement New feature or improvement label Oct 16, 2020
@dbanty
Copy link
Collaborator

dbanty commented Nov 14, 2020

I tested this with the latest code on main (roughly 0.7.0-rc.1) and it does attempt to generate proper responses now using the same code it would for unions inside a model (basically a series of try/except). So it's better than nothing, though for sure we still should add discriminators in a future version.

@dbanty dbanty added this to To do in OpenAPI 3.0 Compliance Apr 4, 2021
@dbanty dbanty added the 🍭 OpenAPI Compliance Supporting a new bit of the OpenAPI spec label Aug 13, 2023
@openapi-generators openapi-generators locked and limited conversation to collaborators Aug 13, 2023
@dbanty dbanty converted this issue into discussion #830 Aug 13, 2023

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
✨ enhancement New feature or improvement 🍭 OpenAPI Compliance Supporting a new bit of the OpenAPI spec
Projects
No open projects
Development

Successfully merging a pull request may close this issue.

2 participants