ValidateNested does not work
See original GitHub issueI’m submitting a…
[ ] Regression
[X] Bug report
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead post your question on Stack Overflow.
Current behavior
When using ValidateNested
from class-validator
to validate a nested object on a dto, the validation passes successfully with invalid nested objects.
Expected behavior
When using ValidateNested
to validate a nested object on a dto, the validation should fail with validation rules.
Minimal reproduction of the problem with instructions
https://gist.github.com/chimon2000/d2203b281bbaea570eeccb36ebd6de9b
What is the motivation / use case for changing the behavior?
N/A
Environment
Nest version: 4.6.4
For Tooling issues:
- Node version: v8.9.4
- Platform: Windows
Others:
N/A
Issue Analytics
- State:
- Created 6 years ago
- Comments:5
Top Results From Across the Web
ValidateNested not working · Issue #83 - GitHub
We are using NestJS and are implementing a validation pipe (combination of class-transformer and class-validator). Unfortunately @ ...
Read more >Validate nested objects using class validator and nestjs
I've just put your code in an empty sample project and it seems to work for me. What specific value is "not working"?...
Read more >Validating nested objects with class-validator in NestJS
import { ValidateNested } from 'class-validator'; export class Post { @ValidateNested() user: User; }. But for some reason It doesn't work ...
Read more >API payloads validation and transformation in NestJS - Medium
@ValidateNested() post: Post; }. The above code won't work because when we are trying to transform objects that have nested objects, it's required...
Read more >Validating Complex Requests With NestJS - Better Programming
If you don't transform — validation will not run. ... @ValidateNested({ each: true }) — triggers an array nested validation, so we can...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Is it possible to reopen this issue? I’m currently experiencing this, and unfortunately @chanlito’s solution doesn’t do the trick.