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

whitelist: true option not working for new ValidationPipe #18

Open
moin-almin opened this issue Sep 4, 2023 · 1 comment
Open

whitelist: true option not working for new ValidationPipe #18

moin-almin opened this issue Sep 4, 2023 · 1 comment

Comments

@moin-almin
Copy link

I have been trying to reproduce the validation part using dtos and global pipes but for some reason the whitelist option is not working. I know there have been ground breaking changes with nest, and their document hasn't been updated for the same, but the issue persists.

Here is my auth.dto.ts:

import { IsEmail, IsNotEmpty, IsString } from "class-validator"

export class AuthDto {
    @IsEmail()
    @IsNotEmpty()
    email: string;

    @IsString()
    @IsNotEmpty()
    password: string;
}

Here is my main.ts:

import { NestFactory } from '@nestjs/core';
import { AppModule } from './app.module';
import { ValidationPipe } from '@nestjs/common';

async function bootstrap() {
  const app = await NestFactory.create(AppModule);
  app.useGlobalPipes(new ValidationPipe({
    whitelist: true,
  }));
  await app.listen(3333);
}
bootstrap();
@Mohab-Rageh
Copy link

did you solve it ?

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

No branches or pull requests

2 participants