Created
February 26, 2015 12:03
-
-
Save sarhugo/2b47490ae615a9da9a36 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
var Joi = require('joi'); | |
var schema = Joi.object({ | |
password: Joi.string(), | |
confirm: Joi.object().keys({ | |
password: Joi.string() | |
}) | |
}).assert('confirm.password', Joi.ref('password')); | |
var data = { | |
password: '123456', | |
confirm: { | |
password: '1234567' | |
} | |
}; | |
/* | |
Should return path 'password' or 'confirm.password' | |
instead it returns path: 'value' | |
*/ | |
console.log(Joi.validate(data, schema).error.details[0]); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment