mirror of
https://github.com/metosin/reitit.git
synced 2025-12-17 00:11:11 +00:00
Merge pull request #637 from metosin/fix-openapi-example
don't crash swagger generation on :content, fix examples
This commit is contained in:
commit
76a08a2322
6 changed files with 9 additions and 3 deletions
|
|
@ -77,7 +77,7 @@
|
|||
{:get {:summary "downloads a file"
|
||||
:swagger {:produces ["image/png"]}
|
||||
:responses {200 {:description "an image"
|
||||
:content {"image/png" any?}}}
|
||||
:content {"image/png" {:schema any?}}}}
|
||||
:handler (fn [_]
|
||||
{:status 200
|
||||
:headers {"Content-Type" "image/png"}
|
||||
|
|
|
|||
|
|
@ -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"}
|
||||
|
|
|
|||
|
|
@ -67,6 +67,8 @@
|
|||
["/download"
|
||||
{:get {:summary "downloads a file"
|
||||
:swagger {:produces ["image/png"]}
|
||||
:responses {200 {:description "an image"
|
||||
:content {"image/png" {:schema string?}}}}
|
||||
:handler (fn [_]
|
||||
{:status 200
|
||||
:headers {"Content-Type" "image/png"}
|
||||
|
|
|
|||
|
|
@ -170,6 +170,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})
|
||||
|
|
|
|||
|
|
@ -67,7 +67,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 handled in reitit.openapi/-get-apidocs-openapi
|
||||
(throw
|
||||
(ex-info
|
||||
|
|
|
|||
|
|
@ -108,6 +108,7 @@
|
|||
(empty responses)
|
||||
(for [[k response] responses]
|
||||
[k (as-> response $
|
||||
(dissoc $ :content)
|
||||
(set/rename-keys $ {:body :schema}))]))})))
|
||||
;; :openapi handled in reitit.openapi/-get-apidocs-openapi
|
||||
(throw
|
||||
|
|
|
|||
Loading…
Reference in a new issue