Skip to content
1 change: 1 addition & 0 deletions .github/actions/spelling/allow.txt
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ proto
protobuf
Protobuf
protoc
protocgen
pydantic
pyi
pypistats
Expand Down
3 changes: 2 additions & 1 deletion .jscpd.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"**/src/a2a/grpc/**",
"**/src/a2a/compat/**",
"**/.nox/**",
"**/.venv/**"
"**/.venv/**",
"**/src/a2a/types/*_pydantic.py"
],
"threshold": 3,
"reporters": ["html", "markdown"]
Expand Down
7 changes: 7 additions & 0 deletions buf.gen.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,10 @@ plugins:
# Generates *_pb2.pyi files.
- remote: buf.build/protocolbuffers/pyi
out: src/a2a/types
# Generate Pydantic models with ProtoJSON compatibility
- local: protoc-gen-proto2pydantic
out: src/a2a/types
opt:
- preset=a2a
- base_class=a2a._base.A2ABaseModel
- output_file=a2a_pydantic.py
8 changes: 8 additions & 0 deletions scripts/gen_proto.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
#!/bin/bash
set -e

# Install proto2pydantic plugin for Pydantic model generation
echo "Installing protoc-gen-proto2pydantic@v0.5.2..."
go install github.com/protocgen/proto2pydantic@v0.5.2

# Run buf generate to regenerate protobuf code and OpenAPI spec
npx --yes @bufbuild/buf generate

# Format generated Pydantic models (line-length wrapping for long Field() descriptions)
echo "Formatting generated Pydantic models..."
ruff format src/a2a/types/a2a_pydantic.py

# The OpenAPI generator produces a file named like 'a2a.swagger.json' or similar.
# We need it to be 'a2a.json' for the A2A SDK.
# Find the generated json file in the output directory
Expand Down
Loading
Loading