Skip to content

Commit

Permalink
Exmaple for hapijs#384
Browse files Browse the repository at this point in the history
  • Loading branch information
Eran Hammer committed Aug 13, 2014
1 parent 58c0a96 commit 6b0411d
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions examples/customMessage.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
var Joi = require('../');


var schema = Joi.object().keys({
email: Joi.string().email().required(),
password: Joi.string().min(8).required(),
password_confirmation: Joi.any().valid(Joi.ref('password')).required().options({ language: { any: { allowOnly: 'must match password' } } }),
first_name: Joi.string().required(),
last_name: Joi.string().required(),
company: Joi.string().optional()
});


var data = {
email: 'joe@example.com',
password: 'abcd1234',
password_confirmation: 'abc1',
first_name: 'Joe',
last_name: 'Doe'
};

Joi.assert(data, schema);

0 comments on commit 6b0411d

Please sign in to comment.