subs.core documentation
Substantiation is an opinionated simple nested map validation framework:
* Predicates and description kept seperate.
* Validations map description sturcture follows validated input.
* Pure datastructures to describe validations.
* Composeability of validations should be 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.
combine
(combine & ds)
Combines a seq of validation descriptions
every-kv
(every-kv vs)
Every key value validation helper
every-v
(every-v vs)
Every value validation helper fn
validate!
(validate! m validations & opts)(validate! m validations)
validates a map with given validations, returns error map (or execption see :error)
options:
:error - will throw exception of type :error if provided (validate! t m :error ::non-valid-m)
validation
(validation type pred)
define an custom validation with type and predicate
when*
macro
(when* pred & body)
returns an fn that applies body on pred else nil
when-not-nil
macro
(when-not-nil pred & body)
returns an fn that applies body on pred if values isn't nil else nil