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 @@ ...@@ -126,10 +126,11 @@
(defn- compojure-renames (defn- compojure-renames
"Find out everything that's renamed in Compojure routes" "Find out everything that's renamed in Compojure routes"
[args] [args]
(let [idx (inc (.indexOf ^PersistentVector args :as))] (let [idx (inc (.indexOf ^PersistentVector args :as))
(when (pos? idx) req-bindings (get args idx)]
(let [req-bindings (get args idx) (when (and (pos? idx)
renames (->> (keys req-bindings) ; {{c :count} :query-params} ; => [{c :count}] (map? req-bindings))
(let [renames (->> (keys req-bindings) ; {{c :count} :query-params} ; => [{c :count}]
(filter map?) ; no stuff like {:keys [a]} (filter map?) ; no stuff like {:keys [a]}
(apply merge))] (apply merge))]
(update-keys renames keyword))))) (update-keys renames keyword)))))
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
[malli.json-schema :as mjs] [malli.json-schema :as mjs]
[metabase.api.common :as api] [metabase.api.common :as api]
[metabase.api.common.openapi :as openapi] [metabase.api.common.openapi :as openapi]
[metabase.api.routes :as routes]
[metabase.util.malli.schema :as ms])) [metabase.util.malli.schema :as ms]))
;;; inner helpers ;;; inner helpers
...@@ -136,3 +137,6 @@ ...@@ -136,3 +137,6 @@
{:allOf [{:type "string", :minLength 1} {:allOf [{:type "string", :minLength 1}
{}]}}}} {}]}}}}
(openapi/openapi-object #'routes)))) (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