From ddcdfff89b7e23ecb30c7ef09bf000dd8ac43353 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julian=20T=C3=B6lle?= Date: Sat, 9 May 2020 16:29:17 +0200 Subject: [PATCH] feat(api): enable global ValidationPipeline --- src/main.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/main.ts b/src/main.ts index 31354e7..4841580 100644 --- a/src/main.ts +++ b/src/main.ts @@ -2,9 +2,16 @@ import { NestFactory } from "@nestjs/core"; import { NestExpressApplication } from "@nestjs/platform-express"; import { DocumentBuilder, SwaggerModule } from "@nestjs/swagger"; import { AppModule } from "./app.module"; +import { ValidationPipe } from "@nestjs/common"; async function bootstrap() { const app = await NestFactory.create(AppModule); + app.useGlobalPipes( + new ValidationPipe({ + transform: true, + transformOptions: { enableImplicitConversion: true }, + }) + ); app.enableShutdownHooks(); // Setup API Docs