This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-08-31
Channels
- # announcements (1)
- # babashka (27)
- # beginners (107)
- # calva (2)
- # cider (1)
- # clara (1)
- # clj-kondo (17)
- # clojure (74)
- # clojure-europe (18)
- # clojure-nl (4)
- # clojure-norway (3)
- # clojure-spec (11)
- # clojure-uk (3)
- # clojurescript (10)
- # conjure (12)
- # datomic (4)
- # figwheel-main (1)
- # fulcro (28)
- # graalvm (11)
- # hugsql (12)
- # joker (1)
- # klipse (5)
- # malli (2)
- # meander (1)
- # membrane (9)
- # off-topic (26)
- # pedestal (6)
- # remote-jobs (1)
- # ring-swagger (5)
- # shadow-cljs (4)
- # test-check (14)
- # vrac (8)
- # xtdb (8)
Hello Can I ask one simple question about https://github.com/metosin/compojure-api
I just started use it in integration with existing project (that uses vanilla compojure)
required as [compojure.api.sweet :as compojure]
(defroutes resource-routes
(context "/v1" []
(compojure/GET "/hello-compojure" []
(compojure/resource
{:coercion :spec
:get {:parameters {:query-params (s/keys :req-un [::name])}
:responses {200 {:schema (s/keys :req-un [::message])}}
:handler (fn [{{:keys [name]} :query-params}]
(println :hello)
(r/response {:message (str "Hello, " name)}))}}))
I've put one hello world api inside router and tested with midje library(fact
(util/with-test-system
(util/make-request (util/json-request :get "/v1/hello-compojure?name=johndo")))
=> 2)
but failed with this exception
Expected:
2
Actual:
java.lang.IllegalArgumentException: No implementation of method: :spec of protocol: #'schema.core/Schema found for class: clojure.spec.alpha$map_spec_impl$reify__1997
schema.core$eval8753$fn__8765$G__8742__8770.invoke(core.clj:110)
schema.coerce$eval10007$coercer__10012$fn__10013$fn__10014.invoke(coerce.clj:32)
schema.spec.core$run_checker.invokeStatic(core.clj:69)
schema.spec.core$run_checker.invoke(core.clj:65)
schema.coerce$eval10007$coercer__10012$fn__10013.invoke(coerce.clj:30)
... omit the rest
could you pinpoint what am I doing wrong?