Skip to content

Commit 9301fa3

Browse files
authored
Merge pull request #44 from redis/pydantic_error
fixed JsonType checking
2 parents 9f5f5be + a00a1e1 commit 9301fa3

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

src/tools/json.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,18 @@
1-
from redis.commands.json._util import JsonType
1+
from typing import Union, Mapping, List, TYPE_CHECKING, Any
22
from redis.exceptions import RedisError
33

44
from src.common.connection import RedisConnectionManager
55
from src.common.server import mcp
66

7+
# Define JsonType for type checking to match redis-py definition
8+
if TYPE_CHECKING:
9+
JsonType = Union[
10+
str, int, float, bool, None, Mapping[str, "JsonType"], List["JsonType"]
11+
]
12+
else:
13+
# Use Any at runtime to avoid Pydantic issues with recursive types
14+
JsonType = Any
15+
716

817
@mcp.tool()
918
async def json_set(

src/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "0.3.0"
1+
__version__ = "0.3.0.alpha"

0 commit comments

Comments
 (0)