Fork me on GitHub
#reitit
<
2020-03-04
>
bartuka11:03:40

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?

ikitommi18:03:54

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

bartuka02:03:43

Thanks! I'm in a hurry right now, but I will investigate this more carefully probably this weekend (Y)

bartuka12:03:28

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

ikitommi18:03:37

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

bartuka02:03:37

Thanks for the tip! It works fine! o/