Skip to content

16.0.0 Release Notes #3398

@hueniverse

Description

@hueniverse

Summary

hapi v16.0.0 is a small size release focused on two changes to the request router and built-in validation engine. The validation change switched the bundled version of joi to v10 which contains two breaking changes (Joi.boolean() and Joi.date().format()). The router change does not impact routing logic, but changes the way empty path parameters are reported (they are now included as empty strings).

  • Upgrade time: low - none to a couple of hours for most users
  • Complexity: low - requires following the list of changes to verifying their impact
  • Risk: medium - validation changes could cause boolean path and query parameters to fail if not updated
  • Dependencies: low - existing plugins will work as-is

Breaking Changes

  • Upgrade joi to version 10.0.1 which includes two breaking changes.
  • Upgrade call to version 4.0.0 which changes how empty path parameters are reported. This change includes as empty parameters strings in request.params and request.paramsArray when the path reaches the parameter. For example, /path/ matching /path/{x?} will now include { x: '' } in request.params, but /path will not include x.

New Features

  • Injection performance improvements (shot).
  • Events performance improvements (podium).

Bug fixes

  • Return non-Error error objects in plugin registration as promise rejection.
  • Fix performance issues with high load due to setImmediate() calls in podium.
  • Fix some promises exceptions in prerequisites.
  • Allow HTTPS long poll requests.
  • Prevent changes to Boom error objects passes as replies.
  • Preserve valid cookies when some with same name are invalid.

Updated dependencies

  • call from v3.0.3 to v4.0.0
  • ammo from v2.0.2 to v2.0.3
  • pez from v2.1.2 to v2.1.4
  • statehood from v5.0.0 to v5.0.1
  • accept from v2.1.2 to v2.1.3
  • content from v3.0.2 to v3.0.3
  • mime-db from v1.23.0 to v1.25.0
  • boom from v4.0.0 to v4.2.0
  • cryptiles from v3.0.2 to v3.1.1
  • joi from v9.0.4 to v10.0.1
  • shot from v3.3.2 to v3.4.0
  • podium from v1.2.3 to v1.2.5
  • heavy from v4.0.2 to v4.0.3
  • catbox from v7.1.2 to v7.1.3
  • catbox-memory from v2.0.3 to v2.0.4

Migration Checklist

Validation

The Joi.boolean() type no longer accepts anything other than true and false as valid values. This means that request path parameters and query parameters (which are always strings) will not be automatically cast into booleans. In the past, a=true would pass as true but this change breaks this behavior.

The Joi.date().format() rule is no longer supported.

Note: in hapi v16.1.0 this change was slightly rolled back. String literals of 'true' and 'false' will match boolean schemas when not using string mode.

Checklist:

  • Search your code for date().format() and if you find any, take a look at the new joi date extension.
  • Search your code for boolean() rules used in the route validation sections and rewrite those rules to Joi.boolean().truthy('true', 'yes', 1, '1').falsy('false', 'no', 0, '0') for full backwards compatibility. In practice, you can include just the string values you are expecting and supporting.

Routing

Empty path parameters will no longer be omitted from request.params when the path includes empty segments matching the parameters. If you code relies on request.params not containing keys for such empty cases, you will need to check if request.params[name] !== ''.

Checklist:

  • Search your code for routes with {optional?} or {wildcard*} parameters. For these routes, check your code for request.params and request.paramsArray and ensure it will properly handle empty strings.

Metadata

Metadata

Assignees

Labels

breaking changesChange that can breaking existing coderelease notesMajor release documentation

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions