Skip to content

Commit 596e6db

Browse files
authored
Update _base.py
Pydantic v2 中适配字段名和字段别名的方式,原始方式 model_config = ConfigDict( # SEE: https://docs.pydantic.dev/latest/api/config/#pydantic.config.ConfigDict.populate_by_name validate_by_name=True, validate_by_alias=True, serialize_by_alias=True, alias_generator=to_camel_custom, ) 会导致 实例化 AgentCard 方法的时候 报错 pydantic_core._pydantic_core.ValidationError: 2 validation errors for AgentCard defaultInputModes Field required [type=missing, input_value={'name': 'Hello World Age...ed_extended_card': True}, input_type=dict] For further information visit https://errors.pydantic.dev/2.10/v/missing defaultOutputModes
1 parent 1dbe33d commit 596e6db

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

src/a2a/_base.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,6 @@ class A2ABaseModel(BaseModel):
3131

3232
model_config = ConfigDict(
3333
# SEE: https://docs.pydantic.dev/latest/api/config/#pydantic.config.ConfigDict.populate_by_name
34-
validate_by_name=True,
35-
validate_by_alias=True,
36-
serialize_by_alias=True,
34+
populate_by_name=True,
3735
alias_generator=to_camel_custom,
3836
)

0 commit comments

Comments
 (0)