Fork me on GitHub
#yada
<
2017-07-01
>
nha13:07:28

I know yada can use ring handlers, but is there a way to add yada resources "annotations" to a ring handler? For example I want to reuse a ring handler function but also add parameter validation, swagger annotation etc.

nha14:07:12

Another unrelated question. It seems that transit+json behaves differently as transit+msgpack

(update (yada/response-for (yada/resource {:methods {:get {:produces [{:media-type #{"application/transit+msgpack"
                                                                                     "application/json;q=0.9"
                                                                                     "application/transit+json;q=0.8"}
                                                                       :charset "UTF-8"}]
                                                           :response (fn [ctx]
                                                                       {:content "some-content"})}}})
                           :get
                           "ignore-me"
                           {:headers {"accept" "application/transit+msgpack"
                                      ;; replace with transit+json and it works
                                      }})
        :body (fn [s]
                (yada.request-body/parse-stream "application/transit+msgpack" s)
                ;; replace with transit+json and it works
                )) ;; body is - 17, but is {:content "some-content"} with transit+json