From eb06404f1ef08086d9742153fc30c71d400b3d04 Mon Sep 17 00:00:00 2001 From: Joel Kaasinen Date: Fri, 14 Nov 2025 14:06:43 +0200 Subject: [PATCH] feat: fold malli :humanize-opts into :options --- modules/reitit-malli/src/reitit/coercion/malli.cljc | 4 ++-- test/cljc/reitit/ring_coercion_test.cljc | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/reitit-malli/src/reitit/coercion/malli.cljc b/modules/reitit-malli/src/reitit/coercion/malli.cljc index 44c35c27..2e4ab782 100644 --- a/modules/reitit-malli/src/reitit/coercion/malli.cljc +++ b/modules/reitit-malli/src/reitit/coercion/malli.cljc @@ -128,7 +128,7 @@ ([] (create nil)) ([opts] - (let [{:keys [transformers lite compile options error-keys encode-error humanize-opts] :as opts} (merge default-options opts) + (let [{:keys [transformers lite compile options error-keys encode-error] :as opts} (merge default-options opts) show? (fn [key] (contains? error-keys key)) ;; Query-string-coercer needs to construct transfomer without strip-extra-keys so it will ;; use the transformer-provider directly. @@ -189,7 +189,7 @@ (-encode-error [_ error] (cond-> error (show? :humanized) (assoc :humanized (me/humanize error (cond-> {:wrap :message} - humanize-opts (merge humanize-opts)))) + options (merge options)))) (show? :schema) (update :schema edn/write-string opts) (show? :errors) (-> (me/with-error-messages opts) (update :errors (partial map #(update % :schema edn/write-string opts)))) diff --git a/test/cljc/reitit/ring_coercion_test.cljc b/test/cljc/reitit/ring_coercion_test.cljc index 10fbb1f2..162d5c59 100644 --- a/test/cljc/reitit/ring_coercion_test.cljc +++ b/test/cljc/reitit/ring_coercion_test.cljc @@ -607,8 +607,8 @@ :body :humanized))) (is (= {:i ["SHOULD INT"] :x ["MISSING"]} - (-> ((->app {:humanize-opts {:errors {:int {:error/message {:en "SHOULD INT"}} - :malli.core/missing-key {:error/message {:en "MISSING"}}}}}) + (-> ((->app {:options {:errors {:int {:error/message {:en "SHOULD INT"}} + :malli.core/missing-key {:error/message {:en "MISSING"}}}}}) (assoc request :body-params {:i "x"})) :body :humanized))))