Closed kasir-barati closed 2 years ago
I suggest raising this directly with https://github.com/swagger-api/swagger-ui
@kasir-barati Any secret knowledge you've obtained in the last few months that you might share with me?
Kinda have the same issue but haven't managed to dig out a solution
I am using NestJS and class-validator. We can in class-validator do this as we all know:
enum Gender { male = 'male', female = 'female' }
This
A
is used to validate query string Then when we sends a request with swagger it will sends something like this if we specify one age.http://localhost:9000/endpoint?genders=male
But this will make class-validator unsatisfied in my experience. I mean it throw an Error and says
genders
is not an array.What will work?
Sending this request
http://localhost:9000/endpoint?genders[]=male
. class-validator understand how to deal with genders[] but if you sends genders you have to do this:http://localhost:9000/endpoint?genders=male&genders=male