Skip to content

Commit 1957aab

Browse files
committed
Teach swagger-routes to heed basePath for swagger-docs path
If {:data {:basePath "/app"}} is given, default to including it as a prefix to swagger-ui :swagger-docs path. The basePath is already passed to swagger-docs, so this makes the swagger-ui consistent with the generated json. The swagger-docs path can also now be completely overridden via: {:options {:ui {:swagger-docs "/override.json"}}}
1 parent 96105d8 commit 1957aab

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/compojure/api/swagger.clj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@
109109
(if options
110110
(let [{:keys [ui spec data] {ui-options :ui spec-options :spec} :options} (merge swagger-defaults options)]
111111
(c/routes
112-
(if ui (apply swagger-ui ui (mapcat identity (merge ui-options (if spec {:swagger-docs spec})))))
112+
(if ui (apply swagger-ui ui (mapcat identity (merge (if spec {:swagger-docs (apply str (remove clojure.string/blank? [(:basePath data) spec]))}) ui-options))))
113113
(if spec (apply swagger-docs spec (mapcat identity data))))))))
114114

115115
(defn validate

0 commit comments

Comments
 (0)