Skip to content

The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:

Add custom Kondo linter for defendpoint query parameter naming (#65114)

Cam Saul527b8e8e9ad6
diff --git a/.clj-kondo/config.edn b/.clj-kondo/config.edn
index 4e3703d5185..3b2f02bdbcd 100644
--- a/.clj-kondo/config.edn
+++ b/.clj-kondo/config.edn
@@ -56,21 +56,22 @@
;;
;; globally-enabled custom linters
;;
- :metabase/check-defmulti-arglists {:level :warning}
- :metabase/check-me-humanize {:level :warning}
- :metabase/defsetting-must-specify-export {:level :warning}
- :metabase/defsetting-namespace {:level :warning}
- :metabase/discourage-millis-duration {:level :warning}
- :metabase/mbql-query-first-arg {:level :warning}
- :metabase/missing-test-expr-requires-in-cljs {:level :warning}
- :metabase/modules {:level :warning} ; more config in `.clj-kondo/config/modules/config.edn`
- :metabase/namespace-name {:level :warning}
- :metabase/require-shape-checker {:level :warning}
- :metabase/test-helpers-use-non-thread-safe-functions {:level :warning} ; more config in `.clj-kondo/config/test-helpers/config.edn`
- :metabase/validate-defendpoint-route-uses-kebab-case {:level :warning}
- :metabase/validate-logging {:level :warning}
- :metabase/validate-mb-driver-tests {:level :warning}
- :metabase/validate-mb-once {:level :warning}
+ :metabase/check-defmulti-arglists {:level :warning}
+ :metabase/check-me-humanize {:level :warning}
+ :metabase/defsetting-must-specify-export {:level :warning}
+ :metabase/defsetting-namespace {:level :warning}
+ :metabase/discourage-millis-duration {:level :warning}
+ :metabase/mbql-query-first-arg {:level :warning}
+ :metabase/missing-test-expr-requires-in-cljs {:level :warning}
+ :metabase/modules {:level :warning} ; more config in `.clj-kondo/config/modules/config.edn`
+ :metabase/namespace-name {:level :warning}
+ :metabase/require-shape-checker {:level :warning}
+ :metabase/test-helpers-use-non-thread-safe-functions {:level :warning} ; more config in `.clj-kondo/config/test-helpers/config.edn`
+ :metabase/validate-defendpoint-route-uses-kebab-case {:level :warning}
+ :metabase/validate-defendpoint-query-params-use-kebab-case {:level :warning}
+ :metabase/validate-logging {:level :warning}
+ :metabase/validate-mb-driver-tests {:level :warning}
+ :metabase/validate-mb-once {:level :warning}
:metabase/validate-deftest
{:level :warning
diff --git a/.clj-kondo/src/hooks/metabase/api/macros.clj b/.clj-kondo/src/hooks/metabase/api/macros.clj
index d7c76af9199..69334858e2d 100644
--- a/.clj-kondo/src/hooks/metabase/api/macros.clj
+++ b/.clj-kondo/src/hooks/metabase/api/macros.clj
@@ -1,10 +1,11 @@
(ns hooks.metabase.api.macros
(:require
[clj-kondo.hooks-api :as api]
- [clojure.string :as str]
- [hooks.common]))
+ [clojure.string :as str]))
-(defn- validate-route! [route]
+(defn- validate-route!
+ "Make sure the route uses kebab-case rather than snake_case."
+ [route]
(letfn [(validate-route-string! [route-string]
(when (and (api/string-node? route-string)
(str/includes? (api/sexpr route-string) "_"))
@@ -14,10 +15,54 @@
(cond
(api/string-node? route)
(validate-route-string! route)
- ;; otherwise route is a vector like ["/abc/:d/ :d <regex>]
+ ;; otherwise route is a vector like ["/abc/:d/" :d <regex>]
(api/vector-node? route)
(validate-route-string! (first (:children route))))))
+(defn- validate-query-params!
+ "Make sure query params use kebab-case rather than snake_case.
+
+ This only works on inline schemas for now. If you define the schema elsewhere then we'd have to implement this
+ validation in Clojure-land since we can't resolve the schemas in Kondo. It should however still work on complicated
+ schemas like
+
+ [:merge <map-1> <map-2>]"
+ [query-param-schema-node]
+ (letfn [(map-schema? [node]
+ (and (api/vector-node? node)
+ (when-let [first-child (first (:children node))]
+ (and (api/keyword-node? first-child)
+ (= (api/sexpr first-child) :map)))))
+ (map-schema-keys [{:keys [children], :as _node}]
+ (let [child-schemas (if (api/map-node? (second children))
+ (drop 2 children)
+ (drop 1 children))]
+ (keep (fn [child-schema]
+ (when (api/vector-node? child-schema)
+ (when-let [k (first (:children child-schema))]
+ (when (api/keyword-node? k)
+ k))))
+ child-schemas)))
+ (validate-map-schema! [form]
+ ;; only warn once per endpoint -- just once on the first bad node
+ (when-let [bad-node (some (fn [key-node]
+ (when (str/includes? (str (api/sexpr key-node)) "_")
+ key-node))
+ (map-schema-keys form))]
+ (api/reg-finding! (assoc (meta bad-node)
+ :message "REST API routes and query params should use kebab-case, not snake_case"
+ :type :metabase/validate-defendpoint-query-params-use-kebab-case))))
+ (validate! [node]
+ (cond
+ (and (api/vector-node? node)
+ (map-schema? node))
+ (validate-map-schema! node)
+
+ (api/vector-node? node)
+ (doseq [child (:children node)]
+ (validate! child))))]
+ (validate! query-param-schema-node)))
+
(defn defendpoint
[arg]
(letfn [(update-defendpoint [node]
@@ -33,17 +78,21 @@
(cons nil more))
[params & body] more
[bindings schemas] (when (api/vector-node? params)
- (loop [bindings [], schemas [], [x y & more] (:children params)]
+ (loop [bindings [], schemas [], [x y z & more] (:children params)]
(cond
(not x)
[bindings schemas]
- (= (api/sexpr x) :-)
- (recur bindings (conj schemas y) more)
+ (and (api/keyword-node? y)
+ (= (api/sexpr y) :-))
+ (recur (conj bindings x) (conj schemas z) more)
:else
- (recur (conj bindings x) schemas (cons y more)))))]
+ (recur (conj bindings x) (conj schemas nil) (list* y z more)))))]
(validate-route! route)
+ (let [[_route-param-schema query-param-schema _body-param-schema] schemas]
+ (when query-param-schema
+ (validate-query-params! query-param-schema)))
(-> (api/list-node
(list
(api/token-node 'do)
@@ -79,10 +128,13 @@
api/sexpr))
(defn x []
- (-defendpoint '(api.macros/defendpoint :get "/:id/syncable_schemas"
+ (-defendpoint '(api.macros/defendpoint :get "/:id/syncable_schemas" ; snake_case route should trigger a warning
"Returns a list of all syncable schemas found for the database `id`."
[{:keys [id]} :- [:map
- [:id ms/PositiveInt]]]
+ [:id ms/PositiveInt]]
+ ;; snake_case query parameter, should trigger a warning
+ {:keys [filter_by]} :- [:map
+ [:filter_by {:optional true} :string]]]
(let [db (get-database id)]
(api/check-403 (or (:is_attached_dwh db)
(and (mi/can-write? db)
diff --git a/.clj-kondo/test/hooks/metabase/api/macros_test.clj b/.clj-kondo/test/hooks/metabase/api/macros_test.clj
index 7bbc0cea5d9..5ce50b8cf3a 100644
--- a/.clj-kondo/test/hooks/metabase/api/macros_test.clj
+++ b/.clj-kondo/test/hooks/metabase/api/macros_test.clj
@@ -1,6 +1,7 @@
(ns hooks.metabase.api.macros-test
(:require
[clj-kondo.hooks-api :as api]
+ [clj-kondo.impl.utils]
[clojure.test :refer :all]
[hooks.metabase.api.macros]))
@@ -69,3 +70,41 @@
(respond :x)
(catch Throwable e
(raise e))))))))
+
+(defn- defendpoint [form]
+ (hooks.metabase.api.macros/defendpoint
+ {:node (-> form pr-str api/parse-string)}))
+
+(defn- defendpoint-warnings
+ [form]
+ (binding [clj-kondo.impl.utils/*ctx* {:config {:linters {:metabase/validate-defendpoint-route-uses-kebab-case {:level :warning}
+ :metabase/validate-defendpoint-query-params-use-kebab-case {:level :warning}}}
+ :ignores (atom nil)
+ :findings (atom [])
+ :namespaces (atom {})}]
+ (defendpoint form)
+ @(:findings clj-kondo.impl.utils/*ctx*)))
+
+(deftest ^:parallel validate-route-kebab-case-test
+ (is (=? [{:message "REST API routes and query params should use kebab-case, not snake_case"
+ :type :metabase/validate-defendpoint-route-uses-kebab-case
+ :row pos-int?
+ :col pos-int?}]
+ (defendpoint-warnings
+ '(api.macros/defendpoint :get "/:id/syncable_schemas" ; snake_case route should trigger a warning
+ "Returns a list of all syncable schemas found for the database `id`."
+ [{:keys [id]}]
+ id)))))
+
+(deftest ^:parallel validate-query-params-kebab-case-test
+ (is (=? [{:message "REST API routes and query params should use kebab-case, not snake_case",
+ :type :metabase/validate-defendpoint-query-params-use-kebab-case
+ :row pos-int?
+ :col pos-int?}]
+ (defendpoint-warnings
+ '(api.macros/defendpoint :get "/:id/syncable-schemas"
+ "Returns a list of all syncable schemas found for the database `id`."
+ [{:keys [id]}
+ {:keys [filter_by]} :- [:map
+ [:filter_by {:optional true} :string]]]
+ id)))))
diff --git a/enterprise/backend/src/metabase_enterprise/comments/api.clj b/enterprise/backend/src/metabase_enterprise/comments/api.clj
index f52b343ec69..db1c34a6f26 100644
--- a/enterprise/backend/src/metabase_enterprise/comments/api.clj
+++ b/enterprise/backend/src/metabase_enterprise/comments/api.clj
@@ -19,6 +19,7 @@
[metabase.util.malli.schema :as ms]
[toucan2.core :as t2]))
+;;; TODO (Cam 10/28/25) -- don't capitalize constants https://guide.clojure.style/#naming-constants
(def ^:private TYPE->MODEL
{"document" :model/Document})
@@ -87,6 +88,9 @@
(keep delete-comment))
comments)))
+;; TODO (Cam 10/28/25) -- fix this endpoint so it uses kebab-case for query parameters for consistency with the rest
+;; of the REST API
+#_{:clj-kondo/ignore [:metabase/validate-defendpoint-query-params-use-kebab-case]}
(api.macros/defendpoint :get "/"
"Get comments for an entity"
[_route-params
diff --git a/enterprise/backend/src/metabase_enterprise/database_routing/api.clj b/enterprise/backend/src/metabase_enterprise/database_routing/api.clj
index aa2623a2d6b..f69dbe0c0a9 100644
--- a/enterprise/backend/src/metabase_enterprise/database_routing/api.clj
+++ b/enterprise/backend/src/metabase_enterprise/database_routing/api.clj
@@ -11,6 +11,9 @@
[metabase.warehouses.api :as api.database]
[toucan2.core :as t2]))
+;; TODO (Cam 10/28/25) -- fix this endpoint so it uses kebab-case for query parameters for consistency with the rest
+;; of the REST API
+#_{:clj-kondo/ignore [:metabase/validate-defendpoint-query-params-use-kebab-case]}
(api.macros/defendpoint :post "/destination-database"
"Create new Destination Databases.
diff --git a/enterprise/backend/src/metabase_enterprise/impersonation/api.clj b/enterprise/backend/src/metabase_enterprise/impersonation/api.clj
index d9827615bef..478ada25c99 100644
--- a/enterprise/backend/src/metabase_enterprise/impersonation/api.clj
+++ b/enterprise/backend/src/metabase_enterprise/impersonation/api.clj
@@ -5,6 +5,9 @@
[metabase.util.malli.schema :as ms]
[toucan2.core :as t2]))
+;; TODO (Cam 10/28/25) -- fix this endpoint so it uses kebab-case for query parameters for consistency with the rest
+;; of the REST API
+#_{:clj-kondo/ignore [:metabase/validate-defendpoint-query-params-use-kebab-case]}
(api.macros/defendpoint :get "/"
"Fetch a list of all Impersonation policies currently in effect, or a single policy if both `group_id` and `db_id`
are provided."
diff --git a/enterprise/backend/src/metabase_enterprise/metabot_v3/api/metabot.clj b/enterprise/backend/src/metabase_enterprise/metabot_v3/api/metabot.clj
index 3d4c9c85935..fd2a31fd43b 100644
--- a/enterprise/backend/src/metabase_enterprise/metabot_v3/api/metabot.clj
+++ b/enterprise/backend/src/metabase_enterprise/metabot_v3/api/metabot.clj
@@ -62,6 +62,9 @@
(metabot-v3.suggested-prompts/generate-sample-prompts id))
api/generic-204-no-content)
+;; TODO (Cam 10/28/25) -- fix this endpoint so it uses kebab-case for query parameters for consistency with the rest
+;; of the REST API
+#_{:clj-kondo/ignore [:metabase/validate-defendpoint-query-params-use-kebab-case]}
(api.macros/defendpoint :get "/:id/prompt-suggestions"
"Return the prompt suggestions for the metabot instance with `id`."
[{:keys [id]} :- [:map [:id pos-int?]]
diff --git a/enterprise/backend/src/metabase_enterprise/permission_debug/api.clj b/enterprise/backend/src/metabase_enterprise/permission_debug/api.clj
index 87fda32666d..0c8eaf4cf2a 100644
--- a/enterprise/backend/src/metabase_enterprise/permission_debug/api.clj
+++ b/enterprise/backend/src/metabase_enterprise/permission_debug/api.clj
@@ -6,6 +6,9 @@
[metabase.api.macros :as api.macros]
[metabase.api.routes.common :refer [+auth]]))
+;; TODO (Cam 10/28/25) -- fix this endpoint so it uses kebab-case for query parameters for consistency with the rest
+;; of the REST API
+#_{:clj-kondo/ignore [:metabase/validate-defendpoint-query-params-use-kebab-case]}
(api.macros/defendpoint :get "/" :- permission-debug.impl/DebuggerSchema
"This endpoint expects a `user_id`, a `model_id` to debug permissions against, and `action_type`.
The type of model we are debugging against is inferred by the `action_type`.
diff --git a/enterprise/backend/src/metabase_enterprise/sandbox/api/gtap.clj b/enterprise/backend/src/metabase_enterprise/sandbox/api/gtap.clj
index 2680c8c0eb7..ff4b664c37c 100644
--- a/enterprise/backend/src/metabase_enterprise/sandbox/api/gtap.clj
+++ b/enterprise/backend/src/metabase_enterprise/sandbox/api/gtap.clj
@@ -12,6 +12,9 @@
[metabase.util.malli.schema :as ms]
[toucan2.core :as t2]))
+;; TODO (Cam 10/28/25) -- fix this endpoint so it uses kebab-case for query parameters for consistency with the rest
+;; of the REST API
+#_{:clj-kondo/ignore [:metabase/validate-defendpoint-query-params-use-kebab-case]}
(api.macros/defendpoint :get "/"
"Fetch a list of all GTAPs currently in use, or a single GTAP if both `group_id` and `table_id` are provided."
[_route-params
diff --git a/enterprise/backend/src/metabase_enterprise/sandbox/api/table.clj b/enterprise/backend/src/metabase_enterprise/sandbox/api/table.clj
index f5daa1ebf73..4aaf8558d5a 100644
--- a/enterprise/backend/src/metabase_enterprise/sandbox/api/table.clj
+++ b/enterprise/backend/src/metabase_enterprise/sandbox/api/table.clj
@@ -87,7 +87,11 @@
table)))
;; TODO (Cam 10/28/25) -- fix this endpoint route to use kebab-case for consistency with the rest of our REST API
-#_{:clj-kondo/ignore [:metabase/validate-defendpoint-route-uses-kebab-case]}
+;;
+;; TODO (Cam 10/28/25) -- fix this endpoint so it uses kebab-case for query parameters for consistency with the rest
+;; of the REST API
+#_{:clj-kondo/ignore [:metabase/validate-defendpoint-route-uses-kebab-case
+ :metabase/validate-defendpoint-query-params-use-kebab-case]}
(api.macros/defendpoint :get "/:id/query_metadata"
"This endpoint essentially acts as a wrapper for the OSS version of this route. When a user has sandboxed permissions
that only gives them access to a subset of columns for a given table, those inaccessable columns should also be
diff --git a/enterprise/backend/src/metabase_enterprise/serialization/api.clj b/enterprise/backend/src/metabase_enterprise/serialization/api.clj
index d1ec6033ddd..916b758df1c 100644
--- a/enterprise/backend/src/metabase_enterprise/serialization/api.clj
+++ b/enterprise/backend/src/metabase_enterprise/serialization/api.clj
@@ -154,6 +154,9 @@
;;; HTTP API
+;; TODO (Cam 10/28/25) -- fix this endpoint so it uses kebab-case for query parameters for consistency with the rest
+;; of the REST API
+#_{:clj-kondo/ignore [:metabase/validate-defendpoint-query-params-use-kebab-case]}
(api.macros/defendpoint :post "/export"
"Serialize and retrieve Metabase instance.
@@ -232,6 +235,9 @@
:headers {"Content-Type" "text/plain"}
:body (on-response! log-file callback)})))
+;; TODO (Cam 10/28/25) -- fix this endpoint so it uses kebab-case for query parameters for consistency with the rest
+;; of the REST API
+#_{:clj-kondo/ignore [:metabase/validate-defendpoint-query-params-use-kebab-case]}
(api.macros/defendpoint :post "/import"
"Deserialize Metabase instance from an archive generated by /export.
diff --git a/enterprise/backend/src/metabase_enterprise/stale/api.clj b/enterprise/backend/src/metabase_enterprise/stale/api.clj
index 0d66fb207ba..f60d6a72352 100644
--- a/enterprise/backend/src/metabase_enterprise/stale/api.clj
+++ b/enterprise/backend/src/metabase_enterprise/stale/api.clj
@@ -119,6 +119,9 @@
annotate-dashboard-with-collection-info
present-collections))
+;; TODO (Cam 10/28/25) -- fix this endpoint so it uses kebab-case for query parameters for consistency with the rest
+;; of the REST API
+#_{:clj-kondo/ignore [:metabase/validate-defendpoint-query-params-use-kebab-case]}
(api.macros/defendpoint :get ["/:id" :id #"(?:\d+)|(?:root)"]
"A flexible endpoint that returns stale entities, in the same shape as collections/items, with the following options:
- `before_date` - only return entities that were last edited before this date (default: 6 months ago)
diff --git a/enterprise/backend/src/metabase_enterprise/transforms/api.clj b/enterprise/backend/src/metabase_enterprise/transforms/api.clj
index b02dfa12275..56ef899f7e6 100644
--- a/enterprise/backend/src/metabase_enterprise/transforms/api.clj
+++ b/enterprise/backend/src/metabase_enterprise/transforms/api.clj
@@ -97,6 +97,9 @@
(map #(update % :last_run transforms.util/localize-run-timestamps)))
(t2/hydrate transforms :last_run :transform_tag_ids))))
+;; TODO (Cam 10/28/25) -- fix this endpoint so it uses kebab-case for query parameters for consistency with the rest
+;; of the REST API
+#_{:clj-kondo/ignore [:metabase/validate-defendpoint-query-params-use-kebab-case]}
(api.macros/defendpoint :get "/"
"Get a list of transforms."
[_route-params
@@ -164,6 +167,9 @@
dep-ids (get global-ordering id)]
(map id->transform dep-ids)))
+;; TODO (Cam 10/28/25) -- fix this endpoint so it uses kebab-case for query parameters for consistency with the rest
+;; of the REST API
+#_{:clj-kondo/ignore [:metabase/validate-defendpoint-query-params-use-kebab-case]}
(api.macros/defendpoint :get "/run"
"Get transform runs based on a set of filter params."
[_route-params
diff --git a/enterprise/backend/src/metabase_enterprise/transforms/api/transform_job.clj b/enterprise/backend/src/metabase_enterprise/transforms/api/transform_job.clj
index c90ea76c25a..4f97eac77cc 100644
--- a/enterprise/backend/src/metabase_enterprise/transforms/api/transform_job.clj
+++ b/enterprise/backend/src/metabase_enterprise/transforms/api/transform_job.clj
@@ -150,6 +150,9 @@
(api/check-404 (t2/select-one-pk :model/TransformJob :id job-id))
(transforms.jobs/job-transforms job-id))
+;; TODO (Cam 10/28/25) -- fix this endpoint so it uses kebab-case for query parameters for consistency with the rest
+;; of the REST API
+#_{:clj-kondo/ignore [:metabase/validate-defendpoint-query-params-use-kebab-case]}
(api.macros/defendpoint :get "/"
"Get all transform jobs."
[_route-params
diff --git a/src/metabase/activity_feed/api.clj b/src/metabase/activity_feed/api.clj
index fb8861316e2..e5e2c38ad44 100644
--- a/src/metabase/activity_feed/api.clj
+++ b/src/metabase/activity_feed/api.clj
@@ -119,6 +119,9 @@
[]
{:recent_views (:recents (recent-views/get-recents *current-user-id* [:views]))})
+;; TODO (Cam 10/28/25) -- fix this endpoint so it uses kebab-case for query parameters for consistency with the rest
+;; of the REST API
+#_{:clj-kondo/ignore [:metabase/validate-defendpoint-query-params-use-kebab-case]}
(api.macros/defendpoint :get "/recents"
"Get a list of recent items the current user has been viewing most recently under the `:recents` key.
Allows for filtering by context: views or selections"
diff --git a/src/metabase/collections/api.clj b/src/metabase/collections/api.clj
index dec14235e9c..8643cf92148 100644
--- a/src/metabase/collections/api.clj
+++ b/src/metabase/collections/api.clj
@@ -1124,6 +1124,9 @@
#{:collection}
#{:no_models})))
+;; TODO (Cam 10/28/25) -- fix this endpoint so it uses kebab-case for query parameters for consistency with the rest
+;; of the REST API
+#_{:clj-kondo/ignore [:metabase/validate-defendpoint-query-params-use-kebab-case]}
(api.macros/defendpoint :get "/root/items"
"Fetch objects that the current user should see at their root level. As mentioned elsewhere, the 'Root' Collection
doesn't actually exist as a row in the application DB: it's simply a virtual Collection where things with no
@@ -1444,6 +1447,9 @@
;; Now we can safely delete this collection and anything left under it.
(t2/delete! :model/Collection :id id))))
+;; TODO (Cam 10/28/25) -- fix this endpoint so it uses kebab-case for query parameters for consistency with the rest
+;; of the REST API
+#_{:clj-kondo/ignore [:metabase/validate-defendpoint-query-params-use-kebab-case]}
(api.macros/defendpoint :get "/:id/items"
"Fetch a specific Collection's items with the following options:
diff --git a/src/metabase/embedding/api/embed.clj b/src/metabase/embedding/api/embed.clj
index 6a6a1c987ff..a97ac2af397 100644
--- a/src/metabase/embedding/api/embed.clj
+++ b/src/metabase/embedding/api/embed.clj
@@ -108,6 +108,9 @@
query-params :- :map]
(run-query-for-unsigned-token-async (unsign-and-translate-ids token) :api (api.embed.common/parse-query-params query-params)))
+;; TODO (Cam 10/28/25) -- fix this endpoint so it uses kebab-case for query parameters for consistency with the rest
+;; of the REST API
+#_{:clj-kondo/ignore [:metabase/validate-defendpoint-query-params-use-kebab-case]}
(api.macros/defendpoint :get ["/card/:token/query/:export-format", :export-format qp.schema/export-formats-regex]
"Like `GET /api/embed/card/query`, but returns the results as a file in the specified format."
[{:keys [token export-format]} :- [:map
@@ -191,6 +194,9 @@
;;; --------------------------------------------------- Remappings ---------------------------------------------------
+;; TODO (Cam 10/28/25) -- fix this endpoint so it uses kebab-case for query parameters for consistency with the rest
+;; of the REST API
+#_{:clj-kondo/ignore [:metabase/validate-defendpoint-query-params-use-kebab-case]}
(api.macros/defendpoint :get ["/dashboard/:token/dashcard/:dashcard-id/card/:card-id/:export-format"
:export-format qp.schema/export-formats-regex]
"Fetch the results of running a Card belonging to a Dashboard using a JSON Web Token signed with the
diff --git a/src/metabase/indexed_entities/api.clj b/src/metabase/indexed_entities/api.clj
index ea4947be06e..e2cc4786378 100644
--- a/src/metabase/indexed_entities/api.clj
+++ b/src/metabase/indexed_entities/api.clj
@@ -61,6 +61,9 @@
(model-index/add-values! model-index)
(t2/select-one :model/ModelIndex :id (:id model-index)))))
+;; TODO (Cam 10/28/25) -- fix this endpoint so it uses kebab-case for query parameters for consistency with the rest
+;; of the REST API
+#_{:clj-kondo/ignore [:metabase/validate-defendpoint-query-params-use-kebab-case]}
(api.macros/defendpoint :get "/"
"Retrieve list of ModelIndex."
[_route-params
diff --git a/src/metabase/notification/api/notification.clj b/src/metabase/notification/api/notification.clj
index dad9a923314..86cb32d3a16 100644
--- a/src/metabase/notification/api/notification.clj
+++ b/src/metabase/notification/api/notification.clj
@@ -85,6 +85,9 @@
(filter mi/can-read?)))
models.notification/hydrate-notification))
+;; TODO (Cam 10/28/25) -- fix this endpoint so it uses kebab-case for query parameters for consistency with the rest
+;; of the REST API
+#_{:clj-kondo/ignore [:metabase/validate-defendpoint-query-params-use-kebab-case]}
(api.macros/defendpoint :get "/"
"List notifications.
- `creator_id`: if provided returns only notifications created by this user
diff --git a/src/metabase/public_sharing/api.clj b/src/metabase/public_sharing/api.clj
index 2ad23cdef08..c5c8cfe99f8 100644
--- a/src/metabase/public_sharing/api.clj
+++ b/src/metabase/public_sharing/api.clj
@@ -176,6 +176,9 @@
[:parameters {:optional true} [:maybe ms/JSONString]]]]
(process-query-for-card-with-public-uuid uuid :api (json/decode+kw parameters)))
+;; TODO (Cam 10/28/25) -- fix this endpoint so it uses kebab-case for query parameters for consistency with the rest
+;; of the REST API
+#_{:clj-kondo/ignore [:metabase/validate-defendpoint-query-params-use-kebab-case]}
(api.macros/defendpoint :get "/card/:uuid/query/:export-format"
"Fetch a publicly-accessible Card and return query results in the specified format. Does not require auth
credentials. Public sharing must be enabled."
diff --git a/src/metabase/pulse/api/alert.clj b/src/metabase/pulse/api/alert.clj
index a03ca4bf301..efd83c7b539 100644
--- a/src/metabase/pulse/api/alert.clj
+++ b/src/metabase/pulse/api/alert.clj
@@ -75,6 +75,9 @@
{})})))
(:handlers notification))})))
+;; TODO (Cam 10/28/25) -- fix this endpoint so it uses kebab-case for query parameters for consistency with the rest
+;; of the REST API
+#_{:clj-kondo/ignore [:metabase/validate-defendpoint-query-params-use-kebab-case]}
(api.macros/defendpoint :get "/"
"Fetch alerts which the current user has created or will receive, or all alerts if the user is an admin.
The optional `user_id` will return alerts created by the corresponding user, but is ignored for non-admin users."
diff --git a/src/metabase/pulse/api/pulse.clj b/src/metabase/pulse/api/pulse.clj
index 9655a63fb8f..5e530313047 100644
--- a/src/metabase/pulse/api/pulse.clj
+++ b/src/metabase/pulse/api/pulse.clj
@@ -75,6 +75,9 @@
(fn [channels]
(map #(dissoc % :recipients) channels))))))
+;; TODO (Cam 10/28/25) -- fix this endpoint so it uses kebab-case for query parameters for consistency with the rest
+;; of the REST API
+#_{:clj-kondo/ignore [:metabase/validate-defendpoint-query-params-use-kebab-case]}
(api.macros/defendpoint :get "/"
"Fetch all dashboard subscriptions. By default, returns only subscriptions for which the current user has write
permissions. For admins, this is all subscriptions; for non-admins, it is only subscriptions that they created.
diff --git a/src/metabase/queries/api/card.clj b/src/metabase/queries/api/card.clj
index 36333c0ab56..bfcb8af5ad1 100644
--- a/src/metabase/queries/api/card.clj
+++ b/src/metabase/queries/api/card.clj
@@ -152,6 +152,9 @@
:join [[model :m] [:= :t.id :m.table_id]]
:where [:= :m.id model-id]}))
+;; TODO (Cam 10/28/25) -- fix this endpoint so it uses kebab-case for query parameters for consistency with the rest
+;; of the REST API
+#_{:clj-kondo/ignore [:metabase/validate-defendpoint-query-params-use-kebab-case]}
(api.macros/defendpoint :get "/"
"Get all the Cards. Option filter param `f` can be used to change the set of Cards that are returned; default is
`all`, but other options include `mine`, `bookmarked`, `database`, `table`, `using_model`, `using_segment`, and
@@ -415,6 +418,9 @@
new-cards)
new-cards))))
+;; TODO (Cam 10/28/25) -- fix this endpoint so it uses kebab-case for query parameters for consistency with the rest
+;; of the REST API
+#_{:clj-kondo/ignore [:metabase/validate-defendpoint-query-params-use-kebab-case]}
(api.macros/defendpoint :get "/:id/series"
"Fetches a list of compatible series with the card with id `card_id`.
@@ -679,6 +685,9 @@
(card.metadata/save-metadata-async! metadata-future card))
card))))
+;; TODO (Cam 10/28/25) -- fix this endpoint so it uses kebab-case for query parameters for consistency with the rest
+;; of the REST API
+#_{:clj-kondo/ignore [:metabase/validate-defendpoint-query-params-use-kebab-case]}
(api.macros/defendpoint :put "/:id"
"Update a `Card`."
[{:keys [id]} :- [:map
diff --git a/src/metabase/search/api.clj b/src/metabase/search/api.clj
index bd3aa64ae18..39563ab8771 100644
--- a/src/metabase/search/api.clj
+++ b/src/metabase/search/api.clj
@@ -108,6 +108,9 @@
(search.settings/experimental-search-weight-overrides!
(merge-with merge (search.settings/experimental-search-weight-overrides) {context (update-keys overrides u/qualified-name)}))))
+;; TODO (Cam 10/28/25) -- fix this endpoint so it uses kebab-case for query parameters for consistency with the rest
+;; of the REST API
+#_{:clj-kondo/ignore [:metabase/validate-defendpoint-query-params-use-kebab-case]}
(api.macros/defendpoint :get "/weights"
"Return the current weights being used to rank the search results"
[_route-params
@@ -116,6 +119,9 @@
[:search_engine {:optional true} :any]]]
(search.config/weights context))
+;; TODO (Cam 10/28/25) -- fix this endpoint so it uses kebab-case for query parameters for consistency with the rest
+;; of the REST API
+#_{:clj-kondo/ignore [:metabase/validate-defendpoint-query-params-use-kebab-case]}
(api.macros/defendpoint :put "/weights"
"Update the current weights being used to rank the search results"
[_route-params
@@ -128,6 +134,9 @@
(set-weights! context overrides))
(search.config/weights context)))
+;; TODO (Cam 10/28/25) -- fix this endpoint so it uses kebab-case for query parameters for consistency with the rest
+;; of the REST API
+#_{:clj-kondo/ignore [:metabase/validate-defendpoint-query-params-use-kebab-case]}
(api.macros/defendpoint :get "/"
"Search for items in Metabase.
For the list of supported models, check [[metabase.search.config/all-models]].
@@ -148,7 +157,9 @@
- `non_temporal_dim_ids`: search for cards/metrics/datasets with this exact set of non temporal dimension field IDs (requires appdb engine)
- `has_temporal_dim`: set to true for cards/metrics/datasets with 1 or more temporal dimensions (requires appdb engine)
- Note that not all item types support all filters, and the results will include only models that support the provided filters. For example:
+ Note that not all item types support all filters, and the results will include only models that support the provided
+ filters. For example:
+
- The `created-by` filter supports dashboards, models, actions, and cards.
- The `verified` filter supports models and cards.
diff --git a/src/metabase/segments/api.clj b/src/metabase/segments/api.clj
index 7621858c81a..c81d0ec3398 100644
--- a/src/metabase/segments/api.clj
+++ b/src/metabase/segments/api.clj
@@ -90,6 +90,9 @@
[:show_in_getting_started {:optional true} [:maybe :boolean]]]]
(write-check-and-update-segment! id body))
+;; TODO (Cam 10/28/25) -- fix this endpoint so it uses kebab-case for query parameters for consistency with the rest
+;; of the REST API
+#_{:clj-kondo/ignore [:metabase/validate-defendpoint-query-params-use-kebab-case]}
(api.macros/defendpoint :delete "/:id"
"Archive a Segment. (DEPRECATED -- Just pass updated value of `:archived` to the `PUT` endpoint instead.)"
[{:keys [id]} :- [:map
diff --git a/src/metabase/users/api.clj b/src/metabase/users/api.clj
index 9e3b805b523..56c9ec4d052 100644
--- a/src/metabase/users/api.clj
+++ b/src/metabase/users/api.clj
@@ -169,21 +169,32 @@
[clauses]
(dissoc clauses :order-by :limit :offset))
+;; TODO (Cam 10/28/25) -- fix this endpoint so it uses kebab-case for query parameters for consistency with the rest
+;; of the REST API
+#_{:clj-kondo/ignore [:metabase/validate-defendpoint-query-params-use-kebab-case]}
(api.macros/defendpoint :get "/"
"Fetch a list of `Users` for admins or group managers.
- By default returns only active users for admins and only active users within groups that the group manager is managing for group managers.
+ By default returns only active users for admins and only active users within groups that the group manager is
+ managing for group managers.
- If `status` is `deactivated`, include deactivated users only.
+
- If `status` is `all`, include all users (active and inactive).
- - Also supports `include_deactivated`, which if true, is equivalent to `status=all`; If is false, is equivalent to `status=active`.
- `status` and `include_deactivated` requires superuser permissions.
- - `include_deactivated` is a legacy alias for `status` and will be removed in a future release, users are advised to use `status` for better support and flexibility.
+
+ - Also supports `include_deactivated`, which if true, is equivalent to `status=all`; If is false, is equivalent to
+ `status=active`. `status` and `include_deactivated` requires superuser permissions.
+
+ - `include_deactivated` is a legacy alias for `status` and will be removed in a future release, users are advised
+ to use `status` for better support and flexibility.
+
If both params are passed, `status` takes precedence.
For users with segmented permissions, return only themselves.
Takes `limit`, `offset` for pagination.
+
Takes `query` for filtering on first name, last name, email.
+
Also takes `group_id`, which filters on group id."
[_route-params
{:keys [status query group_id include_deactivated]}
diff --git a/src/metabase/warehouse_schema/api/field.clj b/src/metabase/warehouse_schema/api/field.clj
index 9015a82f1c5..e16533f4af7 100644
--- a/src/metabase/warehouse_schema/api/field.clj
+++ b/src/metabase/warehouse_schema/api/field.clj
@@ -38,6 +38,9 @@
"Schema for a valid `Field` visibility type."
(into [:enum] (map name field/visibility-types)))
+;; TODO (Cam 10/28/25) -- fix this endpoint so it uses kebab-case for query parameters for consistency with the rest
+;; of the REST API
+#_{:clj-kondo/ignore [:metabase/validate-defendpoint-query-params-use-kebab-case]}
(api.macros/defendpoint :get "/:id"
"Get `Field` with ID."
[{:keys [id]} :- [:map
diff --git a/src/metabase/warehouse_schema/api/table.clj b/src/metabase/warehouse_schema/api/table.clj
index fc2bf1cd98d..4fd1f66eb1a 100644
--- a/src/metabase/warehouse_schema/api/table.clj
+++ b/src/metabase/warehouse_schema/api/table.clj
@@ -60,6 +60,9 @@
(map schema.table/present-table))
tables)))
+;; TODO (Cam 10/28/25) -- fix this endpoint so it uses kebab-case for query parameters for consistency with the rest
+;; of the REST API
+#_{:clj-kondo/ignore [:metabase/validate-defendpoint-query-params-use-kebab-case]}
(api.macros/defendpoint :get "/:id"
"Get `Table` with ID."
[{:keys [id]} :- [:map
@@ -185,7 +188,11 @@
(update-tables! ids body))
;; TODO (Cam 10/28/25) -- fix this endpoint route to use kebab-case for consistency with the rest of our REST API
-#_{:clj-kondo/ignore [:metabase/validate-defendpoint-route-uses-kebab-case]}
+;;
+;; TODO (Cam 10/28/25) -- fix this endpoint so it uses kebab-case for query parameters for consistency with the rest
+;; of the REST API
+#_{:clj-kondo/ignore [:metabase/validate-defendpoint-route-uses-kebab-case
+ :metabase/validate-defendpoint-query-params-use-kebab-case]}
(api.macros/defendpoint :get "/:id/query_metadata"
"Get metadata about a `Table` useful for running queries.
Returns DB, fields, field FKs, and field values.
diff --git a/src/metabase/warehouses/api.clj b/src/metabase/warehouses/api.clj
index 885475a2a0d..71cd86fc2cc 100644
--- a/src/metabase/warehouses/api.clj
+++ b/src/metabase/warehouses/api.clj
@@ -288,6 +288,9 @@
;; Perms checks for uploadable DBs are handled by exclude-uneditable-details? (see below)
include-only-uploadable? (#(filter uploadable-db? %)))))
+;; TODO (Cam 10/28/25) -- fix this endpoint so it uses kebab-case for query parameters for consistency with the rest
+;; of the REST API
+#_{:clj-kondo/ignore [:metabase/validate-defendpoint-query-params-use-kebab-case]}
(api.macros/defendpoint :get "/"
"Fetch all `Databases`.
@@ -305,9 +308,9 @@
* `include_only_uploadable` will only include DBs into which Metabase can insert new data.
Independently of these flags, the implementation of [[metabase.models.interface/to-json]] for `:model/Database` in
- [[metabase.warehouses.models.database]] uses the implementation of [[metabase.models.interface/can-write?]] for `:model/Database`
- in [[metabase.warehouses.models.database]] to exclude the `details` field, if the requesting user lacks permission to change the
- database details."
+ [[metabase.warehouses.models.database]] uses the implementation of [[metabase.models.interface/can-write?]] for
+ `:model/Database` in [[metabase.warehouses.models.database]] to exclude the `details` field, if the requesting user
+ lacks permission to change the database details."
[_route-params
{:keys [include saved include_editable_data_model exclude_uneditable_details include_only_uploadable include_analytics
router_database_id]}
@@ -410,6 +413,9 @@
include-editable-data-model? check-db-data-model-perms
(mi/can-write? db) (assoc :can-manage true)))
+;; TODO (Cam 10/28/25) -- fix this endpoint so it uses kebab-case for query parameters for consistency with the rest
+;; of the REST API
+#_{:clj-kondo/ignore [:metabase/validate-defendpoint-query-params-use-kebab-case]}
(api.macros/defendpoint :get "/:id"
"Get a single Database with `id`. Optionally pass `?include=tables` or `?include=tables.fields` to include the Tables
belonging to this database, or the Tables and Fields, respectively. If the requestor has write permissions for the
@@ -550,6 +556,9 @@
(filter :active tables))
identity)))))
+;; TODO (Cam 10/28/25) -- fix this endpoint so it uses kebab-case for query parameters for consistency with the rest
+;; of the REST API
+#_{:clj-kondo/ignore [:metabase/validate-defendpoint-query-params-use-kebab-case]}
(api.macros/defendpoint :get "/:id/metadata"
"Get metadata about a `Database`, including all of its `Tables` and `Fields`. Returns DB, fields, and field values.
By default only non-hidden tables and fields are returned. Passing include_hidden=true includes them.
@@ -703,7 +712,11 @@
(log/warnf e "Error with autocomplete: %s" (ex-message e)))))
;; TODO (Cam 10/28/25) -- fix this endpoint route to use kebab-case for consistency with the rest of our REST API
-#_{:clj-kondo/ignore [:metabase/validate-defendpoint-route-uses-kebab-case]}
+;;
+;; TODO (Cam 10/28/25) -- fix this endpoint so it uses kebab-case for query parameters for consistency with the rest
+;; of the REST API
+#_{:clj-kondo/ignore [:metabase/validate-defendpoint-route-uses-kebab-case
+ :metabase/validate-defendpoint-query-params-use-kebab-case]}
(api.macros/defendpoint :get "/:id/card_autocomplete_suggestions"
"Return a list of `Card` autocomplete suggestions for a given `query` in a given `Database`.
@@ -1195,6 +1208,9 @@
distinct
sort)))
+;; TODO (Cam 10/28/25) -- fix this endpoint so it uses kebab-case for query parameters for consistency with the rest
+;; of the REST API
+#_{:clj-kondo/ignore [:metabase/validate-defendpoint-query-params-use-kebab-case]}
(api.macros/defendpoint :get "/:id/schemas"
"Returns a list of all the schemas with tables found for the database `id`. Excludes schemas with no tables."
[{:keys [id]} :- [:map
@@ -1254,6 +1270,9 @@
tables)
(filter mi/can-read? tables)))))
+;; TODO (Cam 10/28/25) -- fix this endpoint so it uses kebab-case for query parameters for consistency with the rest
+;; of the REST API
+#_{:clj-kondo/ignore [:metabase/validate-defendpoint-query-params-use-kebab-case]}
(api.macros/defendpoint :get "/:id/schema/:schema"
"Returns a list of Tables for the given Database `id` and `schema`"
[{:keys [id schema]} :- [:map
@@ -1267,6 +1286,9 @@
include_hidden
include_editable_data_model))))
+;; TODO (Cam 10/28/25) -- fix this endpoint so it uses kebab-case for query parameters for consistency with the rest
+;; of the REST API
+#_{:clj-kondo/ignore [:metabase/validate-defendpoint-query-params-use-kebab-case]}
(api.macros/defendpoint :get "/:id/schema/"
"Return a list of Tables for a Database whose `schema` is `nil` or an empty string."
[{:keys [id]} :- [:map