title: sequelize custom validator
body: <p>I would like to create custom field validator with reference to existing field. What I did is to create a custom validator:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>const User = sequelize.define('User', {
      postalCode: {
        type: DataTypes.STRING
      },
      country: DataTypes.STRING,
    }, {
      validate: {
        wrongPostalCode() {
          if (this.postalCode &amp;&amp; this.country) {
            if (!validator.isPostalCode(String(this.postalCode), this.country)) {
              throw new Error('Wrong postal code')
            }
          }
        }
      }
    });
    User.associate = (models) =&gt; {
      // TO DO
    };
    return User;
  };</code></pre>
  </div>
  </div>
  </p>
  
  <p>As you can see below in error message, we are getting this validator but in the row "path" there is validator name. I would like to change it for example to "postalCode" or somehow connect it with one field from the model. It is very important for me as this is related to Front-End and to parse it to correct form control.</p>
  
  <p><a href="https://i.stack.imgur.com/9f9qV.png" rel="nofollow noreferrer">enter image description here</a></p>
  
  <p>Is there any way to do it?</p>
  
  <p>Thank you in advanced :)</p>