title: Class-Validator DTO composition
body: <p>lets say i have this DTO's</p>
  <pre><code>export class Dto1 {     
    @Expose()
    @IsDefined()
    @IsString()
    @Length(4, 10)
    code: string;
          
    @Expose()
    @IsDefined()
    @IsString()
    @Length(4, 15)
    label: string;
          
    @Expose()
    @IsDefined()
    @IsString()
    @MaxLength(250)
    description: string;
  }
      
  export class Dto2 {
    @Expose()
    @IsDefined()
    @IsString()
    @Length(4, 10)
    code: string;
          
    @Expose()
    @IsDefined()
    @IsString()
    @Length(4, 15)
    label: string;
          
    @Expose()
    @IsDefined()
    @IsInt()
    quantity: number;
  }
      
  export class Dto3 {     
     @Expose()
     @IsDefined()
     @IsString()
     @Length(4, 10)
     code: string;
          
     @Expose()
     @IsDefined()
     @IsString()
     @MaxLength(100)
     description: string;
  }
  
  </code></pre>
  <p>since inheritance is not posible in this situation, and since i have some fields that i use in alot of different DTO's, is there a way to make a template for each field and use that template in my DTO's ?</p>
  <p>something like TypeORM Entity Composition.</p>
  <p><strong>( Exemple from typeORM Doc )</strong></p>
  <pre><code>    import {Column} from &quot;typeorm&quot;;
      
      export class Name {
          
          @Column()
          first: string;
          
          @Column()
          last: string;
          
      }
      
      import {Entity, PrimaryGeneratedColumn, Column} from &quot;typeorm&quot;;
      import {Name} from &quot;./Name&quot;;
      
      @Entity()
      export class User {
          
          @PrimaryGeneratedColumn()
          id: string;
          
          @Column(type =&gt; Name)
          name: Name;
          
          @Column()
          isActive: boolean;
          
      }
      
  </code></pre>