Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

17.0.0 Release Notes #2262

Closed
hueniverse opened this issue Jan 4, 2020 · 0 comments
Closed

17.0.0 Release Notes #2262

hueniverse opened this issue Jan 4, 2020 · 0 comments
Assignees
Labels
breaking changes Change that can breaking existing code release notes Major release documentation
Milestone

Comments

@hueniverse
Copy link
Contributor

hueniverse commented Jan 4, 2020

Summary

joi v17.0.0 is a small maintenance release in sync with the upcoming hapi v19 release. The main changes include dropping support for all versions of node prior to v12 and small changes to the configuration and generation of error messages.

  • Upgrade time: low - changes are well contained
  • Complexity: low - changes are easy to apply
  • Risk: low - small number of changes with obvious outcome if not applied correctly
  • Dependencies: low - no changes to the extension system

Breaking Changes

Bug fixes

Updated dependencies

  • address from v2.x to v4.x
  • formula from v1.x to v2.x
  • hoek from v8.x to v9.x
  • pinpoint from v1.x to v2.x
  • topo from v3.x to v5.x

New Features

Migration Checklist

Error messages

Instead of wrapping labels in quotes in the error message literal string, the quotes are not added in message generation based on new preferences. For example:

The previous message '"{{#label}}" is not allowed' is now '{{#label}} is not allowed' but the result is the same for all internal messages as the " are added by default.

This will break any custom message defined outside of joi by adding a set of quotes regardless if the message literal string already contains them.

In addition, the errors.wrapArrays preference was changed to errors.wrap.array which now accepts a string (of 1 or 2 characters) or false. If false is provided, no wrapping is performed. If a single character string is provided, that character is used before and after the value. If a two characters string is provided, the first will be used before the value and the second after the value. For example, '12' will cause the array ['a','b'] to be wrapped '1a,b2'.

A new setting errors.wrap.label controls wrapping of labels in quotes with the same options as errors.wrap.array.

Checklist:

  • Review all custom error messages containing {label} or {{label}} and ensure to remove any existing quotes. If no quotes are used, make sure to set the errors.wrap.label preference to false.
  • Change errors.wrapArrays to errors.wrap.array.

any.default() function value signature

When a function is provided to generate default values, the function signature has changed from function(parent, prefs) to function(parent, helpers). The second argument was not documented in previous versions.

Checklist:

  • Look for .default() calls in your code and if a function with more than one argument is provided, change the second argument from prefs to { prefs } which will provide the same value.
@hueniverse hueniverse added breaking changes Change that can breaking existing code release notes Major release documentation labels Jan 4, 2020
@hueniverse hueniverse added this to the 17.0.0 milestone Jan 4, 2020
@hueniverse hueniverse self-assigned this Jan 4, 2020
codeandcats pushed a commit to joiful-ts/joiful that referenced this issue Jan 30, 2021
codeandcats added a commit to joiful-ts/joiful that referenced this issue Jan 30, 2021
BREAKING CHANGE: hapijs/joi#2262

Co-authored-by: Benji <codeandcats@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking changes Change that can breaking existing code release notes Major release documentation
Projects
None yet
Development

No branches or pull requests

1 participant