(def field-order
  [(s/one s/Keyword "field")
   (s/one (s/enum :asc :desc) "order")])

(s/validate field-order
            [:name :dexc])

ExceptionInfo Value does not match schema: [nil (named (not (#{:desc :asc} 
:dexc)) "order")]  schema.core/validate (core.clj:165)

This is a pretty clear error message indicating the second keyword is neither 
:asc nor :desc.
However, when I use this validation in a vector that can contain either 
keywords or field-order vectors, things get a lot less clear.

(s/validate
  [(s/either s/Keyword
             field-order)]
  [:age [:name :dexc]])

ExceptionInfo Value does not match schema: [nil (not (some (check % [:name 
:dexc]) schemas))]  schema.core/validate (core.clj:165)

So, some check over the [:name :dexc] pair goes wrong, but the detail what 
exactly is lost.
Is there any way I can improve on this by changing the validate functions ?

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to