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 <noreply@anthropic.com>
This commit is contained in:
2026-06-28 09:43:25 -07:00
parent 67f8906631
commit 314c47b7a6

View File

@@ -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"]