Skip to content

Commit

Permalink
best-effort to retain route order with swagger
Browse files Browse the repository at this point in the history
  • Loading branch information
ikitommi committed Feb 28, 2019
1 parent 684f5bb commit 5713afa
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion modules/reitit-swagger/src/reitit/swagger.cljc
Expand Up @@ -98,7 +98,8 @@
transform-path (fn [[p _ c]]
(if-let [endpoint (some->> c (keep transform-endpoint) (seq) (into {}))]
[(swagger-path p) endpoint]))]
(let [paths (->> router (r/compiled-routes) (filter accept-route) (map transform-path) (into {}))]
(let [map-in-order #(->> % (apply concat) (apply array-map))
paths (->> router (r/compiled-routes) (filter accept-route) (map transform-path) map-in-order)]
{:status 200
:body (meta-merge swagger {:paths paths})})))
([req res raise]
Expand Down

0 comments on commit 5713afa

Please sign in to comment.