Skip to content

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

Default undeclared endpoint params to an empty map schema (#80575)

Alexander Polyankina408a8822c03
diff --git a/.clj-kondo/ratchets.edn b/.clj-kondo/ratchets.edn
index 301f12c82a7..ef82e6aeaa2 100644
--- a/.clj-kondo/ratchets.edn
+++ b/.clj-kondo/ratchets.edn
@@ -25,7 +25,7 @@
:metabase/prefer-with-dynamic-fn-redefs 28
:metabase/test-helpers-use-non-thread-safe-functions 17
:metabase/validate-defendpoint-has-response-schema 440
- :metabase/validate-defendpoint-query-params-use-kebab-case 47
+ :metabase/validate-defendpoint-query-params-use-kebab-case 50
:metabase/validate-defendpoint-route-uses-kebab-case 44
:metabase/validate-deftest 9
:missing-docstring 10
diff --git a/enterprise/backend/src/metabase_enterprise/content_translation/routes.clj b/enterprise/backend/src/metabase_enterprise/content_translation/routes.clj
index 487443eae0d..ac4958ff6b8 100644
--- a/enterprise/backend/src/metabase_enterprise/content_translation/routes.clj
+++ b/enterprise/backend/src/metabase_enterprise/content_translation/routes.clj
@@ -69,24 +69,20 @@
:max-file-count 1}}
[_route_params
_query-params
- _body
- {:keys [multipart-params], :as _request} :- [:map
- [:multipart-params
- [:map
- ["file"
- [:map
- [:filename :string]
- [:size :int]
- [:tempfile (ms/InstanceOfClass java.io.File)]]]]]]]
+ {{:keys [tempfile size]} :file} :- [:map
+ [:file
+ [:map
+ [:filename :string]
+ [:size :int]
+ [:tempfile (ms/InstanceOfClass java.io.File)]]]]]
(api/check-superuser)
- (let [file (get-in multipart-params ["file" :tempfile])]
- (when (> (get-in multipart-params ["file" :size]) max-content-translation-dictionary-size-bytes)
- (throw (ex-info (tru "The dictionary should be less than {0}MB." max-content-translation-dictionary-size-mib)
- {:status-code http-status-content-too-large})))
- (when-not (instance? java.io.File file)
- (throw (ex-info (tru "No file provided") {:status-code 400})))
- (dictionary/read-and-import-csv! file)
- {:success true}))
+ (when (> size max-content-translation-dictionary-size-bytes)
+ (throw (ex-info (tru "The dictionary should be less than {0}MB." max-content-translation-dictionary-size-mib)
+ {:status-code http-status-content-too-large})))
+ (when-not (instance? java.io.File tempfile)
+ (throw (ex-info (tru "No file provided") {:status-code 400})))
+ (dictionary/read-and-import-csv! tempfile)
+ {:success true})
;; TODO (Cam 2025-11-25) please add a response schema to this API endpoint, it makes it easier for our customers to
;; use our API + we will need it when we make auto-TypeScript-signature generation happen
@@ -96,7 +92,7 @@
"Fetch the content translation dictionary via a JSON Web Token signed with the `embedding-secret-key`."
[{:keys [token]} :- [:map
[:token ms/NonBlankString]]
- {:keys [locale]}]
+ {:keys [locale]} :- [:map [:locale {:optional true} [:maybe :string]]]]
;; this will error if bad
(embedding.jwt/unsign token)
(if locale
diff --git a/enterprise/backend/src/metabase_enterprise/custom_viz_plugin/api.clj b/enterprise/backend/src/metabase_enterprise/custom_viz_plugin/api.clj
index 88f9f8bfe26..d20186d83ad 100644
--- a/enterprise/backend/src/metabase_enterprise/custom_viz_plugin/api.clj
+++ b/enterprise/backend/src/metabase_enterprise/custom_viz_plugin/api.clj
@@ -47,16 +47,14 @@
;;; ------------------------------------------------ Schemas ------------------------------------------------
-(def ^:private BundleUploadRequest
- "The multipart request carrying a tar.gz bundle. `:size` is what [[check-upload!]] enforces the size limit with, so
- it has to be declared here for it to survive param decoding."
+(def ^:private BundleUploadParts
+ "The multipart parts carrying a tar.gz bundle. `:size` is what [[check-upload!]] enforces the size limit with, so it
+ has to be declared here for it to survive param decoding."
[:map
- [:multipart-params
- [:map
- ["file" [:map
- [:filename :string]
- [:size ms/IntGreaterThanOrEqualToZero]
- [:tempfile (ms/InstanceOfClass File)]]]]]])
+ [:file [:map
+ [:filename :string]
+ [:size ms/IntGreaterThanOrEqualToZero]
+ [:tempfile (ms/InstanceOfClass File)]]]])
(def ^:private CustomVizPluginResponse
[:map
@@ -141,8 +139,7 @@
:max-file-count 1}}
[_route-params
_query-params
- _body
- {{file "file"} :multipart-params, :as _request} :- BundleUploadRequest]
+ {:keys [file]} :- BundleUploadParts]
(api/check-superuser)
(let [tempfile (check-upload! file)]
(try
@@ -251,8 +248,7 @@
:max-file-count 1}}
[{:keys [id]} :- [:map [:id ms/PositiveInt]]
_query-params
- _body
- {{file "file"} :multipart-params, :as _request} :- BundleUploadRequest]
+ {:keys [file]} :- BundleUploadParts]
(let [existing (api/write-check (custom-viz-plugin/select-one-non-blob :id id))
tempfile (check-upload! file)]
(try
diff --git a/enterprise/backend/src/metabase_enterprise/scim/v2/api.clj b/enterprise/backend/src/metabase_enterprise/scim/v2/api.clj
index b407f9f2456..f26d5c21a60 100644
--- a/enterprise/backend/src/metabase_enterprise/scim/v2/api.clj
+++ b/enterprise/backend/src/metabase_enterprise/scim/v2/api.clj
@@ -289,7 +289,8 @@
#_{:clj-kondo/ignore [:metabase/validate-defendpoint-has-response-schema]}
(api.macros/defendpoint :put ["/Users/:id" :id #"[^/]+"]
"Update a user."
- [{:keys [id]}
+ [{:keys [id]} :- [:map
+ [:id ms/NonBlankString]]
_query-params
scim-user :- SCIMUser]
(with-prometheus-counters
@@ -509,7 +510,8 @@
#_{:clj-kondo/ignore [:metabase/validate-defendpoint-has-response-schema]}
(api.macros/defendpoint :put ["/Groups/:id" :id #"[^/]+"]
"Update a group."
- [{:keys [id]}
+ [{:keys [id]} :- [:map
+ [:id ms/NonBlankString]]
_query-params
scim-group :- SCIMGroup]
(with-prometheus-counters
diff --git a/enterprise/backend/src/metabase_enterprise/serialization/api.clj b/enterprise/backend/src/metabase_enterprise/serialization/api.clj
index e873bf02c63..32b64772409 100644
--- a/enterprise/backend/src/metabase_enterprise/serialization/api.clj
+++ b/enterprise/backend/src/metabase_enterprise/serialization/api.clj
@@ -293,11 +293,8 @@
;; ideally we'd fix the underlying issue (by delaying realtime indexing updates until the tx closes)
;; for now, we let users opt out, in case they're indexing a lot, so they can only reindex on the last step
[:reindex {:default true} (mu/with ms/BooleanValue {:description "Rebuild the search index afterwards"})]]
- _body
- {{:strs [file]} :multipart-params, :as _request} :- [:map
- [:multipart-params
- [:map
- ["file" (mu/with ms/File {:description ".tgz with serialization data"})]]]]]
+ {:keys [file]} :- [:map
+ [:file (mu/with ms/File {:description ".tgz with serialization data"})]]]
(api/check-superuser)
(try
(let [start (System/nanoTime)
diff --git a/src/metabase/api/macros.clj b/src/metabase/api/macros.clj
index 51dfb279204..49527f4a3a7 100644
--- a/src/metabase/api/macros.clj
+++ b/src/metabase/api/macros.clj
@@ -237,16 +237,23 @@
:respond-raise (s/? (s/cat :respond symbol?
:raise symbol?))))))
+(def ^:private default-params-schema
+ "Schema for route params, query params, and the request body when an endpoint binds them without declaring one. A
+ bare `:map` strips every key on decode, so endpoints have to declare the keys they read."
+ [:map])
+
(mu/defn- parse-params :- ::params
[params]
- (letfn [(parse-schema [param]
- (cond-> param
- (:schema param) (update :schema :schema)))]
+ (letfn [(parse-schema [k param]
+ (cond
+ (:schema param) (update param :schema :schema)
+ (contains? #{:route :query :body} k) (assoc param :schema default-params-schema)
+ :else param))]
(merge
(reduce
(fn [params k]
(cond-> params
- (k params) (update k parse-schema)))
+ (k params) (update k #(parse-schema k %))))
(dissoc params :respond-raise)
[:route :query :body :request])
(when-let [{:keys [respond raise]} (:respond-raise params)]
@@ -607,10 +614,13 @@
:query (some-> (:query-params request) (update-keys keyword))))
(mu/defn- request-body
+ "The body params of `request`: the parts of a multipart request, the form params of a form request, or the parsed
+ JSON body. An unparsed body (an `InputStream`) is not a param map."
[request :- :map]
- (or (some-> (not-empty (:form-params request)) (update-keys keyword))
+ (or (some-> (not-empty (:multipart-params request)) (update-keys keyword))
+ (some-> (not-empty (:form-params request)) (update-keys keyword))
(when-let [body (:body request)]
- (when-not (instance? org.eclipse.jetty.ee9.nested.HttpInput body)
+ (when-not (instance? java.io.InputStream body)
body))))
(defn- delete-multipart-tempfiles!
diff --git a/src/metabase/api/macros/defendpoint/open_api.clj b/src/metabase/api/macros/defendpoint/open_api.clj
index fe1e4b258b8..2bfdf785be7 100644
--- a/src/metabase/api/macros/defendpoint/open_api.clj
+++ b/src/metabase/api/macros/defendpoint/open_api.clj
@@ -158,15 +158,6 @@
:schema (dissoc schema :optional :description)}
(:description schema) (assoc :description (str (:description schema)))))))
-(mu/defn- multipart-schema [form :- :metabase.api.macros/parsed-args]
- (when-let [request-schema (get-in form [:params :request :schema])]
- (let [schema (-> request-schema mr/resolve-schema mc/schema)]
- (when (= (mc/type schema) :map)
- (some (fn [[k _opts schema]]
- (when (= k :multipart-params)
- schema))
- (mc/children schema))))))
-
(def ^:private default-response-schema
"Default response schema for OpenAPI endpoints. This is used when the endpoint does not specify a response schema."
{"2XX" {:description "Successful response"}
@@ -214,9 +205,7 @@
ctype (if (get-in form [:metadata :multipart])
"multipart/form-data"
"application/json")
- body-schema (some-> (if (= ctype "multipart/form-data")
- (multipart-schema form)
- (get-in form [:params :body :schema]))
+ body-schema (some-> (get-in form [:params :body :schema])
mjs-collect-definitions
fix-json-schema)
response-schema (:response-schema form)
diff --git a/src/metabase/dashboards_rest/api.clj b/src/metabase/dashboards_rest/api.clj
index 73feae604dd..992f62a0de2 100644
--- a/src/metabase/dashboards_rest/api.clj
+++ b/src/metabase/dashboards_rest/api.clj
@@ -666,12 +666,14 @@
;; TODO (Cam 2025-11-25) please add a response schema to this API endpoint, it makes it easier for our customers to
;; use our API + we will need it when we make auto-TypeScript-signature generation happen
;;
-#_{:clj-kondo/ignore [:metabase/validate-defendpoint-has-response-schema]}
+#_{:clj-kondo/ignore [:metabase/validate-defendpoint-query-params-use-kebab-case
+ :metabase/validate-defendpoint-has-response-schema]}
(api.macros/defendpoint :get "/:id"
"Get Dashboard with ID."
[{:keys [id]} :- [:map
[:id [:or ms/PositiveInt ms/NanoIdString]]]
- {dashboard-load-id :dashboard_load_id}]
+ {dashboard-load-id :dashboard_load_id} :- [:map
+ [:dashboard_load_id {:optional true} [:maybe ms/NonBlankString]]]]
(with-dashboard-load-id dashboard-load-id
(let [resolved-id (eid-translation/->id-or-404 :dashboard id)
dashboard (get-dashboard resolved-id)]
@@ -1200,12 +1202,14 @@
;; use our API + we will need it when we make auto-TypeScript-signature generation happen
;;
#_{:clj-kondo/ignore [:metabase/validate-defendpoint-route-uses-kebab-case
+ :metabase/validate-defendpoint-query-params-use-kebab-case
:metabase/validate-defendpoint-has-response-schema]}
(api.macros/defendpoint :get "/:id/query_metadata"
"Get all of the required query metadata for the cards on dashboard."
[{:keys [id]} :- [:map
[:id [:or ms/PositiveInt ms/NanoIdString]]]
- {dashboard-load-id :dashboard_load_id}]
+ {dashboard-load-id :dashboard_load_id} :- [:map
+ [:dashboard_load_id {:optional true} [:maybe ms/NonBlankString]]]]
(with-dashboard-load-id dashboard-load-id
(perms/with-relevant-permissions-for-user api/*current-user-id*
(let [resolved-id (eid-translation/->id-or-404 :dashboard id)
diff --git a/src/metabase/embedding_rest/api/preview_embed.clj b/src/metabase/embedding_rest/api/preview_embed.clj
index 7854c279ae7..b2ce9fcb69b 100644
--- a/src/metabase/embedding_rest/api/preview_embed.clj
+++ b/src/metabase/embedding_rest/api/preview_embed.clj
@@ -52,7 +52,7 @@
"Fetch the query results for a Card you're considering embedding by passing a JWT `token`."
[{:keys [token]} :- [:map
[:token api.embed.common/EncodedToken]]
- query-params]
+ query-params :- api.embed.common/QueryParams]
(let [unsigned-token (check-and-unsign token)
card-id (embed/get-in-unsigned-token-or-throw unsigned-token [:resource :question])
card (api/check-404 (t2/select-one :model/Card card-id))]
@@ -123,7 +123,7 @@
[{:keys [token param-key]} :- [:map
[:token api.embed.common/EncodedToken]
[:param-key ms/NonBlankString]]
- query-params]
+ query-params :- api.embed.common/QueryParams]
(check-and-unsign token)
(api.embed.common/dashboard-param-values token
param-key
@@ -138,7 +138,7 @@
(api.macros/defendpoint :get "/dashboard/:token/params/:param-key/search/:prefix"
"Embedded version of chain filter search endpoint."
[{:keys [token param-key prefix]} :- api.embed.common/SearchParams
- query-params]
+ query-params :- api.embed.common/QueryParams]
(check-and-unsign token)
(api.embed.common/dashboard-param-values token
param-key
@@ -155,7 +155,7 @@
[{:keys [token param-key]} :- [:map
[:token api.embed.common/EncodedToken]
[:param-key ms/NonBlankString]]
- {:keys [value]}]
+ {:keys [value]} :- [:map [:value :string]]]
(check-and-unsign token)
(api.embed.common/dashboard-param-remapped-value token param-key (codec/url-decode value) {:preview true}))
@@ -169,7 +169,7 @@
[:token api.embed.common/EncodedToken]
[:dashcard-id ms/PositiveInt]
[:card-id ms/PositiveInt]]
- query-params]
+ query-params :- api.embed.common/QueryParams]
(let [unsigned-token (check-and-unsign token)
dashboard-id (embed/get-in-unsigned-token-or-throw unsigned-token [:resource :dashboard])
dashboard (api/check-404 (t2/select-one :model/Dashboard dashboard-id))
@@ -194,7 +194,7 @@
"Fetch the query results for a Card you're considering embedding by passing a JWT `token`."
[{:keys [token]} :- [:map
[:token api.embed.common/EncodedToken]]
- query-params]
+ query-params :- api.embed.common/QueryParams]
(let [unsigned-token (check-and-unsign token)
card-id (embed/get-in-unsigned-token-or-throw unsigned-token [:resource :question])
card (api/check-404 (t2/select-one :model/Card card-id))]
@@ -216,7 +216,7 @@
[:token api.embed.common/EncodedToken]
[:dashcard-id ms/PositiveInt]
[:card-id ms/PositiveInt]]
- query-params]
+ query-params :- api.embed.common/QueryParams]
(let [unsigned-token (check-and-unsign token)
dashboard-id (embed/get-in-unsigned-token-or-throw unsigned-token [:resource :dashboard])
dashboard (api/check-404 (t2/select-one :model/Dashboard dashboard-id))
diff --git a/src/metabase/health_inspector/api.clj b/src/metabase/health_inspector/api.clj
index f39dcd23f3a..4895309ebcd 100644
--- a/src/metabase/health_inspector/api.clj
+++ b/src/metabase/health_inspector/api.clj
@@ -14,6 +14,8 @@
(api.macros/defendpoint :get "/" :- [:sequential ::result]
"Get a list of recent health check runs."
- [_route-params {:keys [limit] :as _query-params} _body]
+ [_route-params
+ {:keys [limit]} :- [:map
+ [:limit {:optional true} ms/PositiveInt]]]
(api/check-superuser)
(health/list-runs (min (or limit 32) 512)))
diff --git a/src/metabase/testing_api/api.clj b/src/metabase/testing_api/api.clj
index 68ebd693de2..139914768c7 100644
--- a/src/metabase/testing_api/api.clj
+++ b/src/metabase/testing_api/api.clj
@@ -152,7 +152,7 @@
[_route-params
{:keys [fail]} :- [:map
[:fail {:default false} ms/BooleanValue]]
- body]
+ body :- ms/Map]
(if fail
{:status 400
:body {:error-code "oops"}}
diff --git a/src/metabase/upload/api.clj b/src/metabase/upload/api.clj
index bf088ee34b1..8d7a63d6d8e 100644
--- a/src/metabase/upload/api.clj
+++ b/src/metabase/upload/api.clj
@@ -41,22 +41,18 @@
The file may be at most 50 MB; larger uploads are rejected with a 413 response."
{:multipart {:max-file-size upload/max-upload-size-bytes
:max-file-count upload/max-upload-part-count}}
- ;; TODO -- not clear collection_id and file are supposed to come from `:multipart-params`
[_route-params
_query-params
- _body
- {{collection-id "collection_id", file "file"} :multipart-params, :as _request}
- :- [:map
- [:multipart-params
- [:map {:closed true}
- ["collection_id" [:maybe
- {:decode/api (fn [collection-id]
- (when-not (= collection-id "root")
- collection-id))}
- pos-int?]]
- ["file" [:map
- [:filename :string]
- [:tempfile (ms/InstanceOfClass java.io.File)]]]]]]]
+ {collection-id :collection_id, :keys [file]}
+ :- [:map {:closed true}
+ [:collection_id [:maybe
+ {:decode/api (fn [collection-id]
+ (when-not (= collection-id "root")
+ collection-id))}
+ pos-int?]]
+ [:file [:map
+ [:filename :string]
+ [:tempfile (ms/InstanceOfClass java.io.File)]]]]]
;; parse-long returns nil with "root" as the collection ID, which is what we want anyway
(from-csv! {:collection-id collection-id
:filename (:filename file)
diff --git a/src/metabase/warehouse_schema_rest/api/table.clj b/src/metabase/warehouse_schema_rest/api/table.clj
index 5fe3340b97b..3a2a60e8476 100644
--- a/src/metabase/warehouse_schema_rest/api/table.clj
+++ b/src/metabase/warehouse_schema_rest/api/table.clj
@@ -478,14 +478,14 @@
file cannot be smuggled past the upload: `::mc/default` keeps the extra parts, and the check below refuses them."
[:and
[:map
- ["file"
+ [:file
[:map
[:filename :string]
[:tempfile (ms/InstanceOfClass java.io.File)]]]
- ["collection_id" {:optional true} :string]
- [::mc/default [:map-of :string :any]]]
+ [:collection_id {:optional true} :string]
+ [::mc/default [:map-of :keyword :any]]]
(mu/with-api-error-message
- [:fn (fn [parts] (every? #{"file" "collection_id"} (keys parts)))]
+ [:fn (fn [parts] (every? #{:file :collection_id} (keys parts)))]
(deferred-tru "unexpected multipart part"))])
;; TODO (Cam 2025-11-25) please add a response schema to this API endpoint, it makes it easier for our customers to
@@ -502,12 +502,10 @@
[{:keys [id]} :- [:map
[:id ms/PositiveInt]]
_query-params
- _body
- {:keys [multipart-params], :as _request} :- [:map
- [:multipart-params CsvUploadParts]]]
+ {:keys [file]} :- CsvUploadParts]
(update-csv! {:table-id id
- :filename (get-in multipart-params ["file" :filename])
- :file (get-in multipart-params ["file" :tempfile])
+ :filename (:filename file)
+ :file (:tempfile file)
:action :metabase.upload/append}))
;; TODO (Cam 2025-11-25) please add a response schema to this API endpoint, it makes it easier for our customers to
@@ -524,12 +522,10 @@
[{:keys [id]} :- [:map
[:id ms/PositiveInt]]
_query-params
- _body
- {:keys [multipart-params], :as _request} :- [:map
- [:multipart-params CsvUploadParts]]]
+ {:keys [file]} :- CsvUploadParts]
(update-csv! {:table-id id
- :filename (get-in multipart-params ["file" :filename])
- :file (get-in multipart-params ["file" :tempfile])
+ :filename (:filename file)
+ :file (:tempfile file)
:action :metabase.upload/replace}))
(defn- sync-schema-async!
diff --git a/src/metabase/warehouses_rest/api.clj b/src/metabase/warehouses_rest/api.clj
index 5b953b3a627..38f0914cd74 100644
--- a/src/metabase/warehouses_rest/api.clj
+++ b/src/metabase/warehouses_rest/api.clj
@@ -892,13 +892,15 @@
;; TODO (Cam 2025-11-25) please add a response schema to this API endpoint, it makes it easier for our customers to
;; use our API + we will need it when we make auto-TypeScript-signature generation happen
;;
-#_{:clj-kondo/ignore [:metabase/validate-defendpoint-has-response-schema]}
+#_{:clj-kondo/ignore [:metabase/validate-defendpoint-query-params-use-kebab-case
+ :metabase/validate-defendpoint-has-response-schema]}
(api.macros/defendpoint :get "/:id/idfields"
"Get a list of all primary key `Fields` for `Database`."
[{:keys [id]} :- [:map
[:id ms/PositiveInt]]
- {:keys [include_editable_data_model]}]
- (let [[db-perm-check field-perm-check] (if (Boolean/parseBoolean include_editable_data_model)
+ {:keys [include_editable_data_model]} :- [:map
+ [:include_editable_data_model {:default false} [:maybe ms/BooleanValue]]]]
+ (let [[db-perm-check field-perm-check] (if include_editable_data_model
[check-db-data-model-perms mi/can-write?]
[api/read-check mi/can-read?])]
(db-perm-check (warehouses/get-database id {:include-editable-data-model? true}))
@@ -1607,7 +1609,8 @@
(api.macros/defendpoint :get ["/:virtual-db/schema/:schema"
:virtual-db (re-pattern (str lib.schema.id/saved-questions-virtual-database-id))]
"Returns a list of Tables for the saved questions virtual database."
- [{:keys [schema]}]
+ [{:keys [schema]} :- [:map
+ [:schema :string]]]
(when (lib-be/enable-nested-queries)
(->> (source-query-cards
:question
@@ -1643,7 +1646,8 @@
(api.macros/defendpoint :get ["/:virtual-db/datasets/:schema"
:virtual-db (re-pattern (str lib.schema.id/saved-questions-virtual-database-id))]
"Returns a list of Tables for the datasets virtual database."
- [{:keys [schema]}]
+ [{:keys [schema]} :- [:map
+ [:schema :string]]]
(when (lib-be/enable-nested-queries)
(->> (source-query-cards
:model
diff --git a/test/metabase/api/macros_test.clj b/test/metabase/api/macros_test.clj
index 93401762a00..42f18d17db4 100644
--- a/test/metabase/api/macros_test.clj
+++ b/test/metabase/api/macros_test.clj
@@ -18,7 +18,7 @@
'{:method :post
:route {:path "/move"}
:docstr "Moves a number of Cards to a single collection or dashboard."
- :params {:route {:binding _route-params}, :query {:binding _query-params}}
+ :params {:route {:binding _route-params, :schema [:map]}, :query {:binding _query-params, :schema [:map]}}
:body [(neat)]}
'(:post "/move"
@@ -33,8 +33,8 @@
'{:method :post
:route {:path "/move"}
:docstr "Moves a number of Cards to a single collection or dashboard."
- :params {:route {:binding _route-params}
- :query {:binding _query-params}
+ :params {:route {:binding _route-params, :schema [:map]}
+ :query {:binding _query-params, :schema [:map]}
:body {:binding {:keys [card_ids], :as body}
:schema [:map [:card_ids [:sequential ms/PositiveInt]]]}
:request {:binding request
@@ -55,8 +55,8 @@
(raise e))))
'{:method :post
:route {:path "/move"}
- :params {:route {:binding _route-params}
- :query {:binding _query-params}
+ :params {:route {:binding _route-params, :schema [:map]}
+ :query {:binding _query-params, :schema [:map]}
:body {:binding {:keys [card_ids], :as body}, :schema :map}
:request {:binding _request}
:respond {:binding respond}
@@ -174,7 +174,7 @@
:route {:path "/test"}
:docstr "Deprecated endpoint."
:metadata {:deprecated "0.50.0", :multipart true}
- :params {:route {:binding _route-params}, :query {:binding _query-params}}
+ :params {:route {:binding _route-params, :schema [:map]}, :query {:binding _query-params, :schema [:map]}}
:body [(test)]})))
(deftest ^:parallel decode-strips-undeclared-keys-test
diff --git a/test/metabase/api/open_api_test.clj b/test/metabase/api/open_api_test.clj
index 90cf45a2ee5..7e99d1d90d6 100644
--- a/test/metabase/api/open_api_test.clj
+++ b/test/metabase/api/open_api_test.clj
@@ -65,11 +65,8 @@
[{:keys [id]} :- [:map
[:id ms/PositiveInt]]
_query-params
- _body
- {{:strs [file]} :multipart-params, :as _request} :- [:map
- [:multipart-params
- [:map
- [:file (mu/with ms/File {:description "File to upload"})]]]]]
+ {:keys [file]} :- [:map
+ [:file (mu/with ms/File {:description "File to upload"})]]]
{:id id :data file})
(deftest ^:parallel defendpoint->openapi-test