We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 702616f commit c1b6360Copy full SHA for c1b6360
1 file changed
src/a2a/types.py
@@ -6,7 +6,7 @@
6
from enum import Enum
7
from typing import Any, Literal
8
9
-from pydantic import Field, RootModel, field_validator
+from pydantic import Field, RootModel, field_validator, model_validator
10
11
from a2a._base import A2ABaseModel
12
@@ -1338,6 +1338,13 @@ class Part(RootModel[TextPart | FilePart | DataPart]):
1338
be text, a file, or structured data.
1339
"""
1340
1341
+ @model_validator(mode='before')
1342
+ @classmethod
1343
+ def validate_kind_present(cls, data: Any) -> Any:
1344
+ if isinstance(data, dict) and 'kind' not in data:
1345
+ raise ValueError("Message part must have a 'kind' field")
1346
+ return data
1347
+
1348
1349
class SetTaskPushNotificationConfigRequest(A2ABaseModel):
1350
0 commit comments