diff --git a/CHANGES b/CHANGES index c6393c9655..1bc7cef600 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,4 @@ + * Fix return types for `get`, `set_path` and `strappend` in JSONCommands * Connection.register_connect_callback() is made public. * Fix async `read_response` to use `disable_decoding`. * Add 'aclose()' methods to async classes, deprecate async close(). diff --git a/redis/commands/json/commands.py b/redis/commands/json/commands.py index ef0cb205a5..4c2e58369c 100644 --- a/redis/commands/json/commands.py +++ b/redis/commands/json/commands.py @@ -173,7 +173,7 @@ def delete(self, key: str, path: Optional[str] = Path.root_path()) -> int: def get( self, name: str, *args, no_escape: Optional[bool] = False - ) -> List[JsonType]: + ) -> Optional[List[JsonType]]: """ Get the object stored as a JSON value at key ``name``. @@ -324,7 +324,7 @@ def set_path( nx: Optional[bool] = False, xx: Optional[bool] = False, decode_keys: Optional[bool] = False, - ) -> List[Dict[str, bool]]: + ) -> Dict[str, bool]: """ Iterate over ``root_folder`` and set each JSON file to a value under ``json_path`` with the file name as the key. @@ -377,7 +377,7 @@ def toggle( return self.execute_command("JSON.TOGGLE", name, str(path)) def strappend( - self, name: str, value: str, path: Optional[int] = Path.root_path() + self, name: str, value: str, path: Optional[str] = Path.root_path() ) -> Union[int, List[Optional[int]]]: """Append to the string JSON value. If two options are specified after the key name, the path is determined to be the first. If a single