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
Error: Cannot mix different versions of joi schemas
at new module.exports (~/[redacted]/node_modules/@hapi/hoek/lib/error.js:23:19)
at module.exports (~/[redacted]/node_modules/@hapi/hoek/lib/assert.js:20:11)
at Object.exports.isSchema (~/[redacted]/node_modules/joi/lib/common.js:132:5)
at Object.utilities.isJoi (~/[redacted]/node_modules/hapi-swagger/lib/utilities.js:249:24)
at module.exports.internals.properties.internals.properties.parseProperty (~/[redacted]/debugServer/node_modules/hapi-swagger/lib/properties.js:67:18)
at module.exports.internals.responses.internals.responses.getResponse (~/[redacted]/node_modules/hapi-swagger/lib/responses.js:142:41)
at module.exports.internals.responses.internals.responses.build (~/[redacted]/node_modules/hapi-swagger/lib/responses.js:52:29)
at ~/[redacted]/node_modules/hapi-swagger/lib/paths.js:311:36
at Array.forEach (<anonymous>)
at module.exports.internals.paths.internals.paths.buildRoutes (~/[redacted]/node_modules/hapi-swagger/lib/paths.js:164:10)
The text was updated successfully, but these errors were encountered:
The workaround is to explicitly set these to Joi.object({}).allow(null) so they use Joi (which is what Hapi 19 would generate) instead of false, but that isn't ideal, especially since the Hapi docs recommend false for this purpose...
Issue
Hapi 20 uses @hapi/validate internally, and for validation options set to false, it will use this as the schema:
Validator.object({}).allow(null)
Of course, its internal version will not match Joi's, and so we have a mixed version error from Joi.isSchema().
E.g.
Environment
npx envinfo --npmPackages '*hapi*' --binaries
Binaries:
Node: 14.16.1 - ~/.nvm/versions/node/v14.16.1/bin/node
npm: 6.14.12 - ~/.nvm/versions/node/v14.16.1/bin/npm
npmPackages:
hapi-swagger: ^14.5.1 => 14.5.1
Steps to Reproduce
Example route:
Expected Behavior
The swagger documentation is generated normally.
Actual Behavior
This error is thrown when fetching swagger.json:
The text was updated successfully, but these errors were encountered: