I want to validate a list of nested Object @ the request:
export class Room {
@ApiProperty()
@IsNotEmpty()
@IsString()
name: string;
@ApiProperty({ type: [RoomMate] })
@IsNotEmpty()
@IsArray()
@ValidateNested({ each: true })
roomMates: RoomMate[];
}
The documation linked at nest.js (https://github.com/typestack/class-validator#validating-arrays) only talks about nested Objects, but not about a List of nested objects
If I execute the code above it says:
{
"statusCode": 400,
"message": [
"0.an unknown value was passed to the validate function"
],
"error": "Bad Request"
}
If I delete "@ValidateNested({ each: true })" it won't be validated (you could pass eg Cats & Dogs instead of RoomMates)
Any idea?