Fork me on GitHub
#ring-swagger
<
2017-06-30
>
ikitommi09:06:10

there is also loose matching with regex on content-type in muuntaja: https://github.com/metosin/muuntaja/wiki/Configuration#loose-matching-on-content-type. The results are (fifo-)memoized against input, so about as fast as the the exact-matching like "application/json". I dislike regexs, but as current ring-json, ring-transit & ring-middleware-format have that, it’s supported in Muuntaja.

ikitommi09:06:32

for the dynamic swagger generation - not easy with c-api. Libs like Kekkonen (https://github.com/metosin/kekkonen) create swagger-docs dynamically: routes are filtered away based on user privileges and one can partially apply parameters for request and get a “what do I still need” docs. But swagger-ui doesn’t really support that.

ikitommi09:06:21

When the spec-things are finalized, there could be a spec-enabled api-docs ui for e2e cljs apps, while swagger would serve the non-cljs clients.

d5p15:06:59

bit of an odd question that i do have a workaround for but curious , i’d like to put the swagger.json as generated from (swagger-routes) behind an api resource (behind liberator in fact to reuse shared auth / etc) , struggling to get this to work , have a liberator resource just returning (swagger-routes) , with no coercion , with my swagger items configured under top level (api {:swagger})

d5p15:06:16

this just gives me a cannot encode json exception

d5p15:06:04

is this the right approach? i’d just like to generate a swagger.json and serve it as a resource

d5p15:06:37

i ended up just duplicating the (let [runtime-info …) from api/swagger.clj (swagger-docs) in my liberator resource and it works fine