-
-
Notifications
You must be signed in to change notification settings - Fork 6.7k
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
[Typescript] Generate oneOf schemas as type unions #19494
[Typescript] Generate oneOf schemas as type unions #19494
Conversation
…me (OpenAPITools#19481)" This reverts commit 4238f17.
This change breaks EDIT: Opened an issue for this: #19868. |
@ksvirkou-hubspot would you mind having a look at #19868 by any chance, please? |
@simon-abbott can you produce a pull request with a fixture that shows the breakage or link me to some code showing what it should be vs. what it is right now? Maybe we can work together to try and solve this one? |
This issue occurs because the schema described doesn't include a discriminator. Without a discriminator, it's challenging to find out which object the API returns. I'm uncertain about the best course of action in this scenario. I could either throw an exception or return a JSON object. |
Unfortunately I don't have time to make a full MRE at the moment, but If you generate the example schema in #19868 in 7.7.0 and again in 7.9.0 (I didn't test in 7.8, but I predict it will behave like 7.7) you can see the difference in the main Fruit model. The main cause is that previously the Fruit model would be generated as a franken-class containing the properties (and thus the
See my reply in #19868. The spec says what to do. |
#19027 + latest
master
+ revert of #19481, see #19027 (comment)reverts #19481
closes #19027