Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Redis JSON SDK documentation fixes #398

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion redis/sdks/py/commands/json/arrappend.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ To specify a string as an array value to append, wrap the quoted string with an

## Response

<ResponseField type="int" required>
<ResponseField type="List[int]" required>
The length of the array after the appending.
</ResponseField>

Expand Down
2 changes: 1 addition & 1 deletion redis/sdks/py/commands/json/arrindex.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ description: Search for the first occurrence of a JSON value in an array.

## Response

<ResponseField type="int" required>
<ResponseField type="List[int]" required>
The index of the first occurrence of the value in the array, or -1 if not found.
</ResponseField>

Expand Down
2 changes: 1 addition & 1 deletion redis/sdks/py/commands/json/arrinsert.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ description: Insert the json values into the array at path before the index (shi

## Response

<ResponseField type="int" required>
<ResponseField type="List[int]" required>
The length of the array after the insertion.
</ResponseField>

Expand Down
2 changes: 1 addition & 1 deletion redis/sdks/py/commands/json/arrlen.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ description: Report the length of the JSON array at `path` in `key`.

## Response

<ResponseField type="int" required>
<ResponseField type="List[int]" required>
The length of the array.
</ResponseField>

Expand Down
6 changes: 3 additions & 3 deletions redis/sdks/py/commands/json/arrpop.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,16 @@ description: Remove and return an element from the index in the array. By defaul

## Response

<ResponseField type="TValue | null" required>
<ResponseField type="List[TValue | null]" required>
The popped element or null if the array is empty.
</ResponseField>

<RequestExample>
```py Example
element = redis.json("key", "$.path.to.array")
element = redis.json.arrpop("key", "$.path.to.array")
```

```py First
firstElement = redis.json("key", "$.path.to.array", 0)
firstElement = redis.json.arrpop("key", "$.path.to.array", 0)
```
</RequestExample>
2 changes: 1 addition & 1 deletion redis/sdks/py/commands/json/arrtrim.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ description: Trim an array so that it contains only the specified inclusive rang

## Response

<ResponseField type="int" required>
<ResponseField type="List[int]" required>
The length of the array after the trimming.
</ResponseField>

Expand Down
4 changes: 2 additions & 2 deletions redis/sdks/py/commands/json/clear.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ description: Clear container values (arrays/objects) and set numeric values to 0

## Response

<ResponseField type="int" required>
The length of the array after the appending.
<ResponseField type="List[int]" required>
How many keys cleared from the objects.
</ResponseField>

<RequestExample>
Expand Down
6 changes: 0 additions & 6 deletions redis/sdks/py/commands/json/del.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,6 @@ description: Delete a key from a JSON document.
</ParamField>



<ParamField body="value" type="...TValue[]" required>
One or more values to append to the array.
</ParamField>


## Response

<ResponseField type="int" required>
Expand Down
6 changes: 0 additions & 6 deletions redis/sdks/py/commands/json/forget.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,6 @@ description: Delete a key from a JSON document.
</ParamField>



<ParamField body="value" type="...TValue[]" required>
One or more values to append to the array.
</ParamField>


## Response

<ResponseField type="int" required>
Expand Down
28 changes: 1 addition & 27 deletions redis/sdks/py/commands/json/get.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -9,31 +9,13 @@ description: Get a single value from a JSON document.
The key of the json entry.
</ParamField>

<ParamField body="options">
<Expandable>
<ParamField body="indent" type="str">
Sets the indentation string for nested levels.
</ParamField>

<ParamField body="newline" type="str">
Sets the string that's printed at the end of each line.
</ParamField>

<ParamField body="space" type="str">
Sets the string that is put between a key and a value.
</ParamField>

</Expandable>

</ParamField>

<ParamField body="paths" type="*List[str]" default="$">
One or more paths to retrieve from the JSON document.
</ParamField>

## Response

<ResponseField type="TValue | null" required>
<ResponseField type="List[TValue | null]" required>
The value at the specified path or `null` if the path does not exist.
</ResponseField>

Expand All @@ -42,12 +24,4 @@ description: Get a single value from a JSON document.
value = redis.json.get("key", "$.path.to.somewhere")
```

```py With Options
value = redis.json.get("key", {
indent: " ",
newline: "\n",
space: " ",
}, "$.path.to.somewhere")
```

</RequestExample>
2 changes: 1 addition & 1 deletion redis/sdks/py/commands/json/mget.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ description: Get the same path from multiple JSON documents.

## Response

<ResponseField type="TValue[]" required>
<ResponseField type="List[TValue[]]" required>
The values at the specified path or `null` if the path does not exist.
</ResponseField>

Expand Down
6 changes: 3 additions & 3 deletions redis/sdks/py/commands/json/numincrby.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ description: Increment the number value stored at `path` by number.
The key of the json entry.
</ParamField>
<ParamField body="path" type="str" default="$">
The path of the array.
The path of the number.
</ParamField>


Expand All @@ -22,12 +22,12 @@ description: Increment the number value stored at `path` by number.

## Response

<ResponseField type="int" required>
<ResponseField type="List[int]" required>
The new value after incrementing
</ResponseField>

<RequestExample>
```py Example
newValue = redis.json.numincrby("key", "$.path.to.array", 2)
newValue = redis.json.numincrby("key", "$.path.to.value", 2)
```
</RequestExample>
6 changes: 3 additions & 3 deletions redis/sdks/py/commands/json/nummultby.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ description: Multiply the number value stored at `path` by number.
The key of the json entry.
</ParamField>
<ParamField body="path" type="str" default="$">
The path of the array.
The path of the number.
</ParamField>


Expand All @@ -22,12 +22,12 @@ description: Multiply the number value stored at `path` by number.

## Response

<ResponseField type="int" required>
<ResponseField type="List[int]" required>
The new value after multiplying
</ResponseField>

<RequestExample>
```py Example
newValue = redis.json.nummultby("key", "$.path.to.array", 2)
newValue = redis.json.nummultby("key", "$.path.to.value", 2)
```
</RequestExample>
4 changes: 2 additions & 2 deletions redis/sdks/py/commands/json/objkeys.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ description: Return the keys in the object that`s referenced by path.
The key of the json entry.
</ParamField>
<ParamField body="path" type="str" default="$">
The path of the array.
The path of the object.
</ParamField>



## Response

<ResponseField type="List[str]" required>
<ResponseField type="List[str[]]" required>
The keys of the object at the path.
</ResponseField>

Expand Down
6 changes: 3 additions & 3 deletions redis/sdks/py/commands/json/objlen.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ description: Report the number of keys in the JSON object at `path` in `key`.
The key of the json entry.
</ParamField>
<ParamField body="path" type="str" default="$">
The path of the array.
The path of the object.
</ParamField>



## Response

<ResponseField type="int[]" required>
The number of in the objects.
<ResponseField type="List[int]" required>
The number of keys in the objects.
</ResponseField>

<RequestExample>
Expand Down
6 changes: 3 additions & 3 deletions redis/sdks/py/commands/json/set.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ description: Set the JSON value at path in key.
The key of the json entry.
</ParamField>
<ParamField body="path" type="str" default="$">
The path of the array.
The path of the value to set.
</ParamField>


Expand All @@ -33,10 +33,10 @@ redis.json.set(key, "$.path", value)

```py NX
value = ...
redis.json.set(key, "$.path", value, { nx:true })
redis.json.set(key, "$.path", value, nx=true)
```
```py XX
value = ...
redis.json.set(key, "$.path", value, { xx:true })
redis.json.set(key, "$.path", value, xx=true)
```
</RequestExample>
8 changes: 4 additions & 4 deletions redis/sdks/py/commands/json/strappend.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ description: Append the json-string values to the string at path.
The key of the json entry.
</ParamField>
<ParamField body="path" type="str" default="$">
The path of the value.
The path of the string.
</ParamField>


Expand All @@ -21,12 +21,12 @@ description: Append the json-string values to the string at path.

## Response

<ResponseField type="int" required>
The length of the array after the appending.
<ResponseField type="List[int]" required>
The length of the string after the appending.
</ResponseField>

<RequestExample>
```py Example
redis.json.strappend("key", "$.path.to.array", "abc")
redis.json.strappend("key", "$.path.to.str", "abc")
```
</RequestExample>
14 changes: 4 additions & 10 deletions redis/sdks/py/commands/json/strlen.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,18 @@ description: Report the length of the JSON String at path in key
The key of the json entry.
</ParamField>
<ParamField body="path" type="str" default="$">
The path of the array.
</ParamField>



<ParamField body="value" type="...TValue[]" required>
One or more values to append to the array.
The path of the string.
</ParamField>


## Response

<ResponseField type="int" required>
The length of the array after the appending.
<ResponseField type="List[int]" required>
The length of the string at the path.
</ResponseField>

<RequestExample>
```py Example
redis.json("key", "$.path.to.array", "a")
redis.json.strlen("key", "$.path.to.str")
```
</RequestExample>
4 changes: 2 additions & 2 deletions redis/sdks/py/commands/json/toggle.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ description: Toggle a boolean value stored at `path`.

## Response

<ResponseField type="boolean" required>
<ResponseField type="List[boolean]" required>
The new value of the boolean.
</ResponseField>

<RequestExample>
```py Example
bool = redis.json.toggle("key", "$.path.to.array")
bool = redis.json.toggle("key", "$.path.to.bool")
```
</RequestExample>
2 changes: 1 addition & 1 deletion redis/sdks/py/commands/json/type.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ description: Report the type of JSON value at `path`.

## Response

<ResponseField type="str | null" required>
<ResponseField type="List[str | null]" required>
The type of the value at `path` or `null` if the value does not exist.
</ResponseField>

Expand Down
2 changes: 1 addition & 1 deletion redis/sdks/ts/commands/json/arrappend.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ To specify a string as an array value to append, wrap the quoted string with an

## Response

<ResponseField type="integer" required>
<ResponseField type="integer[]" required>
The length of the array after the appending.
</ResponseField>

Expand Down
2 changes: 1 addition & 1 deletion redis/sdks/ts/commands/json/arrindex.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ description: Search for the first occurrence of a JSON value in an array.

## Response

<ResponseField type="integer" required>
<ResponseField type="integer[]" required>
The index of the first occurrence of the value in the array, or -1 if not found.
</ResponseField>

Expand Down
2 changes: 1 addition & 1 deletion redis/sdks/ts/commands/json/arrinsert.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ description: Insert the json values into the array at path before the index (shi

## Response

<ResponseField type="integer" required>
<ResponseField type="integer[]" required>
The length of the array after the insertion.
</ResponseField>

Expand Down
2 changes: 1 addition & 1 deletion redis/sdks/ts/commands/json/arrlen.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ description: Report the length of the JSON array at `path` in `key`.

## Response

<ResponseField type="integer" required>
<ResponseField type="integer[]" required>
The length of the array.
</ResponseField>

Expand Down
6 changes: 3 additions & 3 deletions redis/sdks/ts/commands/json/arrpop.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,16 @@ description: Remove and return an element from the index in the array. By defaul

## Response

<ResponseField type="TValue | null" required>
<ResponseField type="(TValue | null)[]" required>
The popped element or null if the array is empty.
</ResponseField>

<RequestExample>
```ts Example
const element = await redis.json("key", "$.path.to.array");
const element = await redis.json.arrpop("key", "$.path.to.array");
```

```ts First
const firstElement = await redis.json("key", "$.path.to.array", 0);
const firstElement = await redis.json.arrpop("key", "$.path.to.array", 0);
```
</RequestExample>
Loading