Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tlds fails to error on invalid segment #2337

Closed
ben4d85 opened this issue Apr 1, 2020 · 2 comments
Closed

tlds fails to error on invalid segment #2337

ben4d85 opened this issue Apr 1, 2020 · 2 comments
Assignees
Labels
bug Bug or defect
Milestone

Comments

@ben4d85
Copy link

ben4d85 commented Apr 1, 2020

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.

@ben4d85 ben4d85 added the support Questions, discussions, and general support label Apr 1, 2020
@kanongil
Copy link
Contributor

kanongil commented Apr 1, 2020

“uk” is the tld, though I guess Joi could be extended to handle this kind of effective tld. At least it should fail when creating the schema.

@hueniverse
Copy link
Contributor

I agree tlds should error on the invalid value. As for the actual requested feature, I'm not opposed but don't see it happening anytime soon.

@hueniverse hueniverse added bug Bug or defect and removed support Questions, discussions, and general support labels Apr 3, 2020
@hueniverse hueniverse changed the title .co.uk not working with email.tlds.allow option tlds fails to error on invalid segment Apr 3, 2020
@hueniverse hueniverse self-assigned this Jul 6, 2020
@hueniverse hueniverse added this to the 17.1.2 milestone Jul 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bug or defect
Projects
None yet
Development

No branches or pull requests

3 participants