Multi flag on some rules
- Dominant language
- JavaScript
- Stars
- 21.2k
- Forks
- 1.5k
- Avg merge
- 4h 57m
- Merged PRs (30d)
- 14
Description
#### Context
* *node version*: v14.8
* *module version*: v17.2
#### What are you trying to achieve or the steps to reproduce ?
In joi v15 i could apply `greater` contraint twice and both were evaluated during validation:
```js
const schema = Joi.object({
from: Joi.date().required(),
to: Joi.date().greater(Joi.ref('from')).greater('now').required()
})
schema.validate({from: '2099-05-02', to: '2099-05-01'})
// { error: Error [ValidationError]: child "to" fails because ["to" must be greater than "Sat May 02 2099 00:00:00 GMT+0000 (Coordinated Universal Time)"]…
```
currently in v17.2 this validation passes, as `greater('now')` overwrites `greater(Joi.ref('from'))`
I looked into the code and I see flag `multi: true` in some rules like `any.custom` or 'string.pattern', it should be documented.
For example those rules could get badge [](#multi) `[](#multi)` pointing to new seciton in docs about overwriting/appending rules
Contributor guide
Assessment
This issue has not been assessed yet.