Skip to content

stripUnknown behaviour for object arrays #615

@ruiquelhas

Description

@ruiquelhas

On v6.0.8, for object arrays, the stripUnknown option does not result in errors when the validation for one of the object keys fails, like the following example:

var Joi = require('joi');

var schema = Joi.array().items(Joi.object().keys({
  one: Joi.string(),
  two: Joi.number()
})).options({ stripUnknown: true });

schema.validate([{ one: 'one', two: 'two' }], function (err, value) {
  console.log('err:', err);
  console.log('value:', value);
});

Is this the expected behaviour or is it a bug? I don't recall this happening on previous versions. If it's a bug, I'll gladly send a pull request.

Thanks!

Metadata

Metadata

Assignees

Labels

supportQuestions, discussions, and general support

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions