Skip to content

Commit 28cb73c

Browse files
authored
Merge branch 'main' into ishymko/improve-linter-ci
2 parents 4f94991 + 7d197db commit 28cb73c

1 file changed

Lines changed: 12 additions & 3 deletions

File tree

src/a2a/utils/proto_utils.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,10 @@ def parse_params(params: QueryParams, message: ProtobufMessage) -> None:
174174
field = fields[k]
175175
v_list = params.getlist(k)
176176

177-
if field.label == field.LABEL_REPEATED:
177+
# TODO(https://github.com/a2aproject/a2a-python/issues/1011): Replace
178+
# deprecated `field.label` with `field.is_repeated` once the minimum
179+
# protobuf version requirement is bumped.
180+
if field.label == FieldDescriptor.LABEL_REPEATED:
178181
accumulated: list[Any] = []
179182
for v in v_list:
180183
if not v:
@@ -208,7 +211,10 @@ def _check_required_field_violation(
208211
) -> ValidationDetail | None:
209212
"""Check if a required field is missing or invalid."""
210213
val = getattr(msg, field.name)
211-
if field.is_repeated:
214+
# TODO(https://github.com/a2aproject/a2a-python/issues/1011): Replace
215+
# deprecated `field.label` with `field.is_repeated` once the minimum
216+
# protobuf version requirement is bumped.
217+
if field.label == FieldDescriptor.LABEL_REPEATED:
212218
if not val:
213219
return ValidationDetail(
214220
field=field.name,
@@ -249,7 +255,10 @@ def _recurse_validation(
249255
return errors
250256

251257
val = getattr(msg, field.name)
252-
if not field.is_repeated:
258+
# TODO(https://github.com/a2aproject/a2a-python/issues/1011): Replace
259+
# deprecated `field.label` with `field.is_repeated` once the minimum
260+
# protobuf version requirement is bumped.
261+
if field.label != FieldDescriptor.LABEL_REPEATED:
253262
if msg.HasField(field.name):
254263
sub_errs = _validate_proto_required_fields_internal(val)
255264
_append_nested_errors(errors, field.name, sub_errs)

0 commit comments

Comments
 (0)