I'm using joi v17.4.1,to validate post input body parameters , but i want to only put the required parameters in JOi Schema
For example , for Registration i need only username, Email and Password to be mandatory all others parameters will be options .
So i'm creating joi schema like :

```
const registerUserValidator = async (body) => {
const schema = Joi.object().keys({
    username: Joi.string()
        .alphanum()
        .min(3)
        .max(30)
        .required(),

    password: Joi.string()
        .pattern(new RegExp('^[a-zA-Z0-9]{3,30}$')),

    repeat_password: Joi.ref('password'),

    email: Joi.string()
        .email({ minDomainSegments: 2, tlds: { allow: ['com', 'net'] } })
})

```

There user can post :

```
{
    "username":"myuserName",
    "name":"Test Name",
    "email":"test@email.com",
    "phone":"00000000",
     "password":"12345",
     "repeat_password":"12345",
}

```

> 
> **I'm getting error** :
> 
> 
> 

```
{
    "messeage": "\"name\" is not allowed"
}

```

**> Please help**