// If your object contains nested objects and you want
// the validator to perform their validation too,
// then you need to use the @ValidateNested() decorator:
import { ValidateNested } from 'class-validator';
export class Post {
@ValidateNested()
user: User;
}