-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Closed
Labels
featureNew functionality or improvementNew functionality or improvement
Milestone
Description
Joi valid fails, when ref is used with a stripped key. Maybe this is the expected behaviour. I'll let you decide.
- node version: v4.2.1
- joi version: ^0.8.5
- environment (node, browser): node
- used with (hapi, standalone, ...): standalone
What are you trying to achieve or the steps to reproduce ?
var Joi = require('joi');
var schema = Joi.object({
a: Joi.any().required().strip(),
b: Joi.any().valid(Joi.ref('a'))
});
console.log( schema.validate({ a: 1, b: 1 }) );Which result you had ?
Error: child "b" fails because ["b" must be one of [ref:a]]What did you expect ?
No error, and "a" should have been stripped. Value: { b: 1 }
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
featureNew functionality or improvementNew functionality or improvement