-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Closed
Labels
breaking changesChange that can breaking existing codeChange that can breaking existing codefeatureNew functionality or improvementNew functionality or improvement
Milestone
Description
Context
- node version: 10.11.0 and 8.12.0
- joi version: 13.6.0
- environment (node, browser): node
- used with (hapi, standalone, ...): hapi
- any other relevant information:
What are you trying to achieve or the steps to reproduce ?
const Joi = require("joi");
const baseArray = Joi.object().keys({
key: Joi.array()
.min(2)
.required()
.items(Joi.object().keys({ a: Joi.string() }))
});
const extended = baseArray.keys({ key: Joi.reach(baseArray, "key").min(1) });
const value = { key: [{ a: "toto" }] };
await Joi.validate(value, extended);Runkit to reproduce the problem.
Which result you had ?
It throws saying that the key array expects 2 items whereas I overrided it for a .min(1).
What did you expect ?
I was expecting the override to work and the validation to pass.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
breaking changesChange that can breaking existing codeChange that can breaking existing codefeatureNew functionality or improvementNew functionality or improvement