This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-10-12
Channels
- # beginners (85)
- # boot (7)
- # cider (7)
- # clara (1)
- # cljsrn (49)
- # clojure (85)
- # clojure-dev (19)
- # clojure-dusseldorf (15)
- # clojure-greece (1)
- # clojure-italy (12)
- # clojure-nl (4)
- # clojure-russia (21)
- # clojure-sanfrancisco (1)
- # clojure-spec (25)
- # clojure-uk (59)
- # clojurescript (29)
- # core-async (5)
- # core-matrix (1)
- # css (1)
- # datomic (1)
- # docker (10)
- # fulcro (12)
- # graphql (21)
- # hoplon (7)
- # jobs-rus (6)
- # jobs_rus (1)
- # lein-figwheel (1)
- # mount (5)
- # off-topic (6)
- # om (4)
- # onyx (8)
- # perun (1)
- # portkey (25)
- # protorepl (7)
- # re-frame (78)
- # reagent (24)
- # ring-swagger (32)
- # rum (3)
- # schema (1)
- # shadow-cljs (122)
- # spacemacs (3)
- # specter (2)
- # sql (1)
- # testing (1)
- # uncomplicate (2)
- # yada (14)
hi! I have upgraded from 1.x to 2.x and I am having issues with getting the body in some routes. It’s related to https://github.com/weavejester/compojure/wiki/Common-Problems . Before I had (middleware [[wrap-restful-params {:formats [:json :edn]}]] ...)
so all routes got the body. I tried (route-middleware [[wrap-restful-params {:formats [:json :edn]}]] ...)
since middleware was deprecated, but that did not do the trick.
what’s the new middleware I should use?
my setup is same as https://github.com/metosin/compojure-api/issues/206
@psalaberria002 2.x will use Muuntaja instead of ring-middleware-format, it’s 10x faster but with different config. There is a guide in Muuntaja how to set it up: https://github.com/metosin/muuntaja/wiki/Configuration.
awesome! that’s what I was looking for
@psalaberria002 https://github.com/metosin/compojure-api/wiki/2.0.0-Content-Negotiation-(with-Muuntaja)
I will give it a try.
still not working
am I missing something?
ooo I see now
in your docs you have a different way of declaring the middleware
I can’t recall what the route-middleware
does, but it’s just a vanilla ring middleware, so (wrap-format (routes route1 route2))
kind of thing should work I think.
it worked that way
great!
thanks for the help
and, you don’t have to say the :formats
in the apis, if you have defined before those. Doesn’t matter but there can be many Muuntaja mws in the pipeline, first matching does the thing, others are no-op.
np, great to hear you got it working. someone needs to rewrite the docs before 2.0.0 can be pushed out…
btw, you have :format {:formats [:json :edn]}
under the :swagger
? I believe it doesn’t mean anything there.
I was just playing with it
I will remove it
I'm trying to figure out how to coerce my response specs in compoure-api, could someone take a look and point me in the right direction? https://stackoverflow.com/questions/46702269/compojure-api-spec-coercion-on-response-body
Thanks! I had a follow-up question that I added there to keep the conversation in one place.
Thanks! Brilliant people contributing to the libs. I created a gist: https://gist.github.com/ikitommi/8a97080357fd7de06882ba99f0df974c
both the SpecCoercion and SchemaCoercion are implemented as Records, so you can print them out to see if it look ok. There could be specs out of help verifying that the data is sound after transformations.
Thanks! Brilliant people contributing to the libs. I created a gist: https://gist.github.com/ikitommi/8a97080357fd7de06882ba99f0df974c