Fork me on GitHub
#ring-swagger
<
2017-11-16
>
ikitommi07:11:43

@j0ni currently, the response coercion middleware is added to the nearest to the handler and all own mw are applied after it (in the response pipeline). Usually one would like to see the coerced response in the mws. But clearly there are cases for the opposite. Do you have ideas how to fix this… elegantly?

ikitommi07:11:42

@slipset 2.0.0-SNAPSHOT should have the context+coercion fixed. The :coercion was only applied to children of context, not to itself.

ikitommi07:11:39

the pred-thing. How are you getting it? Does it apper with the latest version(s)?

slipset07:11:24

@ikitommi I’ll find a minimal report for the prod thing once I’m back at work. It might have cropped up while having a predicate that was coll-of smthng. I figured it was related to the first bug you fixed for me (the one where the pred was serialized to json (which didn’t work for anonymous fns)). I seem to remember you doing a str to fix that, and that sort of rhymes with what I see.

arttuka13:11:02

hi, just noticed that clojure.spec.alpha/merge breaks JSON conforming in Compojure-API / spec-tools. With this body spec:

(s/def ::kw1 st/keyword?)
(s/def ::kw2 st/keyword?)
(s/def ::body (s/merge (s/keys :req-un [::kw1])
                       (s/keys :req-un [::kw2])))
and this request body:
{
  "kw1": "kw1",
  "kw2": "kw2"
}
in the conformed request body, the value of :kw1 is the string "kw1"and the value of :kw2 is the keyword :kw2:
{:kw1 "kw1", :kw2 :kw2}

arttuka13:11:27

not sure if this is a known bug so i thought i’d first throw it here before filing an issue on github

ikitommi13:11:20

@arttuka haven’t seen. And it’s in spec-tools. Hoping for a PR…

slipset13:11:12

@ikitommi If you could give me some pointers to where to start wrt to the two issues I filed yesterday, I’d be more than happy to try a couple of PRs

mhcat14:11:41

@ikitommi hrm, tricky - initially I was thinking something like {:middleware {:inner [[wrap-my-middleware]] :outer [[wrap-the-regular-mw]]}} but I'm not sure that applying transformations in that sequence to requests is anything but confusing. So maybe it would be better to have, so maybe it shouldn't be thought of as middleware

mhcat14:11:34

I can't think what I'd call the key though... something that points to the response-only nature of the transformation

ikitommi14:11:21

@j0ni one option would be to disable The response coercion and manually add the response-coercion mw into right place on the chain

mhcat14:11:35

that sounds good - so long as the request-coercion remains in last place regardless

petr.mensik20:11:37

May I ask how to turn off response validation for Schema? Ideally just for certain routes and not globally (although global config would be fine as well)