TL;DR
Validateur is a functional validations library inspired by Ruby’s ActiveModel. Validateur 2.0 is a feature release.
Changes Between 1.7.0 and 2.0.0
Clojure 1.6
Validateur now depends on org.clojure/clojure
version 1.6.0
. It is
still compatible with Clojure 1.4 and if your project.clj
depends on
a different version, it will be used, but 1.6 is the default now.
Validator Predicates (Guards)
It is now possible to wrap a validator into a function that will check a condition before applying the validator.
To do so, use validate-when
:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
|
If provided predicate returns false
, the validator it guards is not
executed.
Contributed by Scott Nelson.
Generic Validator
Generic validator uses a predicate function and attaches errors to specified attribute:
1 2 3 |
|
Contributed by Scott Nelson.
ClojureWerkz Support Dependency Dropped
ClojureWerkz Support is no longer a dependency of Validateur. This makes it easier to use Validateur in ClojureScript projects.
Contributed by hura.
Validation Set Composition
Validateur now supports composition of validation sets. To
compose several sets, use validateur.validation/compose-sets
:
1 2 3 4 5 6 7 |
|
Contributed by hura.
Full Change Log
Validateur change log is available on GitHub.
Validateur is a ClojureWerkz Project
Validateur is part of the group of libraries known as ClojureWerkz, together with
- Langohr, a Clojure client for RabbitMQ that embraces the AMQP 0.9.1 model
- Monger, a Clojure MongoDB client for a more civilized age
- Elastisch, a minimalistic Clojure client for ElasticSearch
- Cassaforte, a Clojure Cassandra client built around CQL
- Neocons, a client for the Neo4J REST API
- Welle, a Riak client with batteries included
- Quartzite, a powerful scheduling library
and several others. If you like Validateur, you may also like our other projects.
Let us know what you think on Twitter or on the Clojure mailing list.
About The Author
Michael on behalf of the ClojureWerkz Team