Fork me on GitHub
#ring-swagger
<
2016-10-07
>
koolkk13:10:15

does anyone knows how to get a coma separated list from the url using compojure-api

koolkk13:10:44

i declared the route like so "/docks/:dockIds/tickets/decode"

koolkk13:10:05

and :path-params [dockIds :- [String]]

ikitommi14:10:44

@koolkk I think it's doable but not trivial. You should create a custom schema coersion matcher to convert the string-with-commas into a list of Strings and plug it in to compojure-api. The tests demonstrate how to plug it in: https://github.com/metosin/compojure-api/blob/master/test/compojure/api/coercion_test.clj

ikitommi14:10:36

still, I would use query-params or body-params for lists

koolkk14:10:20

@ikitommi what i don't understand is that is not even trying to coerce the thing, it tryies to resolve the url. And i think its valid to have this types of url. I mean i can not even get the coma separated numbers as a string. It tries to resolve the addres and responds 404

koolkk14:10:38

when i declare the type as String then it resolves correctly

koolkk14:10:09

Is it normal to pass lists like that in the url? Personally i think its not the right way but i have to do it like that.

koolkk14:10:38

i think i'll just interpret it as a string

koolkk14:10:42

On the other hand swagger understands exactly what its supposed to do and generates the correct doc

ikitommi15:10:41

404 sounds strange. But the routing comes directly from Compojure. What kind of url does the swagger-ui resolve out of that?

koolkk16:10:42

that i think