Search code examples
functional-programmingclojureschemamalli

What is humanize in Malli?


I do not understand this concept. malli.error/humanize

I tried following up with the github link of Malli. https://github.com/metosin/malli

Does humanize refer to the error statements that we can customize & add like in Java? Or does it mean that errors are printed in a more readable way?

And this is the code.

 (require '[malli.error :as me])

(-> Address
    (m/explain
      {:id "Lillan"
       :tags #{:artesan "coffee" :garden}
       :address {:street "Ahlmanintie 29"
                 :zip 33100
                 :lonlat [61.4858322, nil]}})
    (me/humanize))
;{:tags #{["should be a keyword"]}
; :address {:city ["missing required key"]
;           :lonlat [nil ["should be a double"]]}}

Solution

  • "Does humanize refer to the error statements that we can customize & add like in Java? Or does it mean that errors are printed in a more readable way?"

    So both actually. We can customize it too. And errors are printed in a more human-readable way.