REST API 호출시 DTO을 검사하여 잘못된 데이터 및 타입에 대해 서버를 보호
whitelist: true, // class-validator가 없는 프로퍼티는 body에서 제거된다.
forbidNonWhitelisted: true, // 초과 프로퍼티에 대해 오류를 발생시킨다.
transform: true, // string 형을 number,boolean 등으로 자동 변환
✅ whitelist boolean
If set to true, validator will strip validated (returned) object of any properties that do not use any validation decorators.
✅ forbidNonWhitelisted boolean
If set to true, instead of stripping non-whitelisted properties validator will throw an exception.
skipMissingProperties boolean
If set to true, validator will skip validation of all properties that are missing in the validating object.
forbidUnknownValues boolean
If set to true, attempts to validate unknown objects fail immediately.
disableErrorMessages boolean
If set to true, validation errors will not be returned to the client.
errorHttpStatusCode number
This setting allows you to specify which exception type will be used in case of an error. By default it throws BadRequestException.
exceptionFactory Function
Takes an array of the validation errors and returns an exception object to be thrown.
groups string[]
Groups to be used during validation of the object.
dismissDefaultMessages boolean
If set to true, the validation will not use default messages. Error message always will be undefined if its not explicitly set.
validationError.target boolean
Indicates if target should be exposed in ValidationError.
validationError.value boolean
Indicates if validated value should be exposed in ValidationError.