I'm trying to validate request with class-validator if it's array.
inputs comes from query param with /api/items?someTypes=this
my request dto looks like this.
(...)
@IsArray()
@IsEnum(SOMETHING, {each: true})
readonly someTypes: keyof typeof SOMETHING[];
(...)
when I give only one item, @IsArray gives validation error, saying it is not an array.
I want to make it array too when one item comes from query param, but I don't know how.
I know using /api/items?someTypes[]=this will pass validation.
but I want to know if there is another way to solve this.