const schema = new Schema({
number: {
type: Number,
required: true,
},
parent: {
type: Object,
required: false,
properties: {
child: {
type: Number,
required: true,
}
}
}
});
const err = schema.validate({
number: 1
});
console.log(err);
/// parent.child is required
should.not.exist(err);
not required parent which have a child required
I expect this parent could be undefined but not
not required parent which have a child required
I expect this parent could be undefined but not