-
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
deprecate array.includes and array.excludes, use array.items and allow required and forbidden within #559
Conversation
description.includes = []; | ||
var inclusions = [].concat(this._inner.inclusions).concat(this._inner.requireds); |
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.
concat can take multiple args
@@ -88,6 +89,9 @@ internals.checkItems = function (items, wasArray, state, options) { | |||
var errors = []; | |||
var errored; | |||
|
|||
var requireds = Hoek.clone(this._inner.requireds); |
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.
please use slice instead, we don't need a deep clone here
99a28e7
to
5daf892
Compare
4327639
to
7dbcc48
Compare
@@ -422,7 +539,7 @@ describe('array', function () { | |||
|
|||
it('returns an includes array only if includes are specified', function (done) { | |||
|
|||
var schema = Joi.array().includes().max(5); | |||
var schema = Joi.array().items().max(5); | |||
var desc = schema.describe(); | |||
expect(desc.includes).to.not.exist(); |
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.
@nlf includes -> items
deprecates array.includes and array.excludes allows for use of required() and forbidden() in items list
7dbcc48
to
02d6581
Compare
deprecate array.includes and array.excludes, use array.items and allow required and forbidden within
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. |
I think this is ready now..
array.items()
which accepts both.required()
and.forbidden()
itemsarray.includes()
array.excludes()
array.describe()
output to contain only anitems
array rather thanincludes
andexcludes