-
-
Notifications
You must be signed in to change notification settings - Fork 292
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
further specify the format of iri-references throughout #1085
base: main
Are you sure you want to change the base?
Changes from all commits
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 | ||||
---|---|---|---|---|---|---|
|
@@ -19,7 +19,9 @@ | |||||
}, | ||||||
"absoluteKeywordLocation": { | ||||||
"type": "string", | ||||||
"format": "uri" | ||||||
"format": "iri", | ||||||
"$comment": "any fragment must be non-empty, and use json-pointer syntax", | ||||||
"pattern": "^[^#]*(#(/([^~]|~[01])*)*)?$" | ||||||
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. The comment says must be non-empty, but this does allow an empty fragment.
Suggested change
The change to + requires a non-empty pointer; disallowing the / from the reference-token character range is better consistent with its spec's ABNF (and iriReferenceToSchemaString above), though it doesn't ultimately change what the regex matches. And of course %-encoding needs fixing here too. 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. actually I think we need to allow empty fragments, so it's the comment that is wrong here. 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. @karenetheridge Agreed, you need to be able to represent the root with a JSON Pointer fragment, which would be an empty fragment. |
||||||
}, | ||||||
"instanceLocation": { | ||||||
"type": "string", | ||||||
|
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.
The second half of the fragment match, for JSON Pointer, won't match the empty pointer (
$ref: "#"
,$ref: "foo#"
). The suggested change follows the JSON Pointer ABNF.This is still incomplete though. Fragments may contain %xx encoded characters. In a pointer their use may be necessary, but in either a pointer or anchor they are expected to be treated like the characters they represent, even when those characters don't actually need to be %-encoded.
Not too pretty, but I think it allows anything that's valid. It won't reject some invalid anchors or pointers if they're %-encoded - it would be possible to express the same character ranges as allowed combinations of %-encoded digits, but I'm not masochistic enough to do it.
I'm a little uncertain describing a uri fragment with a regex isn't more trouble than it's worth.