From 314c47b7a61e6fe2eaeeaf27cbc794b08d2393fc Mon Sep 17 00:00:00 2001 From: Bryce Date: Sun, 28 Jun 2026 09:43:25 -0700 Subject: [PATCH] fix(ssr): humanize the client wizard's required-field message A missing required field (e.g. the Info step with no Location added) surfaced Malli's raw "missing required key". Override the missing-key message in validate-with's me/humanize call so it reads "This is required." for every required field across the client wizard. Verified live on the Info step. Co-Authored-By: Claude Opus 4.8 --- src/clj/auto_ap/ssr/admin/clients.clj | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/clj/auto_ap/ssr/admin/clients.clj b/src/clj/auto_ap/ssr/admin/clients.clj index 3356ff7f..a87d0ec1 100644 --- a/src/clj/auto_ap/ssr/admin/clients.clj +++ b/src/clj/auto_ap/ssr/admin/clients.clj @@ -491,12 +491,19 @@ (defn- decode-info [request] (->edn-safe-dates (decode-with info-schema request))) +(def ^:private humanize-opts + "Friendlier text for a missing required field than Malli's default + \"missing required key\" (e.g. the Info step with no location added)." + {:errors (assoc-in me/default-errors + [:malli.core/missing-key :error/message] + "This is required.")}) + (defn- validate-with "Per-step validation: a step can't advance until its fields satisfy the step schema. Returns a humanized errors map or nil." [schema data _request] (when-not (mc/validate schema data) - (me/humanize (mc/explain schema data)))) + (me/humanize (mc/explain schema data) humanize-opts))) (defn- client-timeline [active] (let [steps ["Info" "Matches" "Contact" "Bank Accounts" "Integrations" "Cash Flow" "Other Settings"]