You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Correct me if I'm wrong, but in the JSON Pointer spec, I don't think it is possible to even parse necessary to represent a negative array index:
o If the currently referenced value is a JSON array, the reference
token MUST contain either:
* characters comprised of digits (see ABNF below; note that
leading zeros are not allowed) that represent an unsigned
base-10 integer value, making the new referenced value the
array element with the zero-based index identified by the
token, or
* exactly the single character "-", making the new referenced
value the (nonexistent) member after the last array element.
The ABNF syntax for array indices is:
array-index = %x30 / ( %x31-39 *(%x30-39) )
; "0", or digits without a leading "0"
I think it would be reasonable for an implementation to a) not parse negative numbers in reference tokens and b) never check for lower-bounds errors (since negative indexes are simply not possible). Doing that seems to result in path being reported as invalid because "-1" is treated as an object key that is inappropriate to reference an array value, which I think is more in the spirit of the spec.
The path is reported invalid either way, so the test is still valuable in that it tests for some error condition, but it currently tests for an error due to bounds specifically, so I bumped on it when trying to make my test suite a little more strict.
The text was updated successfully, but these errors were encountered:
Correct me if I'm wrong, but in the JSON Pointer spec, I don't think it is
possible to even parsenecessary to represent a negative array index:Therefore, I think this is a misleading test:
I think it would be reasonable for an implementation to a) not parse negative numbers in reference tokens and b) never check for lower-bounds errors (since negative indexes are simply not possible). Doing that seems to result in
path
being reported as invalid because"-1"
is treated as an object key that is inappropriate to reference an array value, which I think is more in the spirit of the spec.The
path
is reported invalid either way, so the test is still valuable in that it tests for some error condition, but it currently tests for an error due to bounds specifically, so I bumped on it when trying to make my test suite a little more strict.The text was updated successfully, but these errors were encountered: