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

URI validation, allowRelative with domain #2543

Closed
sm2017 opened this issue Jan 23, 2021 · 0 comments
Closed

URI validation, allowRelative with domain #2543

sm2017 opened this issue Jan 23, 2021 · 0 comments
Assignees
Labels
bug Bug or defect
Milestone

Comments

@sm2017
Copy link

sm2017 commented Jan 23, 2021

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

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
2 participants