fix(typescript-nestjs-server): import generic return types#24005
fix(typescript-nestjs-server): import generic return types#24005zonradkuse wants to merge 1 commit into
Conversation
|
Thanks for the PR but your commit (as shown in the Commits tab) is not linked to your Github account, which means this PR won't count as your contribution in https://github.com/OpenAPITools/openapi-generator/graphs/contributors. Let me know if you need help fixing it. |
|
Fixed. Thanks for noticing. |
|
cc @aryobenholzner (author of the generator) |
|
@zonradkuse do you mind sharing a minimal spec to reproduce the issue? |
|
Sure: then Then have a look at the imports in |
|
can verify the issue and the fix. the existing tests didn't pick this one up, because maybe there's an existing sample we could add to the test suite? but not sure if that's necessary and/or feasible |
We observed that
Arrayreturn types would be missing their corresponding import in the controller and the api. The cause is a typo in the typescript-nestjs-server generator that checked if a fullArraytype needed importing instead of the generic parameterTtoArray<T>.This PR fixes the behaviour.
PR checklist
Commit all changed files.
This is important, as CI jobs will verify all generator outputs of your HEAD commit as it would merge with master.
These must match the expectations made by your contribution.
You may regenerate an individual generator by passing the relevant config(s) as an argument to the script, for example
./bin/generate-samples.sh bin/configs/java*.IMPORTANT: Do NOT purge/delete any folders/files (e.g. tests) when regenerating the samples as manually written tests may be removed.
Summary by cubic
Fixes missing imports for generic return types in the
typescript-nestjs-servergenerator by importing the generic type (e.g., T in Array) instead of the container type. This ensures controllers and APIs include correct model imports and avoids compile errors.Written for commit 95e899a. Summary will update on new commits.