-
Notifications
You must be signed in to change notification settings - Fork 427
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 instantiationType for maps #691
Comments
Lukas-Kullmann
pushed a commit
to Lukas-Kullmann/swagger-codegen-generators
that referenced
this issue
Mar 12, 2021
Any update on this issue? |
Are there any updates regarding this PR? I have the same issue. It would be really good if this got fixed or at least there would be a workaraound |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi!
I have an issue where an CodegenModel for a map-like object is incorrectly generated. I am not sure which way to go from here. Is it the generated OASv3 model or the code generator for typescript. I would appreciate any guidance from this community.
I generated a specification for a spring boot project of mine with springdoc. There I use spring data rest which generates APIs with Link/Links: https://github.com/spring-projects/spring-hateoas/blob/1.1.x/src/main/java/org/springframework/hateoas/Links.java#L44
There is a customization in springdoc for these:
This is the OASv3 spec excerpt for just the Links.
When generating the typescript-fetch template I get to the method
io.swagger.codegen.v3.generators.DefaultCodegenConfig#toInstantiationType
. This method gets themap
key frominstantiationTypes
as seen hereswagger-codegen-generators/src/main/java/io/swagger/codegen/v3/generators/DefaultCodegenConfig.java
Line 1021 in 76ea8a8
This is
null
because themap
key is never set seen hereswagger-codegen-generators/src/main/java/io/swagger/codegen/v3/generators/typescript/AbstractTypeScriptClientCodegen.java
Line 86 in 2a561d8
So CodegenModel.parent becomes
null<String, Link>
which causes the generated model to be like this:I think the proper typescript way would just be:
or maybe alternatively, keeping extends:
There are some issues regarding the springdoc generated OASv3 spec like springdoc/springdoc-openapi#524.
The text was updated successfully, but these errors were encountered: