-
-
Notifications
You must be signed in to change notification settings - Fork 7.4k
Closed
Labels
Description
Description
Clients generated with the typescript-nestjs experimental generator will not be compilable with the strict typescript compilation flag due to nullability issues in the generated ApiModule files.
openapi-generator version
Occurs in 7.2.0, used to work in 6.6.0. However, even in 6.6.0, certain features (which we don't use) also cause this to occur - see reproducer.
OpenAPI declaration file content or url
For the reproducer, I used the petstore project
Generation Details
npx @openapitools/openapi-generator-cli generate -g typescript-nestjs -i https://raw.githubusercontent.com/OpenAPITools/openapi-generator/master/modules/openapi-generator/src/test/resources/3_0/petstore.yaml
Steps to reproduce
- Generate client using command above
- Setup rest of dependencies (
npm i typescript axios @nestjs/common @nestjs/axios,npx tsc init) - Setup necessary compilation flags in
tsconfig.json("experimentalDecorators": true, "emitDecoratorMetadata": true) - Run typecheck (
npx tsc --noEmit)
A ready-to-use repository with the steps above taken is available at https://github.com/swcm-mnestler/nestjs-openapi-reproducer
Suggest a fix
I'll create a MR for the nullability instances that I encountered, but it's possible there are more of these occurrences in the code base.
Reactions are currently unavailable