Skip to content

PartialType can lead to 500 Internal Server Error #2843

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

Closed
2 of 4 tasks
KuanWenChen opened this issue Feb 16, 2024 · 1 comment
Closed
2 of 4 tasks

PartialType can lead to 500 Internal Server Error #2843

KuanWenChen opened this issue Feb 16, 2024 · 1 comment

Comments

@KuanWenChen
Copy link

KuanWenChen commented Feb 16, 2024

Is there an existing issue for this?

  • I have searched the existing issues

Current behavior

Issue nestjs/swagger#2623 has not been fixed in nestjs/swagger.
nestjs/mapped-types added the option skipNullProperties to PartialType, but nestjs/swagger did not.

Minimum reproduction code

https://github.com/KuanWenChen/swagger-issue

Steps to reproduce

  1. npm install
  2. npm run start:dev
  3. go to website http://localhost:3000/swagger
  4. POST /test/should-not-nullable with payload {"value": null}

Expected behavior

It should throw BadRequestError with error message "value must be a number conforming to the specified constraints"

Package version

7.3.0

NestJS version

10.3.3

Node.js version

v20.9.0

In which operating systems have you tested?

  • macOS
  • Windows
  • Linux

Other

No response

@kamilmysliwiec
Copy link
Member

Would you like to create a PR for this issue?

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

No branches or pull requests

2 participants