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