metosin/malli

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

开放

#750 创建于 2022年9月5日

 (6 条评论) (0 个反应) (0 位负责人)Clojure (237 个派生)batch import
enhancementhelp wanted

仓库指标

星标
 (1,724 个星标)
PR 合并指标
 (30 天内没有已合并 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

贡献者指南