ietf-wg-jsonpath / draft-ietf-jsonpath-base

Development of a JSONPath internet draft
https://ietf-wg-jsonpath.github.io/draft-ietf-jsonpath-base/
Other
60 stars 20 forks source link

Clarify resulting order of nested list operations #406

Closed cabo closed 1 year ago

cabo commented 1 year ago

Add clarifications that the input nodelist provides the outer order, the segments provide a middle-level order, and selectors (if multiple) provide the inner order.

This may have been obvious to some readers, but now should be obvious to more, including yours truly.

cabo commented 1 year ago

I don't think the example for $..[*] in Table 17 is right.

https://www.ietf.org/archive/id/draft-ietf-jsonpath-base-10.html#section-2.7.2.3-3

It says:

[{"j"=>1, "k"=>2}, [5, 3, [{"j"=>4}, {"k"=>6}]], 1, 2, 5, 3, [{"j"=>4}, {"k"=>6}], {"j"=>4}, 4, {"k"=>6}, 6]

It should be:

[{"j"=>1, "k"=>2}, [5, 3, [{"j"=>4}, {"k"=>6}]], 1, 2, 5, 3, [{"j"=>4}, {"k"=>6}], {"j"=>4}, {"k"=>6}, 4, 6]

Note that the descendants list puts out [{"j"=>4}, {"k"=>6}] before {"j"=>4} and {"k"=>6}. The wildcard selector then has no choice but outputting {"j"=>4}, {"k"=>6}, 4, 6.

glyn commented 1 year ago

I don't think the example for $..[*] in Table 17 is right.

https://www.ietf.org/archive/id/draft-ietf-jsonpath-base-10.html#section-2.7.2.3-3

It says:

[{"j"=>1, "k"=>2}, [5, 3, [{"j"=>4}, {"k"=>6}]], 1, 2, 5, 3, [{"j"=>4}, {"k"=>6}], {"j"=>4}, 4, {"k"=>6}, 6]

It should be:

[{"j"=>1, "k"=>2}, [5, 3, [{"j"=>4}, {"k"=>6}]], 1, 2, 5, 3, [{"j"=>4}, {"k"=>6}], {"j"=>4}, {"k"=>6}, 4, 6]

Note that the descendants list puts out [{"j"=>4}, {"k"=>6}] before {"j"=>4} and {"k"=>6}. The wildcard selector then has no choice but outputting {"j"=>4}, {"k"=>6}, 4, 6.

Nice catch! The example needs fixing as does the ordering note below Table 17.

cabo commented 1 year ago

I let the computer do the catching :-) Do you want to make these changes? I'd do a new issue then. (And wait a bit for Greg to catch up.)

glyn commented 1 year ago

@cabo Yes, I'm happy to do that and please do create a new issue. I won't be able to fix it before the weekend at the earliest though.