-
Notifications
You must be signed in to change notification settings - Fork 75
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
Upgrade dependencies to support hapi 19 #173
Conversation
This upgrade required two main changes: 1. There is no longer a way to query the strategies registered with the server. The previous behavior was to warn that a strategy was not registered, then continue creating the route without the specified auth options. With this change, the route options will be added as long as they are specified. If the auth strategy is not registered, then an error will be thrown when registering the route. This seems to be inline with README. 2. Hapi 19 no longer allows uncompiled top-level validation schemas unless a validator is configured with the server. In previous versions, Joi was used by default. To address this, after the validators are created for a path/operation, any top-level object that is not already a Joi schema is wrapped in Joi.object().
Upgrade enjoi to latest and joi to latest that is supported by enjoi. Additional work needs to be done once enjoi supports @hapi/joi >= 16.
This upgrade addresses a vulnerability found by npm audit
This aligns @hapi/joi with the peer dependency requirement for enjoi.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Thank you so much for the very detail description and PR. Changes look good but builds are failing for node 8 & 10. |
Hapi v19 requires node >= 12. This change will make that more apparent to consumers.
@tlivings Correct. According to hapijs/hapi#4017, Hapi v19 does not support node 11 or older. Based on this, for hapi-openapi to support hapi v19, I think the same restriction will be true. I updated the |
Ok, you'll need to update the travis yaml too in that case. |
can you release ? |
Published as |
Description of changes:
This PR updates several dependencies (list below). The hapi upgrade includes two important changes:
There is no longer a way to query the strategies registered with the server. The previous behavior allowed hapi-openapi to issue a warning that an auth strategy was not registered, then continue creating the route without the specified auth options. With this change, the route options will be added as long as they are specified. If the auth strategy is not registered, then an error will be thrown when registering the route. This seems to be inline with the existing text in README.md.
Hapi 19 no longer allows uncompiled top-level validation schemas unless a validator is configured with the server. In previous versions, Joi was used by default. To address this, after the validators are created for a path/operation, any top-level object that is not already a Joi schema is wrapped in Joi.object(). I went with this approach rather than setting a default validator on the server so that the host codebase could still have flexibility to use a different default validator for any routes that may be created outside hapi-openapi.
Dependencies upgraded:
At the time of this PR, all vulnerabilities found with
npm audit
have been addressed.Issues addressed:
This PR addresses or partially addresses the following issues: