Skip to content

tlds fails to error on invalid segment #2337

@ben4d85

Description

@ben4d85

Support plan

  • which support plan is this issue covered by? (e.g. Community, Core, Plus, or Enterprise): Community
  • is this issue currently blocking your project? (yes/no): Yes
  • is this issue affecting a production system? (yes/no): No

Context

  • node version: n/a
  • module version with issue: n/a
  • last module version without issue: n/a
  • environment (e.g. node, browser, native): n/a
  • used with (e.g. hapi application, another framework, standalone, ...): n/a
  • any other relevant information: n/a

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

I am trying to validate a .co.uk email address using the email.tlds.allow option.

I am testing using your joi Schema Tester v17.1.1.

Schema

Joi.object({
  email: Joi.string().email({ tlds: { allow: ["com", "co.uk"] } } )
})

Data to validate

{ 
 email: "test@example.co.uk",
}

What was the result you got?

Result:
Validation Error: "email" must be a valid email

What result did you expect?

I expected the email to be considered valid.

Metadata

Metadata

Assignees

Labels

bugBug or defect

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions