Skip to content
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

Merged
merged 9 commits into from
Apr 5, 2020
Merged

Conversation

tpburch
Copy link
Contributor

@tpburch tpburch commented Apr 3, 2020

Description of changes:
This PR updates several dependencies (list below). The hapi upgrade includes two important changes:

  1. 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.

  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(). 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:

  • hapi => v19
  • joi => v14
  • enjoi => v6
  • hoek => v9
  • swagger-parser => v9
  • boom => v9
  • nyc => v15

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:

Tim Burch added 7 commits March 28, 2020 19:42
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.
tlivings
tlivings previously approved these changes Apr 3, 2020
Copy link
Contributor

@tlivings tlivings left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@tlivings
Copy link
Contributor

tlivings commented Apr 3, 2020

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.
@tpburch
Copy link
Contributor Author

tpburch commented Apr 3, 2020

@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 engines in package.json to reflect this.

@tlivings
Copy link
Contributor

tlivings commented Apr 3, 2020

Ok, you'll need to update the travis yaml too in that case.

@tlivings tlivings merged commit d18bbb5 into krakenjs:master Apr 5, 2020
@dcharbonnier
Copy link
Contributor

can you release ?

@tlivings
Copy link
Contributor

Published as 2.0.0 thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants