Skip to content

Joi.string().domain() treats an email address as a valid domain name #2190

@PallasKatze

Description

@PallasKatze

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: 10.15.3
  • module version with issue: 16.1.7
  • last module version without issue: -
  • environment (e.g. node, browser, native): node
  • used with (e.g. hapi application, another framework, standalone, ...): standalone
  • any other relevant information: -

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

Joi.assert('mail@example.com', Joi.string().domain().required());

What was the result you got?

The line of code above does not throw any exception

What result did you expect?

I expect it to throw ValidationError because the input is an email address, not a domain name.

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