Fork me on GitHub
#ring-swagger
<
2016-10-19
>
csm00:10:02

is there a better example for specifying :formats and :params-opts currently in compojure-api? I’m not having success getting a custom :params-opts working

jstokes03:10:06

yeah i’m using metrics-clojure with compojure-api @abarylko

abarylko04:10:58

@jstokes awesome! Are you happy with it? Would you have a small example?

ikitommi13:10:09

@csm quick browse from my phone: {:format {:params-opts {:transit-json {:handlers t/readers}}, :response-opts {:transit-json {:handlers t/writers}}}}

abarylko16:10:17

@jstokes that’s great, thank you! What do you use to visualize the stats?

jstokes16:10:11

@abarylko we use sensu that hits the /metrics endpoint in our application, loads into influxdb/graphana. before was reporting to librato

csm17:10:55

I think what I was stuck on is what t/readers is supposed to be in the above. I tried a function that calls ring.middleware.format-params/wrap-format-params with my decoder (which parses graphql), but that function doesn’t ever seem to be called

csm17:10:23

but at any rate I just changed things around so the swagger UI looks right, and I’m just doing parsing of the raw request in the handler for now

abarylko18:10:23

@jstokes thanks a lot!

ikitommi20:10:48

@csm hmm.. coudn’t find anything with wrap-format-params. Maybe you mean ring.middleware.format-params/wrap-restful-params?

ikitommi20:10:24

stuff under :format gets passed to the wrap-restful-params & wrap-restful-response middleware (from ring-middleware-format).

ikitommi20:10:58

hope this helps.

ikitommi20:10:11

we’ll try to write a good guide on custom decoders/encoders when Muuntaja ships.

ikitommi20:10:16

If that doesn’t resolve it, would help if you could throw in a code sample what you are trying to do.

csm20:10:40

thanks, @ikitommi. I can wait until muuntaja is done, I’ve got something that works (without :params-opts) for now