swagger
                                
                                 swagger copied to clipboard
                                
                                    swagger copied to clipboard
                            
                            
                            
                        Swagger plugin v4 not recognizing enum as a key in validated object
Bug Report
Current behavior
I've updated my code to use swagger v4 with plugin, so it exposes DTO validations automatically. Everything work correctly, unless i use enum as a key of validated object. In output code, enum is not being imported and nest assumes it is global.
Input Code
import { IsBoolean, IsOptional } from 'class-validator';
import { ReservationReminderType } from '../../../shared/reservation/enums/reservation.reminder.type.enum';
export class UpdateShopNotifiactionsDto {
  @IsBoolean()
  @IsOptional()
  [ReservationReminderType.OneDayBefore]?: boolean;
}
Output Code (compiled)
const openapi = require("@nestjs/swagger");
const class_validator_1 = require("class-validator");
const reservation_reminder_type_enum_1 = require("../../../shared/reservation/enums/reservation.reminder.type.enum");
class UpdateShopNotifiactionsDto {
    static _OPENAPI_METADATA_FACTORY() {
        return { [ReservationReminderType.OneDayBefore]: { required: false, type: () => Boolean }, };
    }
}
Expected behavior
Output code should use reservation_reminder_type_enum_1 in its static _OPENAPI_METADATA_FACTORY() method.
Error
(node:22659) UnhandledPromiseRejectionWarning: ReferenceError: ReservationReminderType is not defined
    at Function._OPENAPI_METADATA_FACTORY ([...]/shop.notifications.update.dto.js:18:19)
Environment
Nest version: 6.10.13
 
For Tooling issues:
- Node version: 10.16.0  
- Platform:  Mac, Linux
Others:
Build works correctly, error happens at runtime (dev & prod start)
4.1.7 should ignore computed properties. That means, the error won't happen at runtime anymore but you'll have to manually add @ApiProperty.
I'm encountering a similar issue while trying to uprade from @nestjs/swagger 3.x to 4.x. In our case we aren't using enums as a key, but just as the type of the variable. It occurs when we use an enum that is imported from another npm module. The error is similar, and it seems to not be able to resolve the source file.
@arvinsingla, please, create a separate issue with a repository which reproduces your problem.
It seems to happen when importing any type of value. In my case when importing constants as the value for MinLength().
@IGassmann, please, create a separate issue with a repository which reproduces your problem.
@kamilmysliwiec done here https://github.com/nestjs/swagger/issues/543
@karer is this still an issue with the latest version?