This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-06-24
Channels
- # beginners (61)
- # boot (1)
- # cider (55)
- # cljs-dev (17)
- # cljsrn (1)
- # clojure (31)
- # clojure-india (5)
- # clojure-spec (9)
- # clojure-uk (42)
- # cursive (3)
- # datomic (29)
- # editors (3)
- # fulcro (23)
- # hoplon (2)
- # lumo (12)
- # off-topic (8)
- # pedestal (6)
- # re-frame (3)
- # reagent (8)
- # reitit (23)
- # shadow-cljs (82)
- # specter (14)
- # tools-deps (8)
I just wrote a bigger bunch of routes at once and now swagger.json is dying with this error:
500 : java.lang.IllegalArgumentException: No implementation of method: :into-spec of protocol: #'reitit.coercion.spec/IntoSpec found for class: nil
I figure I made a typo somewhere or something. Any suggestions where should I start looking? Misplaced/typoed keys? What can cause this?@vale one thing that could help is turn on the route data validation. It should catch these kind of errors: https://metosin.github.io/reitit/ring/route_data_validation.html
e.g. the middleware have their own specs attached. All routes are validated againt the merged specs of all middleware (and router-level specs)
for example, the request-coercion muddleware have a spec requirement of reitit.spec/parameters
:
(def coerce-request-middleware
"Middleware for pluggable request coercion.
Expects a :coercion of type `reitit.coercion/Coercion`
and :parameters from route data, otherwise does not mount."
{:name ::coerce-request
:spec ::rs/parameters
:compile (fn [{:keys [coercion parameters]} opts]
(if (and coercion parameters)
(let [coercers (coercion/request-coercers coercion parameters opts)]
(fn [handler]
(fn
([request]
(let [coerced (coercion/coerce-request coercers request)]
(handler (impl/fast-assoc request :parameters coerced))))
([request respond raise]
(let [coerced (coercion/coerce-request coercers request)]
(handler (impl/fast-assoc request :parameters coerced) respond raise))))))))})
The next version will allow nils btw: https://github.com/metosin/reitit/pull/104
["/authorize"
{:summary "OAuth authorization form"
:get {:swagger {:produces #{"text/html"}}
:handler auth-form}
:post {:swagger {:produces #{"text/html"}}
:responses
{200 {:description "When no redirect URI is specified for the app
in question, a HTML page is rendered with the
token."}
302 {:description "If there was a redirect URI, the user is
redirected."}}
:handler authorize}}]
it says the same if i do {200 {:swagger {:description ...}}}
. what's the right way to describe responses then?