Skip to content
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

array().includes() should not allow undefined #486

Closed
hueniverse opened this issue Nov 16, 2014 · 2 comments
Closed

array().includes() should not allow undefined #486

hueniverse opened this issue Nov 16, 2014 · 2 comments
Assignees
Labels
breaking changes Change that can breaking existing code bug Bug or defect
Milestone

Comments

@hueniverse
Copy link
Contributor

I am not sure what's the right way of allowing undefined values in an array but the default should not be to allow it. It is rarely the desired or expected outcome.

        it('errors on undefined value', function (done) {

            var schema = Joi.object({
                test: Joi.array().includes(Joi.number())
            });
            var input = { test: [undefined] };

            schema.validate(input, function (err, value) {

                expect(err).to.exist();
                done();
            });
        });

Reported in hapijs/hapi#2138

@hueniverse hueniverse added the bug Bug or defect label Nov 16, 2014
@Marsup
Copy link
Collaborator

Marsup commented Nov 17, 2014

@hueniverse Are you ok with the api defined in this commit ?

@Marsup Marsup added the breaking changes Change that can breaking existing code label Nov 17, 2014
@Marsup Marsup added this to the 5.0.0 milestone Nov 17, 2014
@Marsup Marsup self-assigned this Nov 17, 2014
@hueniverse
Copy link
Contributor Author

WFM

Marsup added a commit that referenced this issue Nov 17, 2014
@Marsup Marsup closed this as completed in eb5e74e Nov 22, 2014
@lock lock bot locked as resolved and limited conversation to collaborators Jan 10, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
breaking changes Change that can breaking existing code bug Bug or defect
Projects
None yet
Development

No branches or pull requests

2 participants