-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Closed
Labels
featureNew functionality or improvementNew functionality or improvement
Milestone
Description
Context
- node version: 4.X
- joi version: 9.0.4
- environment (node, browser): node
- used with (hapi, standalone, ...): hapi
- any other relevant information:
What are you trying to achieve or the steps to reproduce ?
We had a developer, who after working with Joi.object for a couple validations assumed that Joi.string would also have a default behavior when passed an argument (this default behavior being to enforce a max). I realize this assumed behavior is not documented anywhere, but I think it would be nice if Joi.string and other similar validators that don't accept an argument would warn you of that if you pass them something.
const schema = {
messageText: Joi.string(1024).required()
};Which result you had ?
Joi.string silently accepted the argument, doing nothing with it.
What did you expect ?
A Joi error indicating that Joi.string does not accept any arguments
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
featureNew functionality or improvementNew functionality or improvement