Hi,
Some feedback and questions, as I've made something similar in the past.
- allow normal fns and classes as a predicates.
- having one global Var for predicates is an antipattern
- can you compose predicates logically (AND/OR)?
- can you validate a contents of the vector?
As an inspiration, the validator I'm using allows for following rules,
which IMHO looks a bit cleaner:
(defn- uri?
"Checks if input is valid URI."
[uri]
(try
(URI. uri)
true
(catch Exception e false)))
(def location-rule {:name String
:lat Number
:long Number})
(def contributor-rule {(required :id) uri?
:gender #{"m" "f"}
:birthDate String
:locales [String]
:homeAddress location-rule})
Best,
Jozef
On Saturday, July 27, 2013 5:50:14 AM UTC+2, ronen wrote:
>
> Substantiation is an opinionated simple nested map validation library:
>
> - Predicates and description kept separate.
> - Validation description map follows validated input structure.
> - Pure data structures to describe validations.
> - Composability of validations is trivial.
> - Validation predicates scope is limited (can only access the checked
> value).
> - High level decisions such as when to activate a group of validations
> should happen on upper layer.
> - Non strict, only described items checked.
>
> Github: https://github.com/narkisr/substantiation
>
> Feedback is welcome
> Ronen
>
--
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
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 [email protected].
For more options, visit https://groups.google.com/groups/opt_out.