-
Notifications
You must be signed in to change notification settings - Fork 6k
[Question] Can Swagger generate custom generic types? #8194
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
Comments
Bump |
i'm not so familiar with |
I agree with the opening post. At this moment if you have n APIs that all wraps n different objects, you end having Since typescript supports generics, it would be ideal to generate the typescript interfaces as generics as well. The code that use those could be more generic and the models would be DRY and smaller. |
A little more thinking into this and i just realized that there is an indecision case. Suppose a c# mode like this
and an api returning so we would have swagger generated model
how the generator's template should behave? Maybe a typescript-angular generate's option like |
Yes, the spec needs to be updated to handle this case. Otherwise, a generator would need a minimum of two types being used in a generic result before it could decide which properties are generic and which properties are stationary. |
Hi, is there any progress on supporting generics in TypeScript yet? Thanx! |
I have a same problem. |
I wish to use this feature too |
Same |
Any update on this? |
2021 says hello. I still need and want this feature. (Also seems to be my third time finding this issue via Google. ) |
+1 |
5 similar comments
+1 |
+1 |
+1 |
+1 |
+1 |
Same here |
2022 says hello. I still need and want this feature. |
Bumping for fix |
Would love to see this implemented |
i have the same problem . is is available? |
2023 says, siighhh.... still open... |
I wish to use this feature too |
+1 |
Great feature to implement. |
+1 |
still open... |
It's possible to document generics in a spec through dynamic references (henry andrews approved), but I don't think swagger-codegen supports them |
Hello! Any progress? |
Assume we have API return model in C#
and returning
ApiResult<string>
object instance to clientso we have swagger generated model
which is incorrectly converted to typescript class using https://swagger.io/swagger-codegen/
Is it possible to generate output models with generics same as in input models?
The text was updated successfully, but these errors were encountered: