File tree Expand file tree Collapse file tree 4 files changed +93
-53
lines changed
Expand file tree Collapse file tree 4 files changed +93
-53
lines changed Original file line number Diff line number Diff line change @@ -33,6 +33,9 @@ uv run datamodel-codegen \
3333 --use-one-literal-as-default \
3434 --class-name A2A \
3535 --use-standard-collections \
36- --use-subclass-enum
36+ --use-subclass-enum \
37+ --snake-case-field \
38+ --no-alias
39+
3740
3841echo " Codegen finished successfully."
Original file line number Diff line number Diff line change 11"""A2A Pydantic Base Model with shared configuration."""
22
3+ from typing import Any
4+
35from pydantic import BaseModel , ConfigDict
4- from pydantic .alias_generators import to_snake
6+ from pydantic .alias_generators import to_camel , to_snake
57
68
79class A2ABaseModel (BaseModel ):
810 """Base model for all A2A types with shared configuration."""
911
1012 model_config = ConfigDict (
11- alias_generator = to_snake ,
13+ alias_generator = to_camel ,
1214 populate_by_name = True ,
13- arbitrary_types_allowed = True ,
15+ frozen = True ,
1416 )
17+
18+ def __getattr__ (self , name : str ) -> Any :
19+ snake = to_snake (name )
20+ if hasattr (self , snake ):
21+ return getattr (self , snake )
22+ raise AttributeError (
23+ f'{ type (self ).__name__ } object has no attribute { name !r} '
24+ )
You can’t perform that action at this time.
0 commit comments