mirror of
https://github.com/metosin/reitit.git
synced 2025-12-16 16:01:11 +00:00
fix: dissoc unsupported [:responses nnn :content] for swagger
otherwise swagger generation crashes when it tries to serialize
something like `{:content {"foo/bar" any?}}`
also fix examples/ring-malli-swagger
This commit is contained in:
parent
7b4127b0f1
commit
e4c75c7354
4 changed files with 6 additions and 2 deletions
|
|
@ -61,7 +61,7 @@
|
|||
{:get {:summary "downloads a file"
|
||||
:swagger {:produces ["image/png"]}
|
||||
:responses {200 {:description "an image"
|
||||
:content {"image/png" any?}}}
|
||||
:content {"image/png" {:schema string?}}}}
|
||||
:handler (fn [_]
|
||||
{:status 200
|
||||
:headers {"Content-Type" "image/png"}
|
||||
|
|
|
|||
|
|
@ -259,6 +259,7 @@
|
|||
(for [[status response] responses]
|
||||
[status (as-> response $
|
||||
(set/rename-keys $ {:body :schema})
|
||||
(dissoc $ :content)
|
||||
(update $ :description (fnil identity ""))
|
||||
(if (:schema $)
|
||||
(update $ :schema swagger/transform {:type :schema})
|
||||
|
|
|
|||
|
|
@ -60,7 +60,9 @@
|
|||
(into
|
||||
(empty responses)
|
||||
(for [[k response] responses]
|
||||
[k (set/rename-keys response {:body :schema})]))})))
|
||||
[k (-> response
|
||||
(dissoc :content)
|
||||
(set/rename-keys {:body :schema}))]))})))
|
||||
:openapi (merge
|
||||
(when (seq (dissoc parameters :body :request :multipart))
|
||||
(openapi/openapi-spec {::openapi/parameters (dissoc parameters :body :request)}))
|
||||
|
|
|
|||
|
|
@ -101,6 +101,7 @@
|
|||
(empty responses)
|
||||
(for [[k response] responses]
|
||||
[k (as-> response $
|
||||
(dissoc $ :content)
|
||||
(set/rename-keys $ {:body :schema}))]))})))
|
||||
:openapi (merge
|
||||
(when (seq (dissoc parameters :body :request :multipart))
|
||||
|
|
|
|||
Loading…
Reference in a new issue