swagger-api / swagger-codegen

swagger-codegen contains a template-driven engine to generate documentation, API clients and server stubs in different languages by parsing your OpenAPI / Swagger definition.
http://swagger.io
Apache License 2.0
17.09k stars 6.03k forks source link

[typescript-inversify] generates unusable code #9785

Closed michalzubkowicz closed 4 years ago

michalzubkowicz commented 5 years ago
Description

typescript-inversify generates unusable code, with TypeScript warnings, also services are injected in a way that doesn't work with current version of inversify: https://github.com/inversify/InversifyJS/issues/1004#issuecomment-541392992

Swagger-codegen version

2.4.9

Command line used for generation

swagger-codegen-cli.jar -l typescript-inversify

Suggest a fix/enhancement

1) Move DI classses from contructor to properties (api.service.mustache) 2) Replace type casting from <> to "as" (TS recommend that) 3) Replace == with === 4) Remove redundant local variable basePath. 5) fix quotemarks

HugoMario commented 4 years ago

covered by #9786 , so closing. thanks again @michalzubkowicz for your help.