a2aproject / a2aproject/a2a-python

[Task]: Replace deprecated `FieldDescriptor.label` with `is_repeated` in `proto_utils`

Đang mở
#1,011 3 bình luận 1 reaction 0 người được giao Xem trên GitHub
maintainers-only
Ngôn ngữ chính
Python
Star
2.1k
Fork
496
Merge trung bình
4 ngày 17 giờ
Pull request đã merge (30 ngày)
12

Mô tả

## Summary
`src/a2a/utils/proto_utils.py` currently uses the deprecated `FieldDescriptor.label` property to check whether a protobuf field is repeated. The non-deprecated alternative is `FieldDescriptor.is_repeated`, but adopting it requires a newer minimum version of `protobuf` than we currently declare, which would be a breaking change for downstream consumers.

## Locations
All occurrences are in `src/a2a/utils/proto_utils.py`:
- `src/a2a/utils/proto_utils.py:177` — `_populate_message_from_params` (or similar)
- `src/a2a/utils/proto_utils.py:211` — `_check_required_field_violation`
- `src/a2a/utils/proto_utils.py:252` — `_recurse_validation`
Each site is marked with a `TODO` comment referencing this issue.

## Proposed change
1. Bump the minimum required `protobuf` version in `pyproject.toml` to one that exposes `FieldDescriptor.is_repeated` as a stable, non-deprecated API.
2. Replace all `field.label == FieldDescriptor.LABEL_REPEATED` checks with `field.is_repeated`.
3. Replace all `field.label != FieldDescriptor.LABEL_REPEATED` checks with `not field.is_repeated`.
4. Remove the `TODO` comments and unused `LABEL_REPEATED` import if no longer needed.
5. Schedule the change as part of the next breaking release.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.