question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ValidationPipe - forbidUnknownValues support

See original GitHub issue

I’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

ValidationPipe doesn’t support forbidUnknownValues options property

Expected behavior

It should support it

Minimal reproduction of the problem with instructions

@UsePipes(new ValidationPipe({forbidUnknownValues: true}))

What is the motivation / use case for changing the behavior?

It is important validation mechanism also this option will be set to true in 1.0 class-validator release

Environment


Nest version: 5.0.0

 
For Tooling issues:
- Node version: 9.11.1  
- Platform: Linux Debian Buster 

Others:

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:2
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

4reactions
kamilmysliwieccommented, May 25, 2018

Fixed in v5.0.1. Leaving opened to remember about the docs

2reactions
SebastianPodgajnycommented, May 20, 2018

I couldn’t get it working, but it might be related to some ‘class-validator’ bug. Anyway i think we need to include it in https://github.com/nestjs/nest/blob/master/packages/common/interfaces/external/validator-options.interface.ts

Read more comments on GitHub >

github_iconTop Results From Across the Web

Validation | NestJS - A progressive Node.js framework
The ValidationPipe provides a convenient approach to enforce validation rules for all ... forbidUnknownValues, boolean, If set to true, attempts to validate ...
Read more >
Fixing validation error in NestJS when ... - Darragh ORiordan
Conclusion. You should be able to use the forbidUnknownValues setting in the validation pipe configuration as expected now. In general once I ...
Read more >
Fixing validation error in NestJS when ... - DEV Community ‍ ‍
Conclusion. You should be able to use the forbidUnknownValues setting in the validation pipe configuration as expected now. In general once I ...
Read more >
Nestjs class validator dto validate body parameters
I want to throw BadRequest or something because test is not defined in dto. Can you guys help me? typescript · nestjs ·...
Read more >
Documentation | NestJS - A progressive Node.js framework
As noted earlier, a validation pipe either returns the value unchanged, ... This is possible because Nest supports both synchronous and asynchronous pipes....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found