From f7e688b6eb1ddeac8e9c164a24e2f987aa44251a Mon Sep 17 00:00:00 2001
From: bryan <bryan.maass@gmail.com>
Date: Tue, 30 Jan 2024 09:44:52 -0500
Subject: [PATCH] Remove useless warnings from defendpoint missing a malli
 schema (#38157)

* Remove useless warnings from defendpoint missing a malli schema

we knowingly call umd/describe on a possibly-nil value (`nil` is not a
malli schema). That's ok in this instance, so don't warn about it.

* Actually use the output of umd/describe
---
 src/metabase/api/common/internal.clj | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/metabase/api/common/internal.clj b/src/metabase/api/common/internal.clj
index 5be9011a93e..37d4dec049b 100644
--- a/src/metabase/api/common/internal.clj
+++ b/src/metabase/api/common/internal.clj
@@ -78,7 +78,10 @@
 (defn- dox-for-schema
   "Generate the docstring for `schema` for use in auto-generated API documentation."
   [schema route-str]
-  (try (umd/describe schema)
+  (try
+    ;; we can ignore the warning printed by umd/describe when schema is `nil`.
+    (binding [*out* (new java.io.StringWriter)]
+      (umd/describe schema))
        (catch Exception _
          (ex-data
           (when (and schema config/is-dev?) ;; schema is nil for any var without a schema. That's ok!
-- 
GitLab