News for hackers. Stuff that matters.
Re:Schema for Clojure(Script) Data Shape Declaration and Val... by w01fe on Thursday September 05, 2013 @02:51PM (#6336062)
Thanks for the feedback!

Actually, schema can express arbitrary constraints. Your example translates to schema as:

  {String {(s/required-key "product") [String]
           (s/required-key "type") (s/enum "type1" "type2")
            s/Any s/Any}} ;; allow any other k-v pairs
Re:Schema for Clojure(Script) Data Shape Declaration and Val... by jwr on Friday September 06, 2013 @02:36AM (#6339018)
Interesting! Is the enum automatically a vector/sequence, or is that just an omission in the example?

Looks like I'll be using this library sooner than I thought, thanks!

Re:Schema for Clojure(Script) Data Shape Declaration and Val... by w01fe on Friday September 06, 2013 @06:09PM (#6342962)
Nope, I missed that in the example -- the enum should be in square brackets.