You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I pass record instances using transit+json format to api POST handler. It works fine when used with :body. But when :body-params is used: record instances are unexpectedly turned into plain maps.
I tracked it to compojure.api.coercion/coerce-request! which calls walk/keywordize-keys which in turn recursively turns record instances into maps (which is a questionable behaviour on its own: https://clojure.atlassian.net/browse/CLJ-2505).
It's told to keywordize for :body-params in meta.clj.
This issue looks very similar to this PR about disabling keywordizing in :body: #265. We discussed it on Slack back in 2017.
Workaround
I had to patch walk/postwalk so that it doesn't touch instances of my protocol (using clj-fakes):
Library Version(s)
2.0.0-alpha29
Problem
I pass record instances using
transit+json
format toapi
POST handler. It works fine when used with:body
. But when:body-params
is used: record instances are unexpectedly turned into plain maps.Test code:
Cause
I tracked it to
compojure.api.coercion/coerce-request!
which callswalk/keywordize-keys
which in turn recursively turns record instances into maps (which is a questionable behaviour on its own: https://clojure.atlassian.net/browse/CLJ-2505).It's told to keywordize for
:body-params
in meta.clj.This issue looks very similar to this PR about disabling keywordizing in
:body
: #265. We discussed it on Slack back in 2017.Workaround
I had to patch
walk/postwalk
so that it doesn't touch instances of my protocol (usingclj-fakes
):The text was updated successfully, but these errors were encountered: