Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reitit Examples has a bug with Swagger #634

Closed
jasonjckn opened this issue Aug 18, 2023 · 4 comments · Fixed by #637
Closed

Reitit Examples has a bug with Swagger #634

jasonjckn opened this issue Aug 18, 2023 · 4 comments · Fixed by #637

Comments

@jasonjckn
Copy link

image

Steps to reproduce

  1. cd reitit/examples/ring-malli-swagger
  2. lein run -m example.server/start
  3. http://localhost:3000/index.html
  4. "Select a definition" and "Swagger" top right corner
  5. Server Error swagger.json

The source code does in fact define swagger.json endpoint.

@tomjkidd
Copy link

tomjkidd commented Aug 20, 2023

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))})}}]

@opqdonut
Copy link
Member

Thanks for noticing that! We forgot to update the example while working on #627

@opqdonut
Copy link
Member

#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.

@opqdonut
Copy link
Member

see also #639

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants