malli

Casey 2024-11-06T12:40:20.532579Z

Some feedback on me/-resolve-root-error: Generally I quite like me/-resolve-root-error, and tend to default to it. However, in the following case I actually prefer the direct-error version better

;; I prefer this because it indicates that the value was missing entirely from the input
(-> [:map [:name :string]]
    (m/explain {})
    (me/humanize))
;; => {:name ["missing required key"]}

;; This error message is correct, it should be a string, but IMO it's more useful to know that the value was missing
(-> [:map [:name :string]]
    (m/explain {})
    (me/humanize {:resolve me/-resolve-root-error}))
;; => {:name ["should be a string"]}