Reitit Examples has a bug with Swagger
jasonjckn opened this issue · comments
Steps to reproduce
- cd reitit/examples/ring-malli-swagger
- lein run -m example.server/start
- http://localhost:3000/index.html
- "Select a definition" and "Swagger" top right corner
- Server Error swagger.json
The source code does in fact define swagger.json endpoint.
I also ran into this issue, and commenting out this line makes it so that both the swagger and open api load.
Alternatively, if I define the /download
endpoint differently to separate the failing openapi :content
, that seems to work, too. Definitely interested in what the guidance is for if you want to support having both swagger and openapi versions.
["/download"
{:get {:summary "downloads a file"
:swagger {:produces ["image/png"]}
:responses {200 {:description "an image"}}
:openapi {:responses {200 {:content {"image/png" any?}}}}
:handler (fn [_]
{:status 200
:headers {"Content-Type" "image/png"}
:body (-> "reitit.png"
(io/resource)
(io/input-stream))})}}]
Thanks for noticing that! We forgot to update the example while working on #627
#637 will fix this, but the actual examples won't get fixed until we make a new release. The examples are based on released reitit versions so they won't see the fix from master
.
Our intention is to have swagger just ignore the unsupported per-content-type stuff. It was leaking through, which crashed the swagger generation.
see also #639