I try this approach but when I enter input that shouldn't pass when validate it return []
import { validate } from 'class-validator';
import { plainToClass } from 'class-transformer';
import { MyDTO } from './MyDTO';
const body = { name: 'John', age: '25' };
const myDtoInstance = plainToClass(MyDTO, body);
console.log(await validate(myDtoInstance))
Edited: This work but in my MyDTO It's like this
class MyDTO {
datas: DataDTO
}
class DataDTO{
@Length(10,30)
name: string
}
The validator in DataDTO not run