Skip to content
Snippets Groups Projects
Unverified Commit ea69066d authored by Alexander Solovyov's avatar Alexander Solovyov Committed by GitHub
Browse files

add a test to check that openapi definitions can be generated (#44586)

parent 839f1f77
No related branches found
No related tags found
No related merge requests found
......@@ -126,10 +126,11 @@
(defn- compojure-renames
"Find out everything that's renamed in Compojure routes"
[args]
(let [idx (inc (.indexOf ^PersistentVector args :as))]
(when (pos? idx)
(let [req-bindings (get args idx)
renames (->> (keys req-bindings) ; {{c :count} :query-params} ; => [{c :count}]
(let [idx (inc (.indexOf ^PersistentVector args :as))
req-bindings (get args idx)]
(when (and (pos? idx)
(map? req-bindings))
(let [renames (->> (keys req-bindings) ; {{c :count} :query-params} ; => [{c :count}]
(filter map?) ; no stuff like {:keys [a]}
(apply merge))]
(update-keys renames keyword)))))
......
......@@ -5,6 +5,7 @@
[malli.json-schema :as mjs]
[metabase.api.common :as api]
[metabase.api.common.openapi :as openapi]
[metabase.api.routes :as routes]
[metabase.util.malli.schema :as ms]))
;;; inner helpers
......@@ -136,3 +137,6 @@
{:allOf [{:type "string", :minLength 1}
{}]}}}}
(openapi/openapi-object #'routes))))
(deftest ^:parallel openapi-all-routes
(is (openapi/openapi-object #'routes/routes)))
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment