code: function(data) {
  
      var errors = [];
  
      // data.Errors is populated by sails-hook-validations and data.invalidAttributes is the default
      var targetAttributes = (data.Errors !== undefined)  ? data.Errors : data.invalidAttributes;
  
      for (var attributeName in targetAttributes) {
  
        var attributes = targetAttributes[attributeName];
  
        for (var index in attributes) {
  
          var error = attributes[index];
  
          errors.push({
            detail: error.message,
            source: {
              pointer: "data/attributes/" + this._convertCase(attributeName, this.getAttributesSerializedCaseSetting())
            }
          });
        }
      }
  
      return errors;
    }
docs: Turn a waterline validation error object into a JSON API compliant error object