title: Can I define a custom validation with options for Loopback?
body: <p>Is there a prescribed way to create a custom validator in loopback? As an example, assume that I want to create something like:</p>
  
  <pre><code>Validatable.validatesRange('aProperty', {min: 0, max: 1000})
  </code></pre>
  
  <p>Please note that I am aware of:</p>
  
  <pre><code>Validatable.validates(propertyName, validFn, options)
  </code></pre>
  
  <p>The problem I have with validates() is that validFn does not have access to the options. So, I'm forced to hard code this logic; and create a custom method for every property that needs this type of validation. This is undesirable.</p>
  
  <p>Similarly, I am familiar with:</p>
  
  <pre><code>Model.observes('before save', hookFn)
  </code></pre>
  
  <p>Unfortunately, I see no way to even declare options for the hookFn(). I don't have this specific need (at least, not yet). It was just an avenue I explored as a possible alternative to solve my problem.</p>
  
  <p>Any advice is appreciated. Thanks in advance!</p>