-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Closed
Description
Context
- node version: 16.13
- module version with issue: 17.5.0
- last module version without issue: 15.1.1
- environment (e.g. node, browser, native): Node
- used with (e.g. hapi application, another framework, standalone, ...): standalone
What are you trying to achieve or the steps to reproduce?
const Joi = require('joi');
Joi.string().case(); // Uncaught Error: Invalid case
Joi.string().min(); // Doesn't throw!
const { error } = Joi.string().min().validate('foo');
console.log(error.toString()); // ValidationError: "value" length must be at least characters longAs you can see some methods that take a required argument don't throw at schema-build time, and you get a more cryptic error at validation time instead. These methods include:
number.greater/less/max/min/multiplestring.length/max/min
There are probably others.
I ran into this while trying to upgrade my v15 extensions to to the new format and trying to make sense of the behaviour when the arg assert property is specified, see here for more details: #2470 (comment)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugBug or defectBug or defect