Skip to content

Commit 02a590e

Browse files
committed
Change datamodel-codegen to use snake_case
1 parent 1fbf600 commit 02a590e

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

scripts/generate_types.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ uv run datamodel-codegen \
2222
--input-file-type jsonschema \
2323
--output "$GENERATED_FILE" \
2424
--target-python-version 3.10 \
25-
--output-model-type pydantic_v2.BaseModel \
25+
--base-class a2a.utils.pydantic_base.A2ABaseModel \
2626
--disable-timestamp \
2727
--use-schema-description \
2828
--use-union-operator \
@@ -32,6 +32,7 @@ uv run datamodel-codegen \
3232
--use-one-literal-as-default \
3333
--class-name A2A \
3434
--use-standard-collections \
35-
--use-subclass-enum
35+
--use-subclass-enum \
36+
--snake-case-field
3637

3738
echo "Codegen finished successfully."

src/a2a/utils/pydantic_base.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
"""A2A Pydantic Base Model with shared configuration."""
2+
3+
from pydantic import BaseModel, ConfigDict
4+
5+
6+
class A2ABaseModel(BaseModel):
7+
"""Base model for all A2A types with shared configuration."""
8+
9+
model_config = ConfigDict(
10+
populate_by_name=True,
11+
arbitrary_types_allowed=True,
12+
)

0 commit comments

Comments
 (0)