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
/Users/gil/test/joi/node_modules/@hapi/joi/lib/cast.js:73
throw err;
^
AssertionError [ERR_ASSERTION]: Cannot add other alternatives without at least one schema(_tests)
at new AssertionError (internal/assert.js:269:11)
at Object.exports.assert (/Users/gil/test/joi/node_modules/@hapi/hoek/lib/index.js:592:11)
at internals.Alternatives.try (/Users/gil/test/joi/node_modules/@hapi/joi/lib/types/alternatives.js:104:14)
at Object.exports.schema (/Users/gil/test/joi/node_modules/@hapi/joi/lib/cast.js:31:42)
at internals.Object.keys (/Users/gil/test/joi/node_modules/@hapi/joi/lib/types/object.js:401:35)
at Object.exports.schema (/Users/gil/test/joi/node_modules/@hapi/joi/lib/cast.js:42:29)
at Object.internals.appendPath (/Users/gil/test/joi/node_modules/@hapi/joi/lib/cast.js:66:24)
at Object.exports.schema (/Users/gil/test/joi/node_modules/@hapi/joi/lib/cast.js:15:26)
at module.exports.internals.Any.root.compile (/Users/gil/test/joi/node_modules/@hapi/joi/lib/index.js:176:21)
at module.exports.internals.Any.root.validate (/Users/gil/test/joi/node_modules/@hapi/joi/lib/index.js:161:29)
What did you expect ?
Either a successful validation by calling into the old joi logic, or a more descriptive thrown error.
Note that this is the way that Hapi currently validates schemas in routes, causing such an error whenever an old schema is passed.
The text was updated successfully, but these errors were encountered:
I am going to change the way hapi uses joi to compile provided schemas. This has been a PITA for a long time, requiring breaking hapi releases for joi updates.
hueniverse
changed the title
v16 Joi.validate() fails hard with old schema
Prevent mixing different versions of joi schema types
Jun 22, 2019
Context
@hapi/joi@16.0.0-rc2
&joi@14.3.1
What are you trying to achieve or the steps to reproduce ?
Validate old schema:
Which result you had ?
What did you expect ?
Either a successful validation by calling into the old joi logic, or a more descriptive thrown error.
Note that this is the way that Hapi currently validates schemas in routes, causing such an error whenever an old schema is passed.
The text was updated successfully, but these errors were encountered: