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 \
33
33
--use-one-literal-as-default \
34
34
--class-name A2A \
35
35
--use-standard-collections \
36
- --use-subclass-enum
36
+ --use-subclass-enum \
37
+ --snake-case-field \
38
+ --no-alias
39
+
37
40
38
41
echo " Codegen finished successfully."
Original file line number Diff line number Diff line change 1
1
"""A2A Pydantic Base Model with shared configuration."""
2
2
3
+ from typing import Any
4
+
3
5
from pydantic import BaseModel , ConfigDict
4
- from pydantic .alias_generators import to_snake
6
+ from pydantic .alias_generators import to_camel , to_snake
5
7
6
8
7
9
class A2ABaseModel (BaseModel ):
8
10
"""Base model for all A2A types with shared configuration."""
9
11
10
12
model_config = ConfigDict (
11
- alias_generator = to_snake ,
13
+ alias_generator = to_camel ,
12
14
populate_by_name = True ,
13
- arbitrary_types_allowed = True ,
15
+ frozen = True ,
14
16
)
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