Fork me on GitHub
#ring-swagger
<
2016-05-04
>
quantisan13:05:27

For compojure-api, I assoc'ed some keys into request map using middleware. How do I access them in the response?

ikitommi13:05:12

@quantisan: Just like with regular compojure, request as the third parameter: (GET "/path" request (ok {:value (:my-key request)}))

quantisan14:05:08

I tried destructuring it there but don't seem to work. (GET "/" [foo bar] ...)

ikitommi14:05:30

Should work, but you can only destructure known parameters (path, query, form at least), https://github.com/weavejester/compojure/wiki/Destructuring-Syntax#compojure-specific-destructuring

ikitommi14:05:04

c-api should pass 1:1 into compojure.

quantisan14:05:37

thanks a lot

quantisan14:05:05

awesome library! we've been using it in production for a few projects

quantisan14:05:18

looking forward to kekkonen too

quantisan14:05:09

I'm based in Copenhagen, btw. Ping me if you guys are in town. I'll get you guys a beer.

ikitommi14:05:16

@nnbosko: for some reason the comma-separated list coercion is disabled in ring-swagger, see https://github.com/metosin/ring-swagger/blob/master/src/ring/swagger/coerce.clj#L151. Maybe @juhoteperi remembers why. Anyway, you could pass the ids as query-params, that works.

ikitommi14:05:06

@quantisan: cool! will remember the beer :)