reitit

https://cljdoc.org/d/metosin/reitit/ https://github.com/metosin/reitit/
2021-07-02T07:37:57.109500Z

This is definetely something very easy to do but dont get it to work. I have a data spec as

(def email-regex #"^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,63}$")

(s/def ::address (st/spec
                   {:spec (s/and
                            string?
                            #(re-matches email-regex %))
                    :reason             "Must be an valid email address"
                    :decode/string      #(str/lower-case %2 )
                    :swagger/type "string"
                    :json-schema/format "email"
                    :json-schema/type   "string"}))
And that works just right for
(st/coerce ::address "<mailto:Heikki.Hamalainen@solita.fi|Heikki.Hamalainen@solita.fi>" st/string-transformer) -&gt; "<mailto:heikki.hamalainen@solita.fi|heikki.hamalainen@solita.fi>"
But when i add that to Reitit parameter like
{:tags ["public"]
    :get  {:parameters {:query {:id ::address}}
           :responses  {200 {:body {:message       string?}}}
           :handler    (fn [_]
                         {:status 200
                          :body   {:message  (-&gt; _ :parameters :query :id)}})}}
The result is not transformed lower case. What I am doing wrong? I have spec-coercer in coercion working because invalid falue returns an error.