Duplicate results when a wildcard runs over a singleton list with a complex value #96
Labels
area: selector
Support for a JSONPath selector
good first issue
Good for newcomers
help wanted
External contributions welcome
type: bug
Something isn't working
Milestone
Describe the bug
If the query ends with a wildcard selector and it is applied to a list with a singleton complex value that value is matched twice.
MRE
Expected behavior
Correct result here is
[10]
.Workarounds (optional)
Duplications can be removed from the
bytes
result, but not fromcount
.Proposed solution (optional)
The issue is in the
handle_opening
code in themain
engine:https://github.com/V0ldek/rsonpath/blob/9956fede97d95433ff6549a71e3a5ae58d2703e0/crates/rsonpath-lib/src/engine/main.rs#L315-L337
The report at line 330 is unconditional, which causes a complex value to be accepted first here, and then again when its Opening character is processed in the main loop. This should be behind a condition checking if the next event is not Opening.
Same issue is in the
recursive
engine:https://github.com/V0ldek/rsonpath/blob/9956fede97d95433ff6549a71e3a5ae58d2703e0/crates/rsonpath-lib/src/engine/recursive.rs#L190-L205
Desktop (please complete the following information):
The text was updated successfully, but these errors were encountered: