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

2.0.0 Release Notes #230

Closed
JKHeadley opened this issue Mar 24, 2020 · 0 comments
Closed

2.0.0 Release Notes #230

JKHeadley opened this issue Mar 24, 2020 · 0 comments

Comments

@JKHeadley
Copy link
Owner

Summary

rest-hapi v2.0.0 is a major version update that focuses on updating dependencies to improve security. The primary dependency updates include hapi v18->v19, joi v14->v17, and mongoose v4->v5.

Breaking Changes

All of the breaking changes in this release are related to dependency updates. Please see the links above for updates.

Migration Checklist

Node version

Make sure your node version is v12.14.1 or newer, as required by hapi v19. Node v12 is the current LTS and the recommended version of node.

joi Schema Compiler

Hapi v19 requires that you register the joi module used via server.validator. By default rest-hapi registers joi v17 as the schema compiler to validate generated routes.

For custom routes with validation such as:

              validate: {
                payload: {
                  password: Joi.string()
                    .required()
                    .description("The user's new password")
                }
              },

you will need to update the syntax to either wrap your schema with Joi.object():

              validate: {
                payload: Joi.object({
                  password: Joi.string()
                    .required()
                    .description("The user's new password")
                })
              },

or use the rest-hapi joi module available through RestHapi.joi:

              validate: {
                payload: {
                  password: RestHapi.joi.string()
                    .required()
                    .description("The user's new password")
                }
              },

See also the rest-hapi docs.

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

No branches or pull requests

1 participant