Skip to content
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

[REQ][Bounty] AnyOf - OneOf - AllOf support #10514

Open
leus opened this issue Oct 2, 2021 · 11 comments
Open

[REQ][Bounty] AnyOf - OneOf - AllOf support #10514

leus opened this issue Oct 2, 2021 · 11 comments

Comments

@leus
Copy link

leus commented Oct 2, 2021

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

Nowadays many popular OpenAPI specifications describe objects using oneOf / anyOf / allOf keywords. Regardless if this was a good or a bad idea, the OpenAPI generator should support this to avoid having to resort to manual fixes in build chains.

Describe the solution you'd like

Full support for these keywords in all generators.

Describe alternatives you've considered

Right now the only feasible workaround is to manually remove all of the methods that use these schema combine keywords or to implement them by hand in the generated code. This is obviously not ideal.

Additional context

This has been reported in many occassions before: #10450, #10352, #9858 , #9684, #9443, #2906, #5381, #8647, #8860, #9601, #9981, #9305, #9301, #9163, #8860, and many more.

@leus
Copy link
Author

leus commented Oct 2, 2021

I'm creating this in order to gain traction to get sponsorship for this work.

@flipch
Copy link

flipch commented Oct 4, 2021

Given that currently different return objects for status code is non existent this is the other alternative.

@leus
Copy link
Author

leus commented Oct 11, 2021

Given that currently different return objects for status code is non existent this is the other alternative.

Sorry - which alternative?

@c0dezli
Copy link

c0dezli commented Oct 19, 2021

Yep this is very frustrating, the community has been asking this for a long time...

@Mehly
Copy link

Mehly commented Nov 8, 2021

This is indeed very frustrating. But at least it's on the "short-term roadmap" of OpenAPI generator :

Short term are focused on improving contributor and user productivity (part of this is getting the word out).

  • [...]
  • OAS3.0 features support: anyOf, oneOf, callbacks, etc"

I hope they provide support for it real soon :)

@mariodsantana
Copy link

I've opened #10812 and now realize it's really just a python-specific subset of this. That ticket has a $1,000 bounty for now, in case someone's monitoring this issue and needs a little motivation. :D

@Dizzzmas
Copy link

+1 for this feature

Encountered this today when trying to generate TypeScript client code via ts-axios generator with oneOf in the OpenApi specification.

The generated code includes this unnecessary broken import which fails compilation of the client library:

import { |MyDto } from './|my-dto';

@wing328 wing328 changed the title [REQ] AnyOf - OneOf - AllOf support [REQ][Bounty] AnyOf - OneOf - AllOf support Nov 4, 2022
@vpishuk
Copy link

vpishuk commented Dec 11, 2022

oneOf works in my case. But anyOf simply takes the last model's attributes instead of composing all of them.

@vpishuk
Copy link

vpishuk commented Dec 11, 2022

I have an MR to fix anyOf generation for typesciprt-axios generator: #14241

@lrebscher
Copy link

Is there an update on when the feature can be supported?

Since the requested feature has been on the short-term roadmap for over 2 years, I have the feeling that it has been abandoned.

We use the typescript-angular generator in our projects and have to decide whether to replace it with another generator that supports anyOf (e.g. openapi-ts), or stick to workarounds in the hope that openapi-generator will support it soon.

@XaviPeiro
Copy link

Any update?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

9 participants