#@nestjs/swagger doesn't reflect the typescript anymore

4 messages · Page 1 of 1 (latest)

simple ermine
#

Since some time I've the issue that @nestjs/swagger doesn't inference the types from typescript anymore.

For example I have the following DTO:

class UserBaseDto {
  @ApiProperty({ example: "admin@example.com", description: "The email of the user" })
  @IsEmail()
  @IsNotEmpty()
  @Expose()
  email: string;

  @Expose()
  @ApiProperty({ example: UserRole.ADMIN, description: "The role of the user" })
  role?: UserRole;
}

It won't recognize the UserRole as an enum until I explicitly set @ApiProperty({ enum: UserRole, example: UserRole.ADMIN, description: "The role of the user" }). The same goes for required: false.

What could have happened in a dependency upgrade, that @nestjs/swagger doesn't read the typescript anymore?

#

I suspect some typescript version conflict?

#

I've deleted the node_modules and restartet

#

now it works..