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

support relative URIs per RFC1808 and RFC3986 #105

Open
coderextreme opened this issue Jan 27, 2016 · 8 comments
Open

support relative URIs per RFC1808 and RFC3986 #105

coderextreme opened this issue Jan 27, 2016 · 8 comments

Comments

@coderextreme
Copy link

Need to support leading . and .. for "format" : "uri"

@coderextreme
Copy link
Author

or at least leading ..

@coderextreme
Copy link
Author

CC.txt
Schema.txt

@emilbayes
Copy link
Collaborator

@coderextreme Could you elaborate on your request? I don't see any use of relative paths in your examples. Is this in regards to remote $refs? They're not supported by this module

@coderextreme
Copy link
Author

No, it's not remote refs, It's properties (@url, @*Url) marked as "format": "uri" in my schema. I need to validate URI's in my documents, and documents with a URI of .. don't pass. I have overridden the URI format for now. Thanks!

@emilbayes
Copy link
Collaborator

The following works fine for me:

var validate = require('is-my-json-valid')({type: 'string', format: 'uri'})

validate('http://hello.world/../hello.txt') // true

@handrews
Copy link

@emilbayes @coderextreme format "uri" was poorly specified in draft-04. Technially, it indicates a full URI (with scheme). The "uri-reference" format added in draft-06 is what would handle "../hello.txt" as a URI reference to be resolved against the current base per RFC 3986

@coderextreme
Copy link
Author

coderextreme commented Oct 22, 2021

I'm going to close this. Well maybe not through the iPad app :(

@LinusU
Copy link
Collaborator

LinusU commented Oct 22, 2021

We could add uri-reference in addition to the uri format:

exports['uri'] = /^[a-zA-Z][a-zA-Z0-9+\-.]*:[^\s]*$/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants