Skip to content

URI validation, allowRelative with domain #2543

Closed
@sm2017

Description

@sm2017

Support plan

  • is this issue currently blocking your project? (no):
  • is this issue affecting a production system? (yes):

Context

  • node version: v14.15.4
  • module version with issue: 17.3.0
  • last module version without issue: N/A
  • environment (e.g. node, browser, native): node
  • used with (e.g. hapi application, another framework, standalone, ...): eggjs
  • any other relevant information: N/A

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

const schema = Joi.string().uri({ allowRelative: true, domain: { minDomainSegments: 2 }});
await schema.validate('test.com');

When we use both allowRelative:true and domain option, we have some problem in validation, http://test.com is valid but test.com throws error

What was the result you got?

Error: Invalid input: domain must be a string

What result did you expect?

allowRelative and domain must be works together and test.com is a valid relative uri but test is not a valid with the given schema

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