friemen / examine

Validating Clojure(Script) data.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Question about validating collections

mt0erfztxt opened this issue · comments

Hi, I have a question about validating collections.
Let's take some data and create validators for it

(def person {:contacts [{:name "Donald", :age "40"} {:name "Mickey", :age false}]})
(def contact-rules (rule-set :age required is-integer))
(def person-rules (rule-set :contacts (for-each (partial validate contact-rules))))

Now we can validate our person

(messages (validate person-rules person))
;; {[0 :age] ("Must be an integer number"), [1 :age] ("Must be an integer number")}

as a result we have validation errors as expected, but path in each message isn't complete as its first element, which is a :contacts, is missing and my question is "Why it's missing?".

I reproduced your use-case as unit-test and it seems like a bug which occurs when collections are combined with nested validation.
I'll try to fix it ASAP.

Fixed.
Released version 1.3.1 to https://clojars.org/examine

@friemen Oh, that was a bug. Thank you for fixing it.