title: Resolve all async promises with validate.js
body: <p>I'm using this library for validation: <a href="https://validatejs.org/#validate-async" rel="nofollow noreferrer">https://validatejs.org/#validate-async</a>.</p>
  
  <p>I've got a fairly complicated way of validating nested objects against their own schema. See the relevant code below.</p>
  
  <p>Basically, it will:</p>
  
  <ol>
  <li>Create an async promise for each nested object.</li>
  <li>Then call Promise.all to resolve or reject the validations.</li>
  </ol>
  
  <p>It's working well, except one problem. With the default promise library <code>Promise.all</code> "fails fast" so in the catch handler, which is in later express middleware, it only receives results from the first failed promise. But for my validators to work I need to combine the results from all the failed promises.</p>
  
  <p>Is there an alternative promise library (A+ compliant) that I could swap into the validator that would allow me to capture all errors?</p>
  
  <pre><code>ValidationAdapter.prototype.validateCreateCtrl = function(req, res, next){
    var obj = {};
    var self = this;
    this.logger.debug("Validating " + self.config.modelName + " create request");
    self.fieldList.forEach(function(fieldName){
      obj[fieldName] = req.body[fieldName];
    });
  
    self._resolveObjectRefs(obj);
  
    this.logger.debug("Composed request object " + JSON.stringify(obj, null, 2));
  
    var Promises = [];
    Promises.push(validate.async(obj, self.constraints));
  
    Object.keys(self.embeddedConstraints).forEach(function (key){
      var value = obj[key];
      var constraints = self.embeddedConstraints[key];
      if (value.constructor === Array){
        var i = 0;
        value.forEach(function(newVal){
          Promises.push(validate.async(newVal, constraints, {path: key + "[" + i + "]."}));
          i++;
        });
      }else{
        Promises.push(validate.async(value, constraints, {path: key}))
      }
    });
  
    // by default it should fall through
    Promise.all(Promises).then(function(){
      return next();
    }).catch(next);
  };
  </code></pre>