I have this validation scheme
const loginSchema = Joi.object({
email: Joi.string()
.email()
.required(),
password: Joi.string().required(),
})
when validating I get Error: Built-in TLD list disabled. From the documentation https://hapi.dev/family/joi/api/?v=17.1.0#stringemailoptions I get that options are, well, optional. I tried passing { tlds: {allow: true} } but I get the same error. After researching I found out that you removed tlds validation support in order to reduce your bundle, so maybe documentation needs update too.
As per the documentation
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.
Means you must be specific and give a valid tlds option with a list of TLDs you want to validate, to disable this error message just do:
email: Joi.string().email({ tlds: {allow: false} })
this will make Joi accepts any type of TLDs and continue your validation without any errors
You seem to be using the browser build of joi instead of the node version...
Most helpful comment
As per the documentation
Means you must be specific and give a valid
tldsoption with a list of TLDs you want to validate, to disable this error message just do:email: Joi.string().email({ tlds: {allow: false} })this will make Joi accepts any type of TLDs and continue your validation without any errors