Skip to content

fix: replace deprecated FieldDescriptor.label with is_repeated#1039

Open
naveenkumarbaskaran wants to merge 1 commit intoa2aproject:mainfrom
naveenkumarbaskaran:fix/replace-deprecated-field-label
Open

fix: replace deprecated FieldDescriptor.label with is_repeated#1039
naveenkumarbaskaran wants to merge 1 commit intoa2aproject:mainfrom
naveenkumarbaskaran:fix/replace-deprecated-field-label

Conversation

@naveenkumarbaskaran
Copy link
Copy Markdown

Summary

Replaces all three uses of the deprecated field.label == FieldDescriptor.LABEL_REPEATED with field.is_repeated in proto_utils.py.

Closes #1011

Changes

  • parse_params() — REST query parameter parsing
  • _check_required_field_violation() — required field validation
  • _recurse_validation() — nested message recursion

All three locations had TODO comments referencing #1011. Since the minimum protobuf requirement is already >=5.29.5 (where is_repeated is available), this cleanup is safe.

Testing

This is a 1:1 behavioral replacement — field.is_repeated returns True iff field.label == FieldDescriptor.LABEL_REPEATED. Existing tests in tests/utils/test_proto_utils.py cover all three functions.

Replace all three uses of `field.label == FieldDescriptor.LABEL_REPEATED`
with `field.is_repeated` in proto_utils.py, as tracked in a2aproject#1011.

The `FieldDescriptor.label` property was deprecated in protobuf 4.x.
Since the minimum protobuf requirement is already >=5.29.5 (where
`is_repeated` is available), this cleanup is safe to apply now.

Affected functions:
- `parse_params()` — REST query parameter parsing
- `_check_required_field_violation()` — required field validation
- `_recurse_validation()` — nested message recursion

Closes a2aproject#1011
@naveenkumarbaskaran naveenkumarbaskaran requested a review from a team as a code owner May 2, 2026 16:45
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates src/a2a/utils/proto_utils.py by replacing deprecated field.label checks with the field.is_repeated property for Protobuf field descriptors, effectively resolving several TODO items. I have no feedback to provide.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 2, 2026

🧪 Code Coverage (vs main)

⬇️ Download Full Report

No coverage changes.

Generated by coverage-comment.yml

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

1 participant