metosin / reitit

A fast data-driven routing library for Clojure/Script

Home Page:https://cljdoc.org/d/metosin/reitit/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Downgrading to Swagger UI v2 breaks configuration

SVMBrown opened this issue · comments

Despite specifying a :url of /api/swagger.json, Swagger UI uses a default value of http://localhost:3000/api/docs.
It appears that Swagger UI v2 is not loading its config from /api/swagger-ui/config.json properly.

I am able to fix this by rolling back to reitit 0.5.10, and upon looking at the diff, it seems that the breaking change is the removal of conf.js in commit bf3242a

I am not sure if it is a mistake on my end preventing this from working, or if it is an issue with how Swagger UI v2 resolves configuration.

For reference, my routes look like the following:

["/api"
 ["" {:no-doc true}
  ["/swagger.json {:get (swagger/create-swagger-handler)]
  ["/swagger-ui*" {:get (swagger/create-swagger-ui-handler {:url "/api/swagger.json"})}]]
 ;; API Endpoints here
]

and my relevant deps are:

[reitit "0.5.12"]
[metosin/ring-swagger-ui "2.2.10"]

It breaks on 0.5.12 and 0.5.11, but works on 0.5.10.

Seems like an accidental breaking change in PR #446, which probably was tested only with Swagger UI v3.