I referred the documentation and tried to use the email validation as follows
{
validation: Joi.string().email()
}
But as soon as I load the page I get Error: Built-in TLD list disabled

I tried with TLD 'allow' option set to true as well
{
validation: Joi.string().email({tlds:{allow: true}})
}
But still I get the same error.
When I set allow to false then it works properly.
I've searched the docs and couldn't find anything.
I'm getting the same issue also.
Use .email({ tlds: { allow: false } }) if you don't have the IANA list of registered TLDs.
Per documentation:
true to use the IANA list of registered TLDs. This is the default
false to allow any TLD not listed in the deny list, if present.
A Set or array of the allowed TLDs. Cannot be used together with deny.
@DamodarSojka as I have stated in my comment I've done that only, But this is still an issue IMO as the examples in documentation show the usage as below without any error.
Joi.string().email()
So either the documentation should be updated or this is an actual issue.
Unfortunately, no community resources were available to help resolve this issue after two weeks, and it is being closed. We close unresolved community issues to keep the issue tracker organized and effective. Please check https://hapi.dev/support for other support options.
I think this issue should be reopened the docs seem to be incorrect/confusing.
- tlds - options for TLD (top level domain) validation. By default, the TLD must be a valid name listed on the IANA registry. To disable validation, set tlds to false. To customize how TLDs are validated, set one of these:
- allow - one of:
- true to use the IANA list of registered TLDs. This is the default value.
But when using something like Joi.attempt([email protected], Joi.string().email() the error @Bsd15 describes is shown.
Most helpful comment
Use .email({ tlds: { allow: false } }) if you don't have the IANA list of registered TLDs.
Per documentation:
trueto use the IANA list of registered TLDs. This is the defaultfalseto allow any TLD not listed in thedenylist, if present.A
Setor array of the allowed TLDs. Cannot be used together withdeny.