dice icon indicating copy to clipboard operation
dice copied to clipboard

Inconsistent `JSON.STRLEN`: Error message inconsistent when no path is provided

Open apoorvyadav1111 opened this issue 4 months ago • 1 comments

Please note this issue is created while reviewing #1049 which resolves #777.

The error message needs to be formatted according to the type of the object.

Expected:

127.0.0.1:6379> json.set user:99 $ '{"name":"Bhima", "age":10}'
OK
127.0.0.1:6379> json.strlen user:99 
(error) WRONGTYPE wrong type of path value - expected string but found object

Observed output

The observed output when the above set of commands when run on DiceDB

127.0.0.1:7379>  json.set user:99 $ '{"name":"Bhima", "age":10}'
OK
127.0.0.1:7379> json.strlen user:99 
(error) WRONGTYPE wrong type of path value - expected string but found integer

Expectations for resolution

This issue will be considered resolved when the following things are done

  1. changes in the dice code to meet the expected behavior
  2. addition of relevant test case to ensure we catch the regression

You can find the tests under the integration_tests directory of the dice repository and the steps to run are in the README file. Refer to the following links to set up DiceDB and Redis 7.2.5 locally

apoorvyadav1111 avatar Oct 10 '24 20:10 apoorvyadav1111