title: Class validator with array of nested objects in nestjs
body: <p>I'm trying to validate array of nested objects in nestjs and it works fine. But if I send non-array value like string or null, then I get an error:</p>
  
  <p><code>TypeError: Cannot read property 'length' of undefined.</code> </p>
  
  <p>Nested field:</p>
  
  <pre><code>@IsArray()
  @ValidateNested({ each: true })
  @Type(() =&gt; NestedDTO)
  nested: NestedDTO[];
  </code></pre>
  
  <p>How can I validate that value is an array before validate nested objects?</p>
  
  <p>Versions:</p>
  
  <pre><code>NestJS: 6.10.14
  class-validator: 0.11.0
  </code></pre>