-
-
Notifications
You must be signed in to change notification settings - Fork 217
Draft-06 formats #173
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
Draft-06 formats #173
Changes from all commits
21b776e
1e2834c
e1e1eec
d545553
e8ef6fd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,6 +34,11 @@ | |
"data": "//foo.bar/?baz=qux#quux", | ||
"valid": false | ||
}, | ||
{ | ||
"description": "an invalid relative URI Reference", | ||
"data": "/abc", | ||
"valid": false | ||
}, | ||
{ | ||
"description": "an invalid URI", | ||
"data": "\\\\WINDOWS\\fileshare", | ||
|
@@ -46,6 +51,75 @@ | |
} | ||
] | ||
}, | ||
{ | ||
"description": "validation of URI References", | ||
"schema": {"format": "uri-reference"}, | ||
"tests": [ | ||
{ | ||
"description": "a valid URI", | ||
"data": "http://foo.bar/?baz=qux#quux", | ||
"valid": true | ||
}, | ||
{ | ||
"description": "a valid protocol-relative URI Reference", | ||
"data": "//foo.bar/?baz=qux#quux", | ||
"valid": true | ||
}, | ||
{ | ||
"description": "a valid relative URI Reference", | ||
"data": "/abc", | ||
"valid": true | ||
}, | ||
{ | ||
"description": "an invalid URI Reference", | ||
"data": "\\\\WINDOWS\\fileshare", | ||
"valid": false | ||
}, | ||
{ | ||
"description": "a valid URI Reference", | ||
"data": "abc", | ||
"valid": true | ||
}, | ||
{ | ||
"description": "a valid URI fragment", | ||
"data": "#fragment", | ||
"valid": true | ||
}, | ||
{ | ||
"description": "an invalid URI fragment", | ||
"data": "#frag\\ment", | ||
"valid": false | ||
} | ||
] | ||
}, | ||
{ | ||
"description": "format: uri-template", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could we add a URI Template that doesn't have any variables in it? And also a URI Template that is a templated relative reference? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what is templated relative reference? I don't see anything here: https://tools.ietf.org/html/rfc6570 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah it's not obvious but it's there. It just means that the template can look like a relative uRI reference in addition to a full URI. At the top of page 3 in the introduction there's this:
(emphasis added). In the expansion section:
It's mentioned in several other places but I think that gets the point across :-) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So a templatized URI reference would be something like
etc. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see. Actually the spec only defines interpolation ({...}), everything outside curly braces can be anything, it doesn't have to be URI reference according to the syntax in RFC. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. But I can add relative reference |
||
"schema": { | ||
"format": "uri-template" | ||
}, | ||
"tests": [ | ||
{ | ||
"description": "a valid uri-template", | ||
"data": "http://example.com/dictionary/{term:1}/{term}", | ||
"valid": true | ||
}, | ||
{ | ||
"description": "an invalid uri-template", | ||
"data": "http://example.com/dictionary/{term:1}/{term", | ||
"valid": false | ||
}, | ||
{ | ||
"description": "a valid uri-template without variables", | ||
"data": "http://example.com/dictionary", | ||
"valid": true | ||
}, | ||
{ | ||
"description": "a valid relative uri-template", | ||
"data": "dictionary/{term:1}/{term}", | ||
"valid": true | ||
} | ||
] | ||
}, | ||
{ | ||
"description": "validation of e-mail addresses", | ||
"schema": {"format": "email"}, | ||
|
@@ -144,5 +218,41 @@ | |
"valid": false | ||
} | ||
] | ||
}, | ||
{ | ||
"description": "validation of JSON-pointers", | ||
"schema": {"format": "json-pointer"}, | ||
"tests": [ | ||
{ | ||
"description": "a valid JSON-pointer", | ||
"data": "/foo/bar~0/baz~1/%a", | ||
"valid": true | ||
}, | ||
{ | ||
"description": "empty string is valid", | ||
"data": "", | ||
"valid": true | ||
}, | ||
{ | ||
"description": "/ is valid", | ||
"data": "/", | ||
"valid": true | ||
}, | ||
{ | ||
"description": "not a valid JSON-pointer (~ not escaped)", | ||
"data": "/foo/bar~", | ||
"valid": false | ||
}, | ||
{ | ||
"description": "valid JSON-pointer with empty segment", | ||
"data": "/foo//bar", | ||
"valid": true | ||
}, | ||
{ | ||
"description": "valid JSON-pointer with the last empty segment", | ||
"data": "/foo/bar/", | ||
"valid": true | ||
} | ||
] | ||
} | ||
] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be good to add a fragment-only URI reference, "#frag" or whatever.