ring-swagger

ring-swagger & compojure-api
wontheone1 2020-08-31T14:26:39.000400Z

Hello Can I ask one simple question about https://github.com/metosin/compojure-api

wontheone1 2020-08-31T14:27:19.001Z

I just started use it in integration with existing project (that uses vanilla compojure)

wontheone1 2020-08-31T14:28:55.002300Z

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

wontheone1 2020-08-31T14:29:42.003Z

(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

wontheone1 2020-08-31T14:30:12.003400Z

could you pinpoint what am I doing wrong?