This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-04-24
Channels
- # architecture (7)
- # beginners (73)
- # boot (4)
- # cider (48)
- # cljsjs (7)
- # cljsrn (27)
- # clojure (206)
- # clojure-boston (2)
- # clojure-italy (21)
- # clojure-nl (8)
- # clojure-spec (7)
- # clojure-uk (94)
- # clojurescript (126)
- # clojutre (7)
- # core-async (3)
- # cursive (7)
- # data-science (1)
- # datascript (4)
- # datomic (6)
- # duct (1)
- # emacs (19)
- # figwheel (1)
- # fulcro (31)
- # graphql (13)
- # jobs (5)
- # jobs-discuss (42)
- # keechma (4)
- # leiningen (10)
- # luminus (3)
- # mount (2)
- # nyc (3)
- # off-topic (37)
- # om-next (3)
- # onyx (45)
- # pedestal (2)
- # re-frame (4)
- # reagent (2)
- # reitit (16)
- # shadow-cljs (118)
- # spacemacs (10)
- # tools-deps (8)
- # vim (20)
get’s expanded into:
["/chsk" {:get {:handler ring-ajax-get-or-ws-handshake}
:post {:handler ring-ajax-post}}]
made a sample repo, and in the end found out that I need to add wrap-keyword-params too :]
I’m using Ring ‘wrap-param’ , which creates a ‘:param’ key with all of all the parameters in one map. Is there a way to apply dataspec coercion to that key? So that I can just pass the param key into my handler without having to destruct the request via :body, :path, :query parameters keys?
@grierson currently no. Personally I think it’s better to have explicit definitions where the parameters are coming from. If you have same parameter (e.g. :id
) defined in multiple locations (query, body, form, header, path), which one is used with :params
?
That said, the parameter lookup could be made configurable via router options. currently it’s defined in https://github.com/metosin/reitit/blob/master/modules/reitit-core/src/reitit/coercion.cljc#L44-L49
oh, about the :params
. If there would be a separate Coercion for those, it would be double-coercion. Better would be to add a custom middleware that reads all the coerced params and injects those into [:parameters :params]
.