title: NestJs validate array in request body
body: <p>I'm trying insert validation into PUT request.</p>
  
  <p><strong>DTO's:</strong></p>
  
  <pre><code>export class SettingUpdateDto implements ISettingUpdate {
      @IsInt()
      @IsPositive()
      id: number;
  
      @IsNotEmpty()
      @IsString()
      value: string;
  }
  
  export class SettingArrayUpdateDto {
      @Type(() =&gt; SettingUpdateDto)
      @ValidateNested({ each: true })
      items: SettingUpdateDto[];
  }
  </code></pre>
  
  <p><strong>Controller</strong></p>
  
  <pre><code>@Put()
  async updateItem(@Body() items: SettingArrayUpdateDto) {
      return await this.dataService.update(items);
  }
  </code></pre>
  
  <p><strong>Servise</strong></p>
  
  <pre><code>async update(items: SettingArrayUpdateDto[]): Promise&lt;Setting&gt; {
      console.log("service data", items);
      return &lt;Setting&gt;{}; &lt;SettingUpdateDto[]&gt;items;
  }
  </code></pre>
  
  <p>When i sent data, like this:</p>
  
  <pre><code>[
      {"id": -20, "value": {"name": "333"}},
      {"id": 21, "value": "2222222222222222"}
  ]
  </code></pre>
  
  <p>I received empty array. What am I doing wrong? Where is the mistake?</p>
  
  <p>When i change settings in controller from SettingArrayUpdateDto to any, controller received original request data.</p>
  
  <p>NestJs 6.10.14 version.</p>