import { ApiProperty } from '@nestjs/swagger'; import { Transform } from 'class-transformer'; import { IsInt, IsNotEmpty, IsString } from 'class-validator'; export class ProductIdDto { @ApiProperty({ description: 'id identifier' }) @IsNotEmpty() @IsInt() @Transform(({ value }) => value !== undefined ? Number(value) : undefined) id!: number; @ApiProperty({ description: 'sku identifier' }) @IsNotEmpty() @IsString() sku!: string; }