hapijs / joi

The most powerful data validation library for JS
Other
20.95k stars 1.51k forks source link

Email validation error in v17.8.1 #2915

Closed vmarannan closed 1 year ago

vmarannan commented 1 year ago

Support plan

Context

What are you trying to achieve or the steps to reproduce?

Schema

Joi.object({
  email: Joi.string()
        .email({ tlds: { allow: false } })
})

Data To Validate

{ 
  email: 'somevalid@email.com'
}

Result

TypeError: Cannot read properties of undefined (reading 'has')

What result did you expect?

Validate without error as stated on https://joi.dev/api/?v=17.8.1#stringemailoptions

charleskoehl commented 1 year ago

I'm getting same with v17.8.1 and v17.8.0 and the same schema:

Joi.object({
  email: Joi.string()
        .email({ tlds: { allow: false } })
})

Fixed by pinning at 17.7.1.

Bug must have been caused by https://github.com/hapijs/joi/pull/2909

Marsup commented 1 year ago

This is fixed in 17.8.2.