-
Notifications
You must be signed in to change notification settings - Fork 6k
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
Which languages support polymorphism? #4622
Comments
@dkdndes Thanks for your response, but I was not referring to the general possibility of the language to support polymorphism, but if the swagger-codegen is able to create code from a swagger spec that uses polymorphism. This seems not to be true for every language so I was wondering if there might be a way to get an overview. |
@boldtrn I believe C# and Javascript have better support for polymorphism and I agree with your comment that some languages (e.g. Flash/Actionscript) do not have proper polymorphism support yet. Which language(s) you would like to see polymorphism support? Is that something you can also help contribute? |
@wing328 Thanks for your reply.
Actually I'd love to generate clients for all available languages. So it would be great if at least all major languages would support polymorphism. I think if we had to skip some minor languages that would be fine. The alternative would be to model our API without polymorphism. This would make our API less powerful, but the essentials would still work.
The languages I would feel comfortable to contribute something like this already support polymorphism. I think it might not be the best idea to contribute something like this to a language I don't know well enough. So I think for now I would go without polymorphism and accept that the API is less powerful. |
Do Python, Ruby & Scala have polymorphism support? If not, is anyone working on this? |
@sixers I don't think anyone is working on it and would suggest you to start with Python first. Thanks for offering help to add the polymorphism support. |
@boldtrn Re the use case in your OP I wrote several REST APIs that used polymorphism in the Swagger Editor and then used the same to generate clients in Python and server stubs in Java Spring. But I ran into various issues with polymorphism and enums which resulted in significant rewrites of the APIs, making them larger and uglier in my opinion. Frankly I was annoyed that the Swagger Editor doesn't highlight which languages or client/server options do not fully support the OpenAPI spec. Ideally the editor wouldn't have shown those languages at all, or put 'beta' next to their name to indicate their working status. To my mind a language client/server option shouldn't be listed in the editor unless it passes all the unit tests required for 100% compliance with the spec. Until something like this happens I'll be very wary of generating clients/server stubs in future - you simply can't assume they will meet the spec and your API's use of the spec. I use Apache Thrift for cross-language comms as well and that has a helpful matrix showing where support is less than 100% and what issues are outstanding - https://wiki.apache.org/thrift/LibraryFeatures?action=show&redirect=LanguageSupport . Admittedly that looks out of date but it would be good if Swagger could have a web page with a similar matrix. |
Totally agreed. We'd a look at https://kangax.github.io/compat-table/es6/ before and started with a Google spreadsheeet but that didn't go well. I'll try to folk https://kangax.github.io/compat-table/es6/ and put something together after the 2.3.0 release.
Agreed. Some language generators (especially the new one) are less mature than the others. Putting "Beta" or "Alpha" next to it will help manage user expectations. (currently, some generators do have "beta" in the help text, example, but that's not shown in Swagger Editor or other tools that leverage Swagger Codgen for code/doc generation) |
Thanks @wing328; I'm glad you see the need to set users' expectations here, so others don't experience the same disillusionment with Swagger that I went through! I appreciate that a feature/issue matrix is difficult to keep up to date manually. I can imagine it might be possible to auto-populate such a table based on code coverage analysis and the automated raising of issues when unit tests fail in certain areas. But it would probably be difficult to tune and rely on the output of such a system without at least some human oversight. |
Any progress on this issue? python code generation still does not properly support polymorphism at least through the |
Does the golang output of |
Usecase:
My goal is to generate clients from a swagger spec in most of the available languages.
Problem:
My API requires to use polymorphism. So polymorphism seems to be not fully supported by the swagger-codegen yet? Is there an overview to see which language supports it or not. I think this would be really helpful (not only to me :)).
What I found out by reading issues is that: Java,PHP, Swift, and ObjC support polymorphism. It seems that Python does not support polymorphism. How about the other languages?
The text was updated successfully, but these errors were encountered: