SMILEY4 / ktor-swagger-ui

Kotlin Ktor plugin to generate OpenAPI and provide Swagger UI

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to set a queryParameter as type List<String>

tobyworks opened this issue · comments

commented

I have a call that expect a list of strings as a query parameter, as following:

endpoint?v=abc&v=xyz

but i can't define it as:

request{
  queryParameter("v", List<String>::class)
}

i can only define it as:

request{
  queryParameter("v",List::class)
}

but then the swagger docs expects a array [object] however im looking for a array[String]

Hi,

you can specify types as generic type parameters. So writing it like this

queryParameter<List<String>>("v")

should solve your problem