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?