Skip to content

Instantly share code, notes, and snippets.

@sarhugo
Created February 26, 2015 12:03
Show Gist options
  • Save sarhugo/2b47490ae615a9da9a36 to your computer and use it in GitHub Desktop.
Save sarhugo/2b47490ae615a9da9a36 to your computer and use it in GitHub Desktop.
'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