Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions src/a2a/utils/proto_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,10 @@ def parse_params(params: QueryParams, message: ProtobufMessage) -> None:
field = fields[k]
v_list = params.getlist(k)

if field.label == field.LABEL_REPEATED:
# TODO(https://github.com/a2aproject/a2a-python/issues/1011): Replace
# deprecated `field.label` with `field.is_repeated` once the minimum
# protobuf version requirement is bumped.
if field.label == FieldDescriptor.LABEL_REPEATED:
accumulated: list[Any] = []
for v in v_list:
if not v:
Expand Down Expand Up @@ -208,7 +211,10 @@ def _check_required_field_violation(
) -> ValidationDetail | None:
"""Check if a required field is missing or invalid."""
val = getattr(msg, field.name)
if field.is_repeated:
# TODO(https://github.com/a2aproject/a2a-python/issues/1011): Replace
# deprecated `field.label` with `field.is_repeated` once the minimum
# protobuf version requirement is bumped.
if field.label == FieldDescriptor.LABEL_REPEATED:
if not val:
return ValidationDetail(
field=field.name,
Expand Down Expand Up @@ -249,7 +255,10 @@ def _recurse_validation(
return errors

val = getattr(msg, field.name)
if not field.is_repeated:
# TODO(https://github.com/a2aproject/a2a-python/issues/1011): Replace
# deprecated `field.label` with `field.is_repeated` once the minimum
# protobuf version requirement is bumped.
if field.label != FieldDescriptor.LABEL_REPEATED:
if msg.HasField(field.name):
sub_errs = _validate_proto_required_fields_internal(val)
_append_nested_errors(errors, field.name, sub_errs)
Expand Down
Loading