Skip to content
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

[BUG][typescript-nestjs] Generated NestJS Module does not compile with "strict" flag #17671

Closed
swcm-mnestler opened this issue Jan 22, 2024 · 0 comments · Fixed by #17672
Closed

Comments

@swcm-mnestler
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant