metosin / reitit

A fast data-driven routing library for Clojure/Script

Home Page:https://cljdoc.org/d/metosin/reitit/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

examples/ring-malli-swagger returns http 500 error

vinurs opened this issue · comments

i run the example in ring-malli-swagger, and change the test code math->plus->get to

{:summary "plus with malli query parameters"
                :parameters {:query [:map
                                     [:x
                                      {:title "X parameter"
                                       :description "Description for X parameter"
                                       :json-schema/default 42}
                                      int?]
                                     [:y int?]
                                     [:z [:vector {:decode/string #(str/split % #"," )}
                                          [:and :int
                                           [:> 5]]

                                     ]]]}
                :responses {200 {:body [:map [:total int?]]}}
                :handler (fn [{{{:keys [x y]} :query} :parameters}]
                           {:status 200
                            :body {:total (+ x y)}})}

i add the z vector and decode it, when i run

curl -X 'GET' \
  'http://127.0.0.1:3000/math/plus?x=42&y=1&z=2' \
  -H 'accept: application/json'

it return http 400,but when i run

curl -X 'GET' \
  'http://127.0.0.1:3000/math/plus?x=42&y=1&z=6,2' \
  -H 'accept: application/json'

it return http 500
is that the malli format i used in this example is wrong?

[:z [:vector {:decode/string #(str/split % #"," )}
                                          [:and :int
                                           [:> 5]]]]