-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added the ability to use a reference for Array min/max/length #1206
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like it
API.md
Outdated
```js | ||
const schema = Joi.object({ | ||
length: Joi.number().integer().required(), | ||
numbers: Joi.array().length(Joi.ref('limit')).required() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copy pasta got you ;)
Joi.ref('limit')
vs Joi.ref('length')
arr: [1, 2] | ||
}, false, null, 'child "arr" fails because ["arr" references "limit" which is not a number]'], | ||
[{ | ||
limit: 'I like turtles', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
;)
`array().min(), and `array().max()`. Fixes #1017
This thread has been automatically locked due to inactivity. Please open a new issue for related bugs or questions following the new issue template instructions. |
This PR adds the ability for a user to use a reference for
array().length()
,array().min()
andarray().max()
as well as adding test cases and documentation around the functionality.Fixes #1017