-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Description
Summary
joi v18.0.0 is a small maintenance release which goal is mainly to drop node < 20 support by upgrading all the dependencies.
- Upgrade time: low - no expected change in behavior
- Complexity: low - no expected change in your code
- Risk: medium - no major unit test had to change for this release, but a lot of dependencies changed
- Dependencies: low - no changes to the extension system
Breaking Changes
- Upgrade all modules (chore: upgrade modules #2925)
Updated dependencies
- address from v4.x to v5.x and changed to
@hapinamespace - formula still in v3.x and changed to
@hapinamespace - hoek from v10.x to v11.x
- pinpoint still in v2.x and changed to
@hapinamespace - topo from v5.x to v6.x
- tlds added with v1.x
New Features
- Support underscores in domains (Joi.string().domain() treats '_http._tcp.archive.ubuntu.com' as invalid domain name, even though it works #2630 - feat: add underscore support address#43)
- Add standard schema validation support (feat: implement standard schema spec #3080)
- Add wrapper options for
string().uuid/guid()(Added wrapper option to uuid function #3082)
Migration Checklist
Drop node.js < v20
Check that you are using at least node v20.
Change in cidr option validation
cidr option passed to string().ip() is now validated differently and throws options.cidr must be one of required, optional, forbidden instead of options.cidr must be a string when you provide a bad cidr.
This change should not be a problem as it is usually a programmer's mistake which would have already been detected in joi v17.x. Unless you allow user input for this rule and rely on this message to detect a bad input.
Typescript array() change
In an effort to have better types, some types have moved a bit, the most notable being array. If you previously used explicit types with Joi.array<T>.items(...), you're likely going to have to change to Joi.array().items<T>(...).