Replace @hapi/joi with joi in your package.json files and your require statement. No other changes required until joi v18 is published under joi. Expect @hapi/joi to show deprecation warnings shortly.
The hapi project is going through a change of leadership. I have decided to step down from maintaining all hapi modules with the exception of joi.
For additional information:
The joi modules was moved on GitHub from hapijs/joi to sideway/joi. Sideway Inc. is my company which still provides some limited commercial hapi support. Sideway will continue to own and maintain joi moving forward.
The npm joi module is being resurrected and the current v17.1.1 has been published there (identical to the version available on @hapi/joi). To keep things simple, there will not be a @sideway/joi module on npm, just plain joi.
joi will continue to be hapi's primary data validation solution. If you have been using @hapi/joi until now, you can safely switch over. Since hapi v19, joi is no longer exposed as an external dependency. This means that you must BYO validation module and you can simply swap @hapi/joi with joi.
I will continue to work with the new hapi leadership to ensure that future changes to joi will remain compatible with hapi.
In order for hapi to maintain its "no external dependencies" promise, hapi now has its own fork of joi called @hapi/validate which is a restricted version of joi used only for internal hapi API input validations. It is not exposed and should not be used outside of hapi core.
I plan to move some of joi's internals around to decouple if further from hapi modules and dependencies. Version 17.2.0 is expected in the next few days to fix bugs and add some new features. joi will be split into smaller modules internally but will still provide the same interface under joi.
The joi documentation is going to move from https://hapi.dev to a new site and will be linked to from its current home.
I have big plans for joi, including a new fresh focus on client side development, size, and performance. Some things to expect:
If you are using an older version of joi and cannot upgrade to v17, a commercially supported version is available. Please contact [email protected] for details.
@hueniverse I haven't seen anything about @hapi/joi-date package, what is the state of that package?
@ZigaStrgar it came over along with Joi: https://github.com/sideway/joi-date
Can't agree with the logic here, forking joi and then claim your not depending on outside libraries isn't really true. Unless they plan on ignoring your new work and continue on their own seperate path with joi.
But if I read it right, and the plan is merely to merge your changes with hapi's fork, then you now officially have third party dependencies.
Don't get me wrong, I'm not complaining; I'm merely saying that your logic is off and to me, then this marks the beginning of Hapi's end of "no external dependencies" promise.
There is no plan for a fork of joi. hapi is going to use a much smaller subset that is only used internally in hapi for validating API inputs, Since hapi v19, joi is no longer exposed as a public interface. You have to register your own version of a validator which can be joi or other modules.
@fjeddy I think the confusion comes from the fact that the hapijs/validate repo shows a little forked from sideway/joi notation. But as mentioned, that is coming from a specifically pared-down version of Joi and is no longer tracking Joi as an upstream source of code.
@WesTyler I see, but I can only find @hapi/joi-date package on NPM, will it stay with the same name or it will be renamed/republished under different name?
Are the typescript types also going to be migrated to @types/joi?
What about @types/hapi__joi. Will that be functional?
Types are already in 17.2.0. See https://github.com/sideway/joi/issues/2431
@Marsup Thanks!
You should update new documentation link before removing it from hapi.dev, it's 404 now :(
The joi documentation is going to move from https://hapi.dev to a new site and will be linked to from its current home.
@tiendq I ran in the same issue, I'm using the webarchive version for now: https://web.archive.org/web/20200531013802if_/https://hapi.dev/module/joi/api/
In the meantime the raw doc is in https://github.com/sideway/joi/blob/master/API.md (be sure to set the tag to your version though).
@tiendq I ran in the same issue, I'm using the webarchive version for now: https://web.archive.org/web/20200531013802if_/https://hapi.dev/module/joi/api/
thanks nice archive
Types are already in 17.2.0. See #2431
@Marsup I'm happy to hear that the types are now part of the core package!
I guess that also means we could add a depcrecation warning to this package right?
Here is something I put together with Docusaurus. It's not as great as the original docs, but it's better than nothing. Anyone is welcome to use it until the real docs are back.
https://d3lx990o4pbt0e.cloudfront.net
UPDATE: Looks like the docs are back up at https://joi.dev/api/.
the Joi.validate function is not working. It shows "TypeError: Joi.validate is not a function". The documentation in npm is not opening, link does not exist.
Here is something I put together with Docusaurus. It's not as great as the original docs, but it's better than nothing. Anyone is welcome to use it until the real docs are back.
"Page Not Found"
Thanks. Updated the link.
Will my application crash if it stays with import from "@hapi/joi"?
Will my application crash if it stays with import from "@hapi/joi"?
It won't crash, it will remain in npm, but it will not get updates
the minified bundle size of v17 is close to 148KB, i think it's too large for browsers
Are the typescript types also going to be migrated to
@types/joi?
I am guessing this is not yet quite there ?
@decebal Just use separated joi package, the types are already included in it.
Will @hapi/joi-date also get migrated away from Hapi?
@toymachiner62 yes.
Most helpful comment
Are the typescript types also going to be migrated to
@types/joi?