Fork me on GitHub
#ring-swagger
<
2016-04-06
>
lmergen09:04:57

hmm ok, so I'm using compojure-api and I'm trying to validate & bind a hierarchical JSON request body as arguments... for which I assume I have to use :body-params

lmergen09:04:09

as far as I understand, :body-params uses letk notation

lmergen09:04:48

I am having trouble completely grasping letk though... is it just the same syntax as 'regular' Clojure destructruring ?

lmergen09:04:03

nvm, i figured it out... awesome:

:body-params [foo :- (describe String "baz")
                          [:bar
                           wombat :- (describe String "batwom")]]
will accept {:foo "baz" :bar {:wombat "blah"}}

ikitommi13:04:32

fnks are awesome :)

ikitommi13:04:22

you can also use :body, which used regular let-bind.

lmergen18:04:06

hmmm what is the advantage of using body over body-params (or the other way around) ? a matter of preference ?