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

Nestjs validation does not work for booleans #29

Closed
maxmousse opened this issue Mar 16, 2021 · 0 comments · Fixed by #260
Closed

Nestjs validation does not work for booleans #29

maxmousse opened this issue Mar 16, 2021 · 0 comments · Fixed by #260
Assignees
Labels
effort: hours Workload to solve this issue is about hours priority: critical (1) Critical priority issue that must be resolved immediately scope: tpl-models scope: tpl-rest-dtos status: blocked This issue is blocked by another issue type: bug type: 3rd party

Comments

@maxmousse
Copy link
Contributor

maxmousse commented Mar 16, 2021

Describe the bug
In nestjs validation workflow, the payload is first transformed by class-transformer then validated by class-validator. However, for boolean type, class-transformer parses any string to true making the @boolean decorator useless...
An issue is currently opened in class-validator: typestack/class-transformer#550

To Reproduce
Run the e2e tests and all the validation tests for boolean fields should break

Expected behavior
Boolean fields must be properly transformed and validated, and non-boolean strings (other than 'true' or 'false') must return a 400 http error.

@maxmousse maxmousse added effort: hours Workload to solve this issue is about hours priority: critical (1) Critical priority issue that must be resolved immediately scope: tpl-models scope: tpl-rest-dtos status: blocked This issue is blocked by another issue type: 3rd party type: bug labels Apr 16, 2021
@maxmousse maxmousse self-assigned this Sep 1, 2021
@floross floross closed this as completed Nov 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
effort: hours Workload to solve this issue is about hours priority: critical (1) Critical priority issue that must be resolved immediately scope: tpl-models scope: tpl-rest-dtos status: blocked This issue is blocked by another issue type: bug type: 3rd party
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants