metosin / reitit

A fast data-driven routing library for Clojure/Script
https://cljdoc.org/d/metosin/reitit/
Eclipse Public License 1.0
1.42k stars 254 forks source link

Body parameters are always an array #684

Open jdkealy opened 4 months ago

jdkealy commented 4 months ago

I can't seem to make any endpoint receive just a regular map. Everything is an array. As you can see, I have a key "test" and swagger UI is showing it as an array. Any idea how to resolve this ?

(def account-handlers
  ["/accounts" {:coercion reitit.coercion.spec/coercion
                :swagger {:tags ["accounts"]}}
   [""
    {:get {:summary "All Accounts"
           :handler accounts-handler}
     :post {:parameters {:body {:test int?}}
            :summary "Create Account"
            :handler create-account-handler}}]])
Screenshot 2024-05-25 at 1 21 09 PM
opqdonut commented 1 month ago

I can't reproduce this. I tried adding your endpoint to examples/ring-spec-swagger, and it works as expected. Could you post a minimal reproduction?

post-accounts

opqdonut commented 1 month ago

Sorry, closed by accident :innocent: