Fork me on GitHub
#malli
<
2024-01-14
>
Marcelo Fernandes15:01:20

Hello, trying out Malli and confused about this difference in behavior. I expected them to be the same. When having something such as [:and :string :not-blank] how can I avoid executing :not-blank when :string already failed?

ikitommi16:01:29

Hi. Currently, :and explain on all their childs:

(-> [:and [:string {:min 1}] #"kikka"]
    (m/explain :kikka)
    (me/humanize))
; => ["should be a string" "should match regex"]
Maybe better default would be to just to use the first one instead.

ikitommi16:01:44

e.g. this makes no sense:

(-> [:and
     [:vector :any]
     [:fn {:error/message "should be distinct"} #(= % (distinct %))]]
    (m/explain :invalid)
    (me/humanize))
; => ["invalid type" "should be distinct"]

ikitommi16:01:07

could you write an issue out of this?

Marcelo Fernandes16:01:41

sure! Thanks for looking at this.

Ben Sless16:01:18

We need schemas algebra 🙃