Skip to content

Joi.string().domain() treats '_http._tcp.archive.ubuntu.com' as invalid domain name, even though it works #2630

Closed
@mkg20001

Description

@mkg20001

Support plan

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

Context

  • node version: v16.1.0
  • module version with issue: 17.4.0
  • last module version without issue: don't know
  • environment (e.g. node, browser, native): node
  • used with (e.g. hapi application, another framework, standalone, ...): hapi, standalone
  • any other relevant information: maybe spec issue?

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

The Domain _http._tcp.archive.ubuntu.com resolves correctly and chrome let's me access it

Still Joi validation fails

I'm not exactly sure if ubuntu or Joi is getting the specs wrong here but since it's a valid resolving domain it should pass validation I think

const Joi = require('joi')
const schema = Joi.string().domain({tlds: false}).required()
const data = '_http._tcp.archive.ubuntu.com'
const {error} = schema.validate(data)
console.error(error)

What was the result you got?

Error [ValidationError]: "value" must contain a valid domain name

What result did you expect?

null

Metadata

Metadata

Assignees

Labels

featureNew functionality or improvement

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions