       if message then cb {message} else cb()
   , cb
 
+###*
+ * Validates a field and stops validating on first validation failure or error.
+###
 validateField = (field, schema, value, cb) ->
   # Get a user-friendly display name for the field.
   displayName = schema.displayName or field

    validateRuleGroup group, display, value, cb
  , cb

validateAll = (schema, data, cb) ->
  valid = true
  messages = {}

_ = require "underscore"
valids = require "valids"

###*
 * Validates rules within a rule group asynchronously. This will stop
 * validating on first validation failure or error.
###
validateRuleGroup = (group, display, value, cb) ->
  async.each _.keys(group), (ruleName, cb) ->
    param = group[ruleName]
    if _.isFunction param
