title: NestJS/Class-transformer @Type Discriminator object doesn't correctly validate data
body: <p>I have a generic class as following:</p>
  
  <pre><code>import {IsArray, IsNotEmpty, IsString, ValidateNested} from "class-validator";
  import {PatientInfoValidator} from "./businessInfo/PatientInfoValidator";
  import {TypeValidator} from "./TypeValidator";
  import {Type} from "class-transformer";
  
  export class GenericValidator {
      @IsString()
      @IsNotEmpty()
      userId: string;
  
      @ValidateNested({each:true})
      @Type(() =&gt; TypeValidator)
      type: TypeValidator;
  }
  </code></pre>
  
  <p>And two classes which inherit from this class</p>
  
  <pre><code>import {IsArray, IsNotEmpty, IsString, ValidateNested} from "class-validator";
  import {PatientInfoValidator} from "./businessInfo/PatientInfoValidator";
  import {Type} from "class-transformer";
  import {BusinessInfoValidator} from "./BusinessInfoValidator";
  import {GenericValidator} from "./GenericValidator";
  import {TypeValidator} from "./TypeValidator";
  
  export class BodyValidator extends GenericValidator {
      @IsString()
      @IsNotEmpty()
      userId: string;
  
      @ValidateNested({each:true})
      @Type(() =&gt; TypeValidator)
      type: TypeValidator;
  
      @ValidateNested({each:true})
      @Type(() =&gt; BusinessInfoValidator)
      businessInformation: BusinessInfoValidator;
  
      @IsArray()
      sheetLink: string[];
  
      validate: boolean;
  }
  
  </code></pre>
  
  <p>And:</p>
  
  <pre><code>import {GenericValidator} from "./GenericValidator";
  import {IsNotEmpty, IsString, ValidateNested} from "class-validator";
  import {Type} from "class-transformer";
  import {TypeValidator} from "./TypeValidator";
  
  export class CaseTwoValidator extends GenericValidator {
      @IsString()
      @IsNotEmpty()
      userId: string;
  
      @ValidateNested({each:true})
      @Type(() =&gt; TypeValidator)
      type: TypeValidator;
  
      newKey: string;
  }
  </code></pre>
  
  <p>These are used in the DTO for validation:</p>
  
  <pre><code>import { ApiProperty } from '@nestjs/swagger';
  import {ValidateNested} from "class-validator";
  import { Type } from 'class-transformer';
  import { BodyValidator} from "../validators/BodyValidator";
  import { GenericValidator} from "../validators/GenericValidator";
  import { CaseTwoValidator} from "../validators/CaseTwoValidator";
  
  export class CreateSheetsDto {
      @ApiProperty()
      @ValidateNested({ each: true })
      @Type(() =&gt; GenericValidator, {
          keepDiscriminatorProperty: true,
          discriminator: {
              property: "type.label",
              subTypes: [
                  { value: BodyValidator, name: "Hors dissection et syndrome neurologique" },
                  { value: CaseTwoValidator, name: "NewCase" }
              ]
          }
          })
      readonly body: BodyValidator | CaseTwoValidator;
  }
  
  </code></pre>
  
  <p>I'm expecting the controller having this DTO as params to:
  Reject as Bad request all request body which are not conform to BodyValidator or CaseTwoValidator format.</p>
  
  <p>Current behavior: 
  API requests are very permissive, and doesn't enforce nested checks.</p>
  
  <p>I was wondering if I'm missing something obvious having spent 3hours on this issue.</p>