metosin/malli

More friendly explanation for `:malli.core/invalid-type`

オープン

#750 opened on 2022/09/05

 (6 件のコメント) (0 件のリアクション) (0 人の担当者)Clojure (237 件のフォーク)batch import
enhancementhelp wanted

Repository metrics

Stars
 (1,724 個のスター)
PR merge metrics
 (30d に merged PR はありません)

説明

Hi!

The following:

(malli.error/humanize
 (malli.core/explain [:sequential :string] #{"a"}))

returns "invalid-type". That could be improved in a couple ways:

  • it could say expected :sequential, got :set
    • i.e. mention the two specific types involved in the type mismatch.
  • additionally, or instead (for agility's sake), say there was a type mismatch for this value
    • while it might look like simply like a verbose rewording of "invalid type", it actually would make it evident that the value is wrong, not the schema itself (which is what I mistakenly believed while debugging this).

wdyt?

Thanks - V

コントリビューターガイド