Skip to content

Commit 4de6e4e

Browse files
committed
Replace deprecated schema retrieval with Pydantic's TypeAdapter for improved compatibility and functionality
1 parent 1e1a8d9 commit 4de6e4e

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/iop/_utils.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import importlib
99
import json
1010
from iop._message import _Message, _PydanticMessage
11-
from dc_schema import get_schema
11+
from pydantic import TypeAdapter
1212

1313
class _Utils():
1414
@staticmethod
@@ -46,7 +46,8 @@ def register_message_schema(cls):
4646
if issubclass(cls,_PydanticMessage):
4747
schema = cls.model_json_schema()
4848
elif issubclass(cls,_Message):
49-
schema = get_schema(cls)
49+
type_adapter = TypeAdapter(cls)
50+
schema = type_adapter.json_schema()
5051
else:
5152
raise ValueError("The class must be a subclass of _Message or _PydanticMessage")
5253
schema_name = cls.__module__ + '.' + cls.__name__

0 commit comments

Comments
 (0)