leonardoborges/bouncer — pull request #14 by dm3 (2013-09-29 17:53:36+00:00)
Title: Validation results as error metadata

Continuation of https://github.com/leonardoborges/bouncer/pull/10

`validate` now accepts an optional function as the first parameter. This function is responsible for converting error metadata into messages (see `core/with-default-messages` as an example which provides backwards compatible behavior).

Error metadata is a map with the following structure:

* `path` - path to the field which produced the error
* `value` - value of the field which produced the error
* `args` - arguments supplied to the validator
* `metadata` - metadata of the `defvalidator` including the `validator` parameter which contains the namespace-prefixed keyword with the name of the validator (e.g. :bouncer.validators/required).
* `message` - message supplied to the validator when calling `core/validate`