lib/hapiCrudHelper.js
function transformConstraintViolationMessages (input) {
    return {
        validationErrors: _.chain(input.details)
    .mapKeys(function(v, k) {
	  // Use '.' as the key if the entire object is erroneous
      return (input.details.length == 1 && input.details[0].path === 'value' && input.details[0].type === 'object.base') ? '.' : v.path
    })
    .mapValues(function (v) {
            return {
        attributes: _.chain(v.context)
        .pickBy(function(v, k) {
          return typeof v !== 'undefined' && v !== null && k !== 'key'
        })
        .mapValues(function(i) {
          return i.toString()
        }),
        constraintClassName: v.type,
        invalidValue: v.context.value,
                messageTemplate: v.type,
            }
        })
    }
}
function transformConstraintViolationMessages (input) {
    return {
        validationErrors: _.chain(input.details)
    .mapKeys(function(v, k) {
	  // Use '.' as the key if the entire object is erroneous
      return (input.details.length == 1 && input.details[0].path === 'value' && input.details[0].type === 'object.base') ? '.' : v.path
    })
    .mapValues(function (v) {
            return {
        attributes: _.chain(v.context)
        .pickBy(function(v, k) {
          return typeof v !== 'undefined' && v !== null && k !== 'key'
        })
        .mapValues(function(i) {
          return i.toString()
        }),
        constraintClassName: v.type,
        invalidValue: v.context.value,
                messageTemplate: v.type,
            }
        })
    }
}
Converts the error object provided into the specified validation constraint violation error message format.