I'm attempting to ensure the validity of a request using DTO. The validation requirements are that the value must be a number and cannot be empty.
Upon trying to use just the IsNumber() decorator and sending a body with an empty property, the validation process fails. Therefore, I attempted to add the IsNotEmpty() decorator as well. However, it seems this approach is not effective because even when passing an empty property, the flow continues without any validation errors. Here is a snippet of my code:
export class CreateOrderShippingDto implements CreateOrderShippingDtoInterface {
@ApiProperty({
type: Number,
})
@IsNotEmpty()
@IsNumber()
readonly orderId: number;
}
Could someone offer assistance with this issue?