-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Closed
Labels
bugBug or defectBug or defectfeatureNew functionality or improvementNew functionality or improvement
Milestone
Description
> require('joi').string().uri().validate('/foo')
{ error:
{ [ValidationError: "value" must be a valid uri]
…
A relative relative reference takes advantage of the hierarchical syntax(Section 1.2.3) to express a URI reference relative to the name space of another hierarchical URI
– RFC 3986 Section 4.2
If you insist on a URL being locatable, you should a) add a new method url to so insist, and b) consider what you're going to do about this case:
> require('joi').string().uri().validate('http:/')
{ error: null, value: 'http:/' }
Scenario: I'd like to issue relative paths to other documents from an API while keeping the option open to make them absolute. It feels wrong to document them as plain strings. I'd like the result, run through joi-to-json-schema, to wear the format uri.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugBug or defectBug or defectfeatureNew functionality or improvementNew functionality or improvement