This commit is contained in:
Tommi Reiman 2022-02-15 13:50:35 +02:00
parent 0ac3a14805
commit 20b37b7d43

View file

@ -34,8 +34,8 @@
["/upload" ["/upload"
{:post {:summary "upload a file" {:post {:summary "upload a file"
:parameters {:multipart [:map [:file reitit.ring.malli/temp-file-part]]} :parameters {:multipart {:file reitit.ring.malli/temp-file-part}}
:responses {200 {:body [:map [:name string?] [:size int?]]}} :responses {200 {:body {:name :string, :size :int}}}
:handler (fn [{{{:keys [file]} :multipart} :parameters}] :handler (fn [{{{:keys [file]} :multipart} :parameters}]
{:status 200 {:status 200
:body {:name (:filename file) :body {:name (:filename file)
@ -56,26 +56,20 @@
["/plus" ["/plus"
{:get {:summary "plus with malli query parameters" {:get {:summary "plus with malli query parameters"
:parameters {:query [:map :parameters {:query {:x [:int {:title "X parameter"
[:x :description "Description for X parameter"
{:title "X parameter" :json-schema/default 42}]
:description "Description for X parameter" :y :int}}
:json-schema/default 42} :responses {200 {:body {:total :int}}}
int?]
[:y int?]]}
:responses {200 {:body [:map [:total int?]]}}
:handler (fn [{{{:keys [x y]} :query} :parameters}] :handler (fn [{{{:keys [x y]} :query} :parameters}]
{:status 200 {:status 200
:body {:total (+ x y)}})} :body {:total (+ x y)}})}
:post {:summary "plus with malli body parameters" :post {:summary "plus with malli body parameters"
:parameters {:body [:map :parameters {:body {:x [:int {:title "X parameter"
[:x :description "Description for X parameter"
{:title "X parameter" :json-schema/default 42}]
:description "Description for X parameter" :y :int}}
:json-schema/default 42} :responses {200 {:body {:total :int}}}
int?]
[:y int?]]}
:responses {200 {:body [:map [:total int?]]}}
:handler (fn [{{{:keys [x y]} :body} :parameters}] :handler (fn [{{{:keys [x y]} :body} :parameters}]
{:status 200 {:status 200
:body {:total (+ x y)}})}}]]] :body {:total (+ x y)}})}}]]]