Skip to content

Commit 2f9e62f

Browse files
committed
make path mandatory
Signed-off-by: BoazBD <[email protected]>
1 parent 278673e commit 2f9e62f

File tree

2 files changed

+3
-13
lines changed

2 files changed

+3
-13
lines changed

python/python/glide/async_commands/server_modules/json.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ async def get(
207207
async def mget(
208208
client: TGlideClient,
209209
keys: List[TEncodable],
210-
path: Optional[TEncodable] = None,
210+
path: TEncodable,
211211
) -> List[Optional[bytes]]:
212212
"""
213213
Retrieves the JSON values at the specified `path` stored at multiple `keys`.
@@ -223,7 +223,7 @@ async def mget(
223223
Args:
224224
client (TGlideClient): The client to execute the command.
225225
keys (List[TEncodable]): A list of keys for the JSON documents.
226-
path (Optional[TEncodable]): The path within the JSON documents. Default is root `$`.
226+
path (TEncodable): The path within the JSON documents.
227227
228228
Returns:
229229
List[Optional[bytes]]:
@@ -247,10 +247,7 @@ async def mget(
247247
>>> await glideJson.mget(client, ["doc1"], "$.non_existing_path")
248248
[None] # Returns an empty array since the path '$.non_existing_path' does not exist in the JSON document stored at `doc1`.
249249
"""
250-
args = ["JSON.MGET"] + keys
251-
if path:
252-
args.append(path)
253-
250+
args = ["JSON.MGET"] + keys + [path]
254251
return cast(TJsonResponse[Optional[bytes]], await client.custom_command(args))
255252

256253

python/python/tests/tests_server_modules/test_json.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -305,13 +305,6 @@ async def test_json_mget(self, glide_client: TGlideClient):
305305
expected_result = [b"[1.0]"]
306306
assert result == expected_result
307307

308-
# No path given
309-
result = await json.mget(
310-
glide_client,
311-
[key1, key2],
312-
)
313-
assert result == [None]
314-
315308
@pytest.mark.parametrize("cluster_mode", [True, False])
316309
@pytest.mark.parametrize("protocol", [ProtocolVersion.RESP2, ProtocolVersion.RESP3])
317310
async def test_json_del(self, glide_client: TGlideClient):

0 commit comments

Comments
 (0)