Answers for "class validator compare number string"

0

typescript class validator validate enum array

export class UserDto {
  @IsEmail()
  readonly email: string;

  @IsOptional()
  @IsEnum(Permissions, { each: true })
  readonly permissions: Permissions[]; <- How to validate this?
}
Posted by: Guest on May-30-2020
0

class validator compare number string

class PermissionDto {
  @IsEnum(EPermission)
  permission: EPermission
}

export class UserDto {
  @IsEmail()
  readonly email: string;
  
  @IsArray()
  @ValidateNested()
  @Type(() => PermissionDto)
  @IsOptional()
  readonly permissions: PermissionDto[]; <- That is How to validate this?
}
Posted by: Guest on June-17-2021

Code answers related to "TypeScript"

Browse Popular Code Answers by Language