dragonfly icon indicating copy to clipboard operation
dragonfly copied to clipboard

JSON bugs in the Fakeredis tests

Open BagritsevichStepan opened this issue 1 year ago • 3 comments

JSON bugs that were found in the Fakeredis tests:

  • [x] Fix WRONGTYPE error for the JSON legacy mode in the JSON.ARRPOP command. It should not return WRONGTYPE for the empy result. Nil is expected. Done by #3683
127.0.0.1:6380> JSON.SET arr . '[]'
OK
127.0.0.1:6380> JSON.ARRPOP arr .
(error) WRONGTYPE wrong JSON type of path value // Result is wrong
  • [x] Support the NOESCAPE option in the JSON.GET command. Done by #3685
  • [x] Fix the JSON.SET behavior if the path is in legacy mode and is not the root. Done by #3693
127.0.0.1:6379> JSON.SET mykey . '{"name": "Alice", "age": 30}'
OK
127.0.0.1:6379> JSON.SET mykey .address '{"name": "Alice", "age": 30}'
(nil) // Result is wrong. Should return OK
  • [x] Support out-of-range indexes for the JSON v2. For the legacy mode we must return an error. Done by #3712
127.0.0.1:6379> JSON.SET arr $ '[0,1,2,3,4]'
OK
127.0.0.1:6379> JSON.ARRTRIM arr $ -1 3
1) (integer) 4 // WRONG. Should return 0
127.0.0.1:6379> JSON.GET arr
"[0,1,2,3]" // WRONG. Should return "[]"
  • [x] Separate the double and int values in queries and in the saved json documents. Done by #3711
127.0.0.1:6379> JSON.SET json $ '[2, 3.0, 3]'
OK
127.0.0.1:6379> JSON.ARRINDEX json $ 3
1) (integer) 1 // WRONG. Should return 2

BagritsevichStepan avatar Sep 08 '24 11:09 BagritsevichStepan

@BagritsevichStepan please do not work on filter expressions for jsonpath v2 - it's too complicated, so lets keep it as a separate (open) task .

romange avatar Sep 08 '24 17:09 romange

@BagritsevichStepan should we close this one?

romange avatar Sep 23 '24 08:09 romange

@BagritsevichStepan should we close this one?

Not yet, will push today pr that finally closes it.

BagritsevichStepan avatar Sep 23 '24 08:09 BagritsevichStepan