fix: replace deprecated FieldDescriptor.label with is_repeated#1039
Open
naveenkumarbaskaran wants to merge 1 commit intoa2aproject:mainfrom
Open
fix: replace deprecated FieldDescriptor.label with is_repeated#1039naveenkumarbaskaran wants to merge 1 commit intoa2aproject:mainfrom
naveenkumarbaskaran wants to merge 1 commit intoa2aproject:mainfrom
Conversation
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
Contributor
There was a problem hiding this comment.
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.
🧪 Code Coverage (vs
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Replaces all three uses of the deprecated
field.label == FieldDescriptor.LABEL_REPEATEDwithfield.is_repeatedinproto_utils.py.Closes #1011
Changes
parse_params()— REST query parameter parsing_check_required_field_violation()— required field validation_recurse_validation()— nested message recursionAll three locations had
TODOcomments referencing #1011. Since the minimum protobuf requirement is already>=5.29.5(whereis_repeatedis available), this cleanup is safe.Testing
This is a 1:1 behavioral replacement —
field.is_repeatedreturnsTrueifffield.label == FieldDescriptor.LABEL_REPEATED. Existing tests intests/utils/test_proto_utils.pycover all three functions.