reitit

https://cljdoc.org/d/metosin/reitit/ https://github.com/metosin/reitit/
bartuka 2020-03-04T11:52:40.045300Z

Hi, @ikitommi I was implementing a handler to process a type decimal and it returned an error saying that could not coerce the value. I remember that I sent a PR to help with this issue in spec-tools however, when I was looking at my toy-example, it used {:parameters {:form ::decimal-var?}} and now this new code is using {:parameters {:body ::decimal-vars?}} when I changed to :form it worked just fine! Could you point to where I can trace down the differences between :form and :body in reitit coercion?

bartuka 2020-03-04T12:56:28.046100Z

I need anything special to swagger enable the input box for path-parameters?

(s/def ::produto spt/string?)

(def product-routes
  ["/product/:produto" {:get {:summary "what is your configuration?"
                              :parameters {:path-params (s/keys :req-un [::produto])}
                              :handler (fn [req]
                                         (println req)
                                         {:status 200
                                          :body "ok"})}}])
this is my current handler

ikitommi 2020-03-04T18:25:37.046500Z

@iagwanderson it should be {:parameters {:path …}}. I recommned enabling the spec & spell checking on, it will warn about invalid keys at router creation time.

ikitommi 2020-03-04T18:27:54.047Z

e.g. form is always converterd from strings, body from the json, edn etc, which might have a different transformer used.