-
-
Save amandeepmittal/f03e70c0ec4eeb1c4467167d3a75f887 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
const Joi = require('joi'); | |
const schema = Joi.object() | |
.keys({ | |
username: Joi.string() | |
.alphanum() | |
.min(3) | |
.max(30) | |
.required(), | |
password: Joi.string().regex(/^[a-zA-Z0-9]{3,30}$/), | |
access_token: [Joi.string(), Joi.number()], | |
birthyear: Joi.number() | |
.integer() | |
.min(1900) | |
.max(2013), | |
email: Joi.string().email({ minDomainAtoms: 2 }) | |
}) | |
.with('username', 'birthyear') | |
.without('password', 'access_token'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment