I want to receive object with their respective keys with the error message. Kinda like yup validation library . is there any way to specify what error message should look like in DTOs
errors: [{name: "name" , message: "Name should not be empty"} , {...}]
instead of this
message: ["Name should not be empty" , "..."]
DTO For Reference:
export class CreateStudentDto {
@IsString()
@IsNotEmpty()
name: string;
@IsEmail()
email: string;
@IsDateString()
dob: Date;
@IsOptional()
age: number;
}