NestJs OmitType classes doesn't have the swagger ApiProperties values

69 views Asked by At

Given a simple DTO

export class PersonDTO {
  @IsInt()
  @ApiProperty({
    example: 1,
  })
  id: number;

  @IsString()
  @MaxLength(50)
  @ApiProperty({
    minLength: 2,
    maxLength: 50,
    example: 'Poppy',
  })
  name: string;
}

and then I create an creatDTO using OmitType

export class CreatePersonDTO extends OmitType(PersonDTO, [
  'id',
] as const) {}

The newly created DTO is missing all it's ApiProperties information when looking in swagger, both example values and schema, am I doing something wrong?

0

There are 0 answers