This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-01-09
Channels
- # announcements (1)
- # atlanta-clojurians (1)
- # beginners (198)
- # calva (4)
- # cider (16)
- # clara (8)
- # cljs-dev (14)
- # cljsrn (4)
- # clojure (204)
- # clojure-europe (3)
- # clojure-gamedev (2)
- # clojure-italy (8)
- # clojure-nl (17)
- # clojure-poland (3)
- # clojure-russia (20)
- # clojure-spec (32)
- # clojure-uk (45)
- # clojurescript (59)
- # community-development (1)
- # core-async (25)
- # cursive (20)
- # datomic (47)
- # emacs (7)
- # fulcro (8)
- # iot (1)
- # iotivity (2)
- # jobs (1)
- # jobs-discuss (8)
- # juxt (11)
- # luminus (5)
- # nrepl (4)
- # off-topic (136)
- # onyx (24)
- # other-lisps (1)
- # parinfer (74)
- # pedestal (1)
- # planck (3)
- # portkey (67)
- # random (1)
- # re-frame (28)
- # reagent (11)
- # reitit (9)
- # remote-jobs (3)
- # ring-swagger (2)
- # rum (3)
- # shadow-cljs (96)
- # slack-help (3)
- # spacemacs (6)
- # tools-deps (3)
- # unrepl (1)
- # vim (4)
Hey Friends, I'm trying to use reitit's spec funcationality I have something like the following:
(s/def ::display-name string?)
(s/def ::request
(s/keys :opt-un [::display-name]))
["/groups/:uuid" {:coercion rcs/coercion
:name ::groups-by-uuid
:middleware [middleware/wrap-internal-error
middleware/wrap-formats
middleware/wrap-base]
:patch {:parameters {:params ::request}
:handler (fn [{:keys [path-params session params] :as req}]
(prn "*&^*&^" params)
{:status 200
:body {:total 99}})}}]
However, it doesnt' appear to be applying the spec to my paramsIs it obvious as to what I'm missing? I've seen in the examples https://github.com/metosin/reitit/blob/master/examples/ring-example/src/example/spec.clj that they appear to be using hte body keyword, but I don't see any data inside of (:parameters req)
@petr hi. I think you don't have the coercion middleware mounted. The :parameters
and :responses
are just data and don't do anything by themselves. See https://github.com/metosin/reitit/blob/master/examples/ring-swagger/src/example/server.clj for a commented chain of mw.
Goal is to enable making the route data validator strict, so here it would complain about extra keys in route data. Cases likes this would fail-fast.
@petr oh, you should define what type of parameters you want to define, the guide is https://metosin.github.io/reitit/ring/coercion.html. hope this helps