synapsestudios / hapi-async-validation

1 stars 1 forks source link

Come up with an api when using multiple asyncValidators that makes the overwrite value predictable #2

Open spruce-bruce opened 7 years ago

spruce-bruce commented 7 years ago

Right now when doing stuff like this:

asyncValidation({
  // joi schema
}, {
  key: [validator1, validator2]
}

It is not predictable what the value of "key" will be when the handler is called. If validator1 AND validator2 attempt to overwrite the value of "key" then whichever validator resolves last will win. It will not be predictable which validator will resolve last, so the value of key in the route handler can't be predicted.