Skip to content

with constraint doesn't seem to be respected #128

@conscious-fool

Description

@conscious-fool

The code below (based on an example in the readme) prints "Fine..." when executed with node v0.10.12 and joi v1.2.1. I expected it to complain about a missing password field.

Is this the correct usage? Are the with/without constraints implemented as documented?

Thanks

var Joi = require('joi');

var schema = {
    username: Joi.types.String().with('password'),
    password: Joi.types.String().without('access_token')
};

var err = Joi.validate(
    {username: 'bob'},
    schema
);

if(err){
    console.dir(err);
}
else {
    console.log('Fine...');
}

Metadata

Metadata

Assignees

Labels

bugBug or defect

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions