You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
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 joidate 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.
The text was updated successfully, but these errors were encountered:
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()
andJoi.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).Breaking Changes
request.params
andrequest.paramsArray
when the path reaches the parameter. For example,/path/
matching/path/{x?}
will now include{ x: '' }
inrequest.params
, but/path
will not includex
.New Features
Bug fixes
setImmediate()
calls in podium.Updated dependencies
Migration Checklist
Validation
The
Joi.boolean()
type no longer accepts anything other thantrue
andfalse
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 astrue
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:
date().format()
and if you find any, take a look at the new joi date extension.boolean()
rules used in the route validation sections and rewrite those rules toJoi.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 onrequest.params
not containing keys for such empty cases, you will need to check ifrequest.params[name] !== ''
.Checklist:
{optional?}
or{wildcard*}
parameters. For these routes, check your code forrequest.params
andrequest.paramsArray
and ensure it will properly handle empty strings.The text was updated successfully, but these errors were encountered: