Thinking further: >>> Which seems to indicate that the character "-" is valid for use and this >>> is followed by the following text at the end of the section >>> >>> " Note that the use of the "-" character to index an array will always >>> result in such an error; applications of JSON Pointer thus need to >>> specify how it is to be handled, if it is to be useful." >>> >>> which seems to indicate that this is an error condition. Can you please >>> clarify? > > the point is that the "-" is syntactically correct and > has the semantics specified in the first excerpt. But, as the second > excerpt says, it references a non-existant array element, and so creates an > "error" from the point of view of the JSON Pointer. > > It is, therefore, up to the use of the Pointer to say what this means. Some > future uses might proceed to handle it as an error condition. JSON Patch > defines it as a valid situation for the "add" operation, but an error for > all other operations.
To be fair, I tripped over the same issue when I did my AD review, then figured it out and didn't mention it in my review comments. I do think it could be clearer. Perhaps something like this would make more sense (and also fixes the "implementations... it" problem)?: OLD Implementations will evaluate each reference token against the document's contents, and terminate evaluation with an error condition if it fails to resolve a concrete value for any of the JSON pointer's reference tokens. For example, if an array is referenced with a non- numeric token, it will fail. See Section 7 for details. Note that the use of the "-" character to index an array will always result in such an error; applications of JSON Pointer thus need to specify how it is to be handled, if it is to be useful. NEW The implementations will evaluate each reference token against the document's contents, and will raise an error condition if it fails to resolve a concrete value for any of the JSON pointer's reference tokens. For example, if an array is referenced with a non-numeric token, an error condition will be raised. See Section 7 for details. Note that the use of the "-" character to index an array will always result in such an error condition because by definition it refers to a non-existent array element. Applications of JSON Pointer thus need to specify how it is to be handled, if it is to be useful. Any error condition that does not have a specific action defined for it by the JSON Pointer application results in termination of evaluation. END Mark, what do you think? Some wordsmithing, perhaps, but I think something along this line will make the point clearer. Barry _______________________________________________ Gen-art mailing list [email protected] https://www.ietf.org/mailman/listinfo/gen-art
