-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Closed
Labels
breaking changesChange that can breaking existing codeChange that can breaking existing code
Milestone
Description
joi 2.0 is a complete rewrite of the previous version. While largely backward compatible, it includes a few changes that are
not as well as a large number of bug fixes that dramatically changes existing behavior. The following is an incomplete list of changes.
Please test your existing validation rules to ensure they behave as expected with this new version.
Joi.typesandJoi.Typesdeprecated - useJoi.string()etc. instead.- Uppercase type names deprecated - use lowercase function names instead.
- Top level global config options no longer supported (e.g.
{ languagePath: './file.json' }). Use the.options()method instead. noShortCircuit()no longer supported - use theabortEarlyoption instead.- Options renamed:
saveConversionschanged tomodify.skipConversionschanged toconvert(with reversed meaning).stripExtraKeyschanged tostripUnknown.allowExtraKeyschanged toallowUnknown.- In
rename()options:deleteOrigchanged tomove.allowMultchanged tomultiple.allowOverwritechanged tooverride.
nullOk()andemptyOk()are deprecated - useallow(null)andallow('')instead.number().float()no longer supported.- Completely new internal representation of the data. If you were accessing _variables, your code is most likely broken now. Use
describe()instead. string().alphanum()no longer allows spaces and underscores and does not take an arguement.string().date()no longer supported - use newdate()type.deny()deprecated - useinvalid()instead.array().includes()andarray.excludes()now validates correctly (not just the base type).allow(),valid(), andinvalid()values are now compared against the original and converted values (not just after conversion).string().min()no longer impliesrequired().
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
breaking changesChange that can breaking existing codeChange that can breaking existing code