-
Notifications
You must be signed in to change notification settings - Fork 6k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
[Typescript] Does not support polymorphism #9339
[Typescript] Does not support polymorphism #9339
Comments
this is fixed by swagger-api/swagger-codegen-generators#531, closing now, but please let me know if you get something wrong and i'll reopen it. |
Hi @HugoMario, I have just tried with the example published on this issue but we are not quite there. MyResponse interface is correct:
But then, the type that should be generated for
MyConfigurationOne and MyConfigurationTwo are correct too. It's just the link between the parent type and its childs.
Please let me know what you think! |
@micaelboucard , yea that should bbe the output, thanks for reporting it, going to work back on this ticket. |
Thanks @HugoMario ! |
Hey @HugoMario , i've seen that v3.0.14 has been released today. Is this bug fixed on that release? |
Hi @micaelboucard, unfortunately, fix is not on release, i'm just going to add a new PR tomorrow |
Great! Thanks for the update @HugoMario . I'll keep on eye on this issue.. |
Hi @micaelboucard , just merged a new PR solving issue. Can you try it when you have a chance please? |
🥇 @HugoMario !! |
this is still an issue for typescript rxjs :( |
Description
I got a model that could have 2 different shapes. Following OpenAPIv3 specs I want to be able to generate typescript code from a OpenAPIv3 specification using
oneOf
that takes care of it and with the help of the discriminator field, be able to serialise to the appropriate shape.Swagger-codegen version
v3.0.7
Swagger declaration file content
From:
Command line used for generation
java -jar ./swagger-codegen-cli/bin/swagger-codegen-cli.jar generate -i ./swagger-codegen-cli/my-openapi.yml -l typescript-angular -o ./swagger-codegen-cli/services/my-data-service
Steps to reproduce
Generate service from yaml file.
Created interfaces do not implement polymorphism as expected.
MyConfigurationOne and MyConfigurationTwo interfaces are well defined.
But MyConfiguration object is a mix of both, which is not what it is intended:
Suggest a fix/enhancement
Polymorphism in typescript could be translated to:
a MyConfiguration type:
referenced in the MyResponse interface:
The text was updated successfully, but these errors were encountered: