Just wondering if the initial slash in the JSON Pointer is necessary. Presumably, the absence of any fragment value (after the #) would/should be equivalent to the root...
No, I don't think it is necessary, I believe that omitting the slash should indicate the root. A fragment of "#/" should indicate the empty string property value of the root. For example:
{
"": "foo"
}
# -> root object
#/ -> "foo"
--
You received this message because you are subscribed to the Google Groups "JSON Schema" group.
To post to this group, send email to json-...@googlegroups.com.
To unsubscribe from this group, send email to json-schema...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/json-schema?hl=en.
I should also have stated that implication of all of this is that a trailing slash is allowed—in fact it's necessary to identify a leaf node with an empty name.
On Thu, Jun 23, 2011 at 7:24 PM, Paul C. Bryan <paul....@forgerock.com> wrote:
On Thu, 2011-06-23 at 18:38 -0400, Dean Landolt wrote:
On Thu, Jun 23, 2011 at 6:25 PM, Paul C. Bryan <paul....@forgerock.com> wrote:
I should also have stated that implication of all of this is that a trailing slash is allowed�in fact it's necessary to identify a leaf node with an empty name.
I likey. I'd wondered the same thing but figured it was related to differentiating between . and / resolution protocols somehow. But that's what a hyperschema's for, of course -- so good catch. I hadn't even considered the "" issue -- interesting...
Well, it would be required when pointing to an empty property, but not necessarily only. And all of this is an issue because we want to distinguish between root node and empty child node�which presents us with ambiguity.But what do you mean by "a trailing slash is allowed�in fact it's necessary�to identify a leaf node with an empty name"? A trailing slash should only be included when�you're pointing to an empty property, right?
We're saying that "" and "/" are different; the former is a pointer to root node, the latter a pointer to an empty named child node of root. In the latter case, on which side of this slash is the empty-named child being identified?
As far as I can tell, there are two possible options:
a) on the left-hand-side, which means that the slash is trailing, optional, but required when empty child, or
b) on the right-hand-side, which means that initial slash is either required, or optional but required when empty child.
I prefer option a). I'm open to others' preferences in this matter, or reasons why one option would be superior to the other.
I'm having trouble groking this. This is how it is in my head...
{
� "foo": "bar",� "bar": {� � "baz": 1,� � "quux": [2,3]� },� "/": "escaped",� "": {� � "": "a",� � "b": "c"� }}
# �-> �the root object#foo �-> �"bar"#bar �-> �{ "baz": 1, "quux": [2,3] }#bar/baz �-> �1#bar/quux �-> �[ 2, 3 ]#bar/quux/1 �-> �3#bar/ �-> �undefined�(because #bar lacks a "" key)#bar/quux/ �-> �undefined�(because #bar/quux lacks a "" key)#%2f �-> �escaped#/ �-> �{ "": "a", "b": "c" }#// �-> �a#/b �-> �c
Does this make sense?
ISTM slashes should mean what we say they mean. The various ambiguities introduces between fs path wrangling are a nightmare -- we have no need for ambiguities -- we can just be explicit and avoid them completely.
I believe part of the rationale for the required-leading-slash scheme (what is currently in JSON Schema) was that it could be clearly identified and disambiguated from other fragment resolution strategies (such as the prior dot-delimited one or any custom/future id-based one).
This also avoids rules about when the slash is optional and when it is required.
It is nice to shed a slash, but the the optional-trailing-slash scheme (proposed here) adds complexity, is incompatible with prior versions of slash delimited paths, and can't be identified as slash delimited (vs other fragment resolutions).
Is that worth it?
I fail at email. Forwarding to the group...
On Fri, Jun 24, 2011 at 9:20 AM, Kris Zyp <kri...@gmail.com> wrote:
I believe part of the rationale for the required-leading-slash scheme (what is currently in JSON Schema) was that it could be clearly identified and disambiguated from other fragment resolution strategies (such as the prior dot-delimited one or any custom/future id-based one).
That's what I suspected. But really, isn't this what the hyperschema's for?
Is it your intention that all future fragment resolution strategies be identified by their first char? If so, should that be in the spec?
If not, we're back to needing the hyperschema for disambiguation, right?
This also avoids rules about when the slash is optional and when it is required.
Yeah, I agree that's way too complex. Did you see my alternative proposal?
It is nice to shed a slash, but the the optional-trailing-slash scheme (proposed here) adds complexity, is incompatible with prior versions of slash delimited paths, and can't be identified as slash delimited (vs other fragment resolutions).Is that worth it?
Perhaps not. But only for the sake of schemaless disambiguation, if anything.
Note that even if the spec is strict, implementations can certainly accept optional slashes. In order to allow for that and ensure compatibility, what I would suggest stating that all path segments SHOULD be preceded by a slash in a pointer fragment. However, if a fragment is being resolved, and the recipient knows the fragment follows the JSON pointer spec/slash delimited, and the first character of a non-empty string is not a slash, the first characters should be treated a path segment (as if it had been prepended with a slash). In other words, leading slashes SHOULD be used by authors, optional leading slashes SHOULD be accepted by parsers. This is compatible, clear, unambiguous, still allows for reduced slashes by implementations for more contained environments.
A little more inline...Yes, but I would presume that JSON Pointers are broadly applicable enough that they are going to be used in some situations where the recipient hasn't seen the hyperschema.
On 6/24/2011 7:37 AM, Dean Landolt wrote:I fail at email. Forwarding to the group...
On Fri, Jun 24, 2011 at 9:20 AM, Kris Zyp <kri...@gmail.com> wrote:
I believe part of the rationale for the required-leading-slash scheme (what is currently in JSON Schema) was that it could be clearly identified and disambiguated from other fragment resolution strategies (such as the prior dot-delimited one or any custom/future id-based one).
That's what I suspected. But really, isn't this what the hyperschema's for?
No, which email is that in?
Is it your intention that all future fragment resolution strategies be identified by their first char? If so, should that be in the spec?If not, we're back to needing the hyperschema for disambiguation, right?This also avoids rules about when the slash is optional and when it is required.
Yeah, I agree that's way too complex. Did you see my alternative proposal?
I'm having trouble groking this. This is how it is in my head...{
"foo": "bar",
"bar": {"baz": 1,"quux": [2,3]},"/": "escaped","": {"": "a","b": "c"}}# -> the root object#foo -> "bar"#bar -> { "baz": 1, "quux": [2,3] }#bar/baz -> 1#bar/quux -> [ 2, 3 ]#bar/quux/1 -> 3
#bar/ -> undefined (because #bar lacks a "" key)#bar/quux/ -> undefined (because #bar/quux lacks a "" key)#%2f -> escaped#/ -> { "": "a", "b": "c" }#// -> a#/b -> c
I'm having trouble groking this. This is how it is in my head...
{
"foo": "bar",
"bar": {
"baz": 1,
"quux": [2,3]
},
"/": "escaped",
"": {
"": "a",
"b": "c"
}
}
# -> the root object
#foo -> "bar"
#bar -> { "baz": 1, "quux": [2,3] }
#bar/baz -> 1
#bar/quux -> [ 2, 3 ]
#bar/quux/1 -> 3
#bar/ -> undefined (because #bar lacks a "" key)
#bar/quux/ -> undefined (because #bar/quux lacks a "" key)
#%2f -> escaped
#/ -> { "": "a", "b": "c" }
#// -> a
#/b -> c
Does this make sense?
ISTM slashes should mean what we say they mean. The various ambiguities introduces between fs path wrangling are a nightmare -- we have no need for ambiguities -- we can just be explicit and avoid them completely.
I believe part of the rationale for the required-leading-slash scheme (what is currently in JSON Schema) was that it could be clearly identified and disambiguated from other fragment resolution strategies (such as the prior dot-delimited one or any custom/future id-based one). This also avoids rules about when the slash is optional and when it is required. It is nice to shed a slash, but the the optional-trailing-slash scheme (proposed here) adds complexity, is incompatible with prior versions of slash delimited paths, and can't be identified as slash delimited (vs other fragment resolutions). Is that worth it?
The only difference then between what you are proposing and what I am is that I am inclined to allow trailing slashes in all cases, not just when it's required for empty names.Agreed. I would like to make them explicit, both by example, and by syntax rule.
ISTM slashes should mean what we say they mean. The various ambiguities introduces between fs path wrangling are a nightmare -- we have no need for ambiguities -- we can just be explicit and avoid them completely.
Paul
Paul
# → root
#a → root["a"]
#/a → root[""]["a"]
#//a → root[""][""]["a"]
#//a/ → root[""][""]["a"][""]
#/a// → root[""]["a"][""][""]
#a// → root["a"][""][""]
#a/ → root["a"][""]
#a/b → root["a"]["b"]
#a/b/ → root["a"]["b"][""]
function parse(value) {value = value.split("/");// drop a path component for empty pathsvar empty = !value.some(function(i) { return i });if (empty) value.pop();return value.map(function(part) {return decodeURIComponent(part);});}
I guess this is where I keep getting hung up. If you have only slashes, drop one path part -- whether it's the head or tail (or from the middle) doesn't matter a bit. Best I can tell it leads to a clear and unambiguous translation and lets you address every possible path, including any of those with empty string keys.
What does "ignore trailing slashes" even mean? Without a bunch of rules it's all kinds of ambiguous.
On Fri, 2011-06-24 at 15:37 -0400, Dean Landolt wrote:Fair enough. It sounds like no matter what, there will be a bunch of rules.
What does "ignore trailing slashes" even mean? Without a bunch of rules it's all kinds of ambiguous.
So, to summarize, if I understand correctly:
1. You're presently in favour of no leading slashes, slashes as delimiter, except in the case of only slashes, at which point, one of the empty elements delimited is to be stripped.
2. I'm presently in favour of no leading slashes, slashes as a delimiter, except if the pointer ends in a slash, at which point it does not signify an additional property token.
3. I think Kris is (still?) in favour of the leading slash, which will maintain compatibility with the current JSON Schema specification.
Have I got it right? Any other takes on this issue?
On Fri, Jun 24, 2011 at 3:46 PM, Paul C. Bryan <paul....@forgerock.com> wrote:
On Fri, 2011-06-24 at 15:37 -0400, Dean Landolt wrote:Fair enough. It sounds like no matter what, there will be a bunch of rules.
What does "ignore trailing slashes" even mean? Without a bunch of rules it's all kinds of ambiguous.
So, to summarize, if I understand correctly:
1. You're presently in favour of no leading slashes, slashes as delimiter, except in the case of only slashes, at which point, one of the empty elements delimited is to be stripped.I just need to come up with a better way to say this. There's a sane rule in there somewhere -- it's just that it doesn't really matter because it only comes up when properties
I believe part of the rationale for the required-leading-slash scheme (what is currently in JSON Schema) was that it could be clearly identified and disambiguated from other fragment resolution strategies (such as the prior dot-delimited one or any custom/future id-based one). This also avoids rules about when the slash is optional and when it is required. It is nice to shed a slash, but the the optional-trailing-slash scheme (proposed here) adds complexity, is incompatible with prior versions of slash delimited paths, and can't be identified as slash delimited (vs other fragment resolutions). Is that worth it?
On Fri, 2011-06-24 at 07:20 -0600, Kris Zyp wrote:
Upon reflection, I'm now coming around full circle; I don't think it's worth it.I believe part of the rationale for the required-leading-slash scheme (what is currently in JSON Schema) was that it could be clearly identified and disambiguated from other fragment resolution strategies (such as the prior dot-delimited one or any custom/future id-based one). This also avoids rules about when the slash is optional and when it is required. It is nice to shed a slash, but the the optional-trailing-slash scheme (proposed here) adds complexity, is incompatible with prior versions of slash delimited paths, and can't be identified as slash delimited (vs other fragment resolutions). Is that worth it?
I'm persuaded that the leading-slash method on balance is the most intuitive, most straightforward to implement and is backward compatible with the existing schema spec.
The case where it's potentially less intuitive is empty property tokens—but empty tokens are not particularly intuitive! Hardly a strong reason to deviate.
I really dislike the singular, anti-informative key value "",
and I think that it should be avoided (if not outlawed).
But couldn't we have an escaped version of #/""/""/"" to indicate
special case of empy-string keys?
And let the majority of well named keys have an easier syntax.
On Fri, Jun 24, 2011 at 4:03 PM, Paul C. Bryan <paul....@forgerock.com> wrote:
Upon reflection, I'm now coming around full circle; I don't think it's worth it.
I'm persuaded that the leading-slash method on balance is the most intuitive, most straightforward to implement and is backward compatible with the existing schema spec.
Again, I suspect the confusion is around the leading vs. trailing framing. In my framing the two issues can be completely orthogonal. What's not to like?
1. Identifies that the pointer is using slash-delimited paths.
2. Indicates that we resolving from the root (#) of the instance.
3. Allows referencing empty property names
4. Keeps path sections consistent (always start with a slash)
5. Allows the ability for canonical references to internal json instances
The last two probably need clarification:
4. By removing the slash at the beginning of the path, we are creating
a special case that is different then how all other property names are
referenced. If paths start with a slash, then all properties are
easily recognizable as "/propertyName".
5. By enforcing paths to start with a slash, we can also leave open
the ability to create references to internal JSON structures. For
example, take the following JSON:
{
"a" : {
"b" : {
"c" : {
"id" : "#foo"
}
}
}
}
Assuming there is a schema applied to this JSON structure that states
the "id" property is a "self" link, we could then reference that
instance using the URL "#foo".
-Gary
The slash "/" character is used as either a separator or as a
substitute for an (ill advised) empty token... if a slash is at the
beginning, end or follows a slash then it refers to an empty token,
otherwise its a separator.
--- but this overloading strikes me as strange, I would rather see
%00 in the path for an empty string.
Right never mind about the escaping of an empty string. Given a leading slash... #/ → root #// → root[""] #/// → root[""][""] #//b → root[""]["b"] Question about trialing slashes (allowed?) #//b/ → root[""]["b"]
I believe that pointers should always start with a slash (/) for a few reasons:
1. Identifies that the pointer is using slash-delimited paths.
2. Indicates that we resolving from the root (#) of the instance.
3. Allows referencing empty property names
4. Keeps path sections consistent (always start with a slash)
5. Allows the ability for canonical references to internal json instances
The last two probably need clarification:
4. By removing the slash at the beginning of the path, we are creating
a special case that is different then how all other property names are
referenced. If paths start with a slash, then all properties are
easily recognizable as "/propertyName".
5. By enforcing paths to start with a slash, we can also leave open
the ability to create references to internal JSON structures. For
example, take the following JSON:
{
"a" : {
"b" : {
"c" : {
"id" : "#foo"
}
}
}
}
Assuming there is a schema applied to this JSON structure that states
the "id" property is a "self" link, we could then reference that
instance using the URL "#foo".
On Fri, 2011-06-24 at 16:51 -0400, Nate Morse wrote:If leading slash, no trailing slashes, and no escaping of empty strings, then simply:Right never mind about the escaping of an empty string. Given a leading slash... #/ → root #// → root[""] #/// → root[""][""] #//b → root[""]["b"] Question about trialing slashes (allowed?) #//b/ → root[""]["b"]
# → root
#//b/ → root[""]["b"][""]
#/ → root[""]
#// → root[""][""]
#/// → root[""][""][""]
#//b → root[""]["b"]
#/a → root["a"]
Paul
--
On Fri, Jun 24, 2011 at 4:56 PM, Paul C. Bryan <paul....@forgerock.com> wrote:
On Fri, 2011-06-24 at 16:51 -0400, Nate Morse wrote:If leading slash, no trailing slashes, and no escaping of empty strings, then simply:Right never mind about the escaping of an empty string. Given a leading slash... #/ → root #// → root[""] #/// → root[""][""] #//b → root[""]["b"] Question about trialing slashes (allowed?) #//b/ → root[""]["b"]
# → rootOh right. I didn't consider that root still wouldn't have a /.#//b/ → root[""]["b"][""]
#/ → root[""]
#// → root[""][""]
#/// → root[""][""][""]
#//b → root[""]["b"]
#/a → root["a"]
On Fri, Jun 24, 2011 at 4:38 PM, Gary Court <gary....@gmail.com> wrote:
I believe that pointers should always start with a slash (/) for a few reasons:
1. Identifies that the pointer is using slash-delimited paths.
Is there value in this? A JSON Pointer can only have slash delimited paths, right? Variable resolution protocols are for other specs. -- not the Pointer spec. Am I missing something?
2. Indicates that we resolving from the root (#) of the instance.
Is there any other way? Also note that you "root (#)", not root "(#/)" :)
3. Allows referencing empty property names
Again, this is orthogonal. In fact, I believe I've proven that without the leading slash you can reference empty property names with perfect fidelity.
4. Keeps path sections consistent (always start with a slash)
That depends on how you look at path sections. I'd argue path parts don't actually contain a slash, just as paths themselves don't actually contain a #.
5. Allows the ability for canonical references to internal json instances
The last two probably need clarification:
4. By removing the slash at the beginning of the path, we are creating
a special case that is different then how all other property names are
referenced. If paths start with a slash, then all properties are
easily recognizable as "/propertyName".
5. By enforcing paths to start with a slash, we can also leave open
the ability to create references to internal JSON structures. For
example, take the following JSON:
{
"a" : {
"b" : {
"c" : {
"id" : "#foo"
}
}
}
}
Assuming there is a schema applied to this JSON structure that states
the "id" property is a "self" link, we could then reference that
instance using the URL "#foo".
I'll have to chew on this a bit, but I don't think it matters one way or the other whether Pointers have leading slashes for it. A pointer doesn't actually start with a "#" value either, right?
Eh, something still doesn't sit right about this. It's terribly inconsistent, for starters, but I suspect it's got a hole in it too.
try this:
Yes ALWAYS a leading slash, optional trailing slash (except for a
final empty token), ONLY read the slash as a separator, An
empty token is always surrounded by slashes //
#/ → root
#// → root[""]
#/// → root[""][""]
#//b → root[""]["b"]
#//b/ → root[""]["b"]
#/a → root["a"]
On Fri, 2011-06-24 at 16:55 -0400, Dean Landolt wrote:Yes, a JSON Pointer would only have slash-delimited paths. Perhaps a better way to put it would be to say that it better identifies that a fragment is using slash-delimited paths.
On Fri, Jun 24, 2011 at 4:38 PM, Gary Court <gary....@gmail.com> wrote:
I believe that pointers should always start with a slash (/) for a few reasons:
1. Identifies that the pointer is using slash-delimited paths.
Is there value in this? A JSON Pointer can only have slash delimited paths, right? Variable resolution protocols are for other specs. -- not the Pointer spec. Am I missing something?
# → root2. Indicates that we resolving from the root (#) of the instance.
Is there any other way? Also note that you "root (#)", not root "(#/)" :)
#/ → root[""]
3. Allows referencing empty property names
Again, this is orthogonal. In fact, I believe I've proven that without the leading slash you can reference empty property names with perfect fidelity.But when you have a dangling path with no value to suck up car
Except the requirement of the funky rule that you must ignore the empty property if there is only slashes.
Correct, a pointer doesn't contain the #. It's there to indicate that it's a fragment portion of a URI. A fragment identifier would be followed immediately by a JSON Pointer.
4. Keeps path sections consistent (always start with a slash)
That depends on how you look at path sections. I'd argue path parts don't actually contain a slash, just as paths themselves don't actually contain a #.5. Allows the ability for canonical references to internal json instances
The last two probably need clarification:
4. By removing the slash at the beginning of the path, we are creating
a special case that is different then how all other property names are
referenced. If paths start with a slash, then all properties are
easily recognizable as "/propertyName".
5. By enforcing paths to start with a slash, we can also leave open
the ability to create references to internal JSON structures. For
example, take the following JSON:
{
"a" : {
"b" : {
"c" : {
"id" : "#foo"
}
}
}
}
Assuming there is a schema applied to this JSON structure that states
the "id" property is a "self" link, we could then reference that
instance using the URL "#foo".
I'll have to chew on this a bit, but I don't think it matters one way or the other whether Pointers have leading slashes for it. A pointer doesn't actually start with a "#" value either, right?
On Fri, Jun 24, 2011 at 5:01 PM, Paul C. Bryan <paul....@forgerock.com> wrote:
Yes, a JSON Pointer would only have slash-delimited paths. Perhaps a better way to put it would be to say that it better identifies that a fragment is using slash-delimited paths.
But does this really do user agents any favors? It's far too loose to be of any practical use. Fragments in text/html serializations, left to their own devices for a few decades, now may have various conflicting interpretations -- all with the potential to clash with their de facto semantics enforced by user agents. This is not a model, it's a mess.
Is there any other way? Also note that you "root (#)", not root "(#/)" :)
# → root
#/ → root[""]
Yes, yes, we agree. Gary was referring to how the slash indicated the root -- I was suggesting it's strange to think that they could ever be resolved from anywhere but the root (but I could be missing the use case). And using the path separator to mean root just opens the door for a broken, untranslatable Pointer path. What does the Pointer "" mean? If for nothing else I think we should drop "/" as a pointer prefix for the same reasons we dropped "?" as a possible query prefix in RQL -- it lead to too much special case handling in code and possible ambiguities.
Why in the world should #/ mean something different than #? We shouldn't have to answer that question :)
Except the requirement of the funky rule that you must ignore the empty property if there is only slashes.
That's not a funky rule people have to know -- it's just a simple shortcut implementers can use. The rule is that any dangling slash (whether a prefix or a suffix) represents an empty string key. And it should be obvious when you see one -- they should immediately smell funny (another great reason we should drop leading slashes!!!). Just as when you see #a/b you expect root["a"]["b"], when you see #a/b/ you'd similarly expect root["a"]["b"][""] -- there's nothing confusing about it. Likewise, when you see #/a/b you'd expect root[""]["a"]["b"] because that leading, dangling slash, and #a//b -- that smells funny too, but is obviously root["a"][""]["b"]. But when all you have is a dangling path part it's unbalanced -- #/ is clearly saying there's an empty-string key, but is it before or after the slash? Well, it doesn't matter. It so intuitively means root[""]. Thus #// means root[""][""]. And every single possible pointer is present and accounted for, and has a logical, unsurprising translation. Even if you don't care about empty keys (and I certainly don't) it's a wonderful thing that this proposal has absolutely perfect fidelity in both directions (does anyone know what this mathematical property is called?).
Note that even if the spec is strict, implementations can certainly accept optional slashes. In order to allow for that and ensure compatibility, what I would suggest stating that all path segments SHOULD be preceded by a slash in a pointer fragment. However, if a fragment is being resolved, and the recipient knows the fragment follows the JSON pointer spec/slash delimited, and the first character of a non-empty string is not a slash, the first characters should be treated a path segment (as if it had been prepended with a slash). In other words, leading slashes SHOULD be used by authors, optional leading slashes SHOULD be accepted by parsers. This is compatible, clear, unambiguous, still allows for reduced slashes by implementations for more contained environments.
A little more inline...
On 6/24/2011 7:37 AM, Dean Landolt wrote:
I fail at email. Forwarding to the group...
On Fri, Jun 24, 2011 at 9:20 AM, Kris Zyp <kri...@gmail.com> wrote:
I believe part of the rationale for the required-leading-slash scheme (what is currently in JSON Schema) was that it could be clearly identified and disambiguated from other fragment resolution strategies (such as the prior dot-delimited one or any custom/future id-based one).
That's what I suspected. But really, isn't this what the hyperschema's for?
Yes, but I would presume that JSON Pointers are broadly applicable enough that they are going to be used in some situations where the recipient hasn't seen the hyperschema.
Is it your intention that all future fragment resolution strategies be identified by their first char? If so, should that be in the spec?
If not, we're back to needing the hyperschema for disambiguation, right?
This also avoids rules about when the slash is optional and when it is required.
Yeah, I agree that's way too complex. Did you see my alternative proposal?
No, which email is that in?
It is nice to shed a slash, but the the optional-trailing-slash scheme (proposed here) adds complexity, is incompatible with prior versions of slash delimited paths, and can't be identified as slash delimited (vs other fragment resolutions).
Is that worth it?
Perhaps not. But only for the sake of schemaless disambiguation, if anything.
Unless there are strong objections, I'd like to incorporate this proposal into the next revision of the draft. I believe this gives us the best balance, and only creates a requirement for leading slashes in the pathological case of empty fragment.
This still has ambiguity (for the reasons I've listed exhaustively) but as it's really addressing the case of what should be in a fragment, and not what is in a pointer itself, I don't care all that much. I still don't understand why we should bother with optional leading slashes -- the only reason left is possible backcompat with JSON Schema -- in this light shouldn't the optional leading slash stuff go in the JSON Schema spec -- what place odes it have in this one? If the JSON Schema spec were to say JSON Pointer, SHOULD be prefixed with a slash -- it would satisfy all issues that have been raised, correct?
JSON Schema's the thing that cares about "path resolution protocols". JSON Pointer is one path resolution protocol. I'm claiming that JSON Schema's default path resolution protocol could be specified as JSON Pointer with an optional leading slash and everyone wins. But this is JSON Schema's business -- no need to project it onto an otherwise perfectly symmetrical and clean JSON Pointer :)
Is removing the dot-resolution protocol on the table?
Just to chime-in with an opinion, For me an initial slash is intuitive
in conveying root (similar to file-systems etc.).
The lack of an initial slash reads as some sort of relative path, but
if I am alone in this, I accept the majority opinion.
On Wed, Jun 29, 2011 at 1:05 PM, Paul C. Bryan <paul....@forgerock.com> wrote:
Unless there are strong objections, I'd like to incorporate this proposal into the next revision of the draft. I believe this gives us the best balance, and only creates a requirement for leading slashes in the pathological case of empty fragment.
This still has ambiguity (for the reasons I've listed exhaustively) but as it's really addressing the case of what should be in a fragment, and not what is in a pointer itself, I don't care all that much.
I still don't understand why we should bother with optional leading slashes -- the only reason left is possible backcompat with JSON Schema -- in this light shouldn't the optional leading slash stuff go in the JSON Schema spec -- what place odes it have in this one? If the JSON Schema spec were to say JSON Pointer, SHOULD be prefixed with a slash -- it would satisfy all issues that have been raised, correct?
On 6/29/2011 11:33 AM, Dean Landolt wrote:The ambiguity you listed was for the case of leading slashes being optional for empty strings, right? The text simply needs to be updated to say "all path segments SHOULD be preceded by a slash in a pointer fragment, and if the first path segment is an empty string, it MUST be preceded by a slash. However, if...".
On Wed, Jun 29, 2011 at 1:05 PM, Paul C. Bryan <paul....@forgerock.com> wrote:
Unless there are strong objections, I'd like to incorporate this proposal into the next revision of the draft. I believe this gives us the best balance, and only creates a requirement for leading slashes in the pathological case of empty fragment.
This still has ambiguity (for the reasons I've listed exhaustively) but as it's really addressing the case of what should be in a fragment, and not what is in a pointer itself, I don't care all that much.
I believe that should satisfy the desired use cases, avoid ambiguity, and maintain back-compat, does that sound good?
On Thu, Jun 30, 2011 at 9:36 AM, Kris Zyp <kri...@gmail.com> wrote:
On 6/29/2011 11:33 AM, Dean Landolt wrote:The ambiguity you listed was for the case of leading slashes being optional for empty strings, right? The text simply needs to be updated to say "all path segments SHOULD be preceded by a slash in a pointer fragment, and if the first path segment is an empty string, it MUST be preceded by a slash. However, if...".
On Wed, Jun 29, 2011 at 1:05 PM, Paul C. Bryan <paul....@forgerock.com> wrote:
Unless there are strong objections, I'd like to incorporate this proposal into the next revision of the draft. I believe this gives us the best balance, and only creates a requirement for leading slashes in the pathological case of empty fragment.
This still has ambiguity (for the reasons I've listed exhaustively) but as it's really addressing the case of what should be in a fragment, and not what is in a pointer itself, I don't care all that much.
I believe that should satisfy the desired use cases, avoid ambiguity, and maintain back-compat, does that sound good?
IIUC you're suggesting this resolution mapping:
# -> root#/ -> root
On 6/30/2011 8:31 AM, Dean Landolt wrote:No, this one is incorrect, it should be #/ -> root[""] according to the proposed text.
On Thu, Jun 30, 2011 at 9:36 AM, Kris Zyp <kri...@gmail.com> wrote:
On 6/29/2011 11:33 AM, Dean Landolt wrote:The ambiguity you listed was for the case of leading slashes being optional for empty strings, right? The text simply needs to be updated to say "all path segments SHOULD be preceded by a slash in a pointer fragment, and if the first path segment is an empty string, it MUST be preceded by a slash. However, if...".
On Wed, Jun 29, 2011 at 1:05 PM, Paul C. Bryan <paul....@forgerock.com> wrote:
Unless there are strong objections, I'd like to incorporate this proposal into the next revision of the draft. I believe this gives us the best balance, and only creates a requirement for leading slashes in the pathological case of empty fragment.
This still has ambiguity (for the reasons I've listed exhaustively) but as it's really addressing the case of what should be in a fragment, and not what is in a pointer itself, I don't care all that much.
I believe that should satisfy the desired use cases, avoid ambiguity, and maintain back-compat, does that sound good?
IIUC you're suggesting this resolution mapping:
# -> root#/ -> root
I am not sure if the arguments below still apply, since they seem to be predicated on a slash leading all JSON pointers, which is not the case, a slash leads path segments, of which the root pointer has none.
So the slash is a path segment prefix, not a path segment separator (except, optionally, on the first one)? That clears it up a bit more in my head, thanks. (Though the argument that a leading "/" improperly suggests "root" still applies, as well as that RQL argument against unnecessary prefixes :)
Let me try again:
# -> root
#/ -> root[""]
#foo -> root["foo"]
#/foo -> root["foo"]
The above pairs strike me as inconsistent, but my delicate sensibilities will survive :) ... at least it's easy enough to grok at least.
#/ -> root[""]
#// -> root[""][""]
#//foo -> root[""]["foo"]
#/foo -> root["foo"]
#/foo/ -> root["foo"][""]
#/foo// -> root["foo"][""][""]
#//foo// -> root[""]["foo"][""][""]
#foo/ -> root["foo"][""]
#//foo -> root[""]["foo"]
Are all of these right? If so, the inconsistencies are strange enough to be jarring. If there's no chance of swaying opinion to drop the leading slash, I'd suggest there's little value in #foo being equal to #/foo. And then (as Gary had suggested) there'd still be room in the fragment space to allow for other resolution protocols (I still don't think this is a good idea but why rule it out completely just to introduce the above oddities?).