Valid.optional() doesn't work on its own #3

Open
bronson opened this Issue Oct 11, 2011 · 0 comments

Comments

Projects
None yet
1 participant
Owner

bronson commented Oct 11, 2011

It makes sense to declare something optional without actually defining what it is. This doesn't work, but it should:

Valid.json({
    age: Valid.optional()
});

You need to pass a validator after optional: Valid.optional().integer() or something.

A workaround is Valid.optional().nop().

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment