Skip to content

[BUG] Library incompatible with protobuf >= 7.34.0 #463

Description

@kxiong0

Description

protobuf v34.0 removed deprecated field FieldDescriptor.label, which is referenced in internal/rules.py

This is causing AttributeError when calling protovalidate.validate(message)

Steps to Reproduce

  1. Install protobuf >= 7.34.0
  2. Run protovalidate.validate(message) on any message

Expected Behavior

protovalidate.validate(message) validates the protobuf message.

Actual Behavior

protovalidate.validate(message) raises an AttributeError

Screenshots/Logs

            if field.message_type.GetOptions().map_entry:
                key_field = field.message_type.fields_by_name["key"]
                value_field = field.message_type.fields_by_name["value"]
                if value_field.type != descriptor.FieldDescriptor.TYPE_MESSAGE:
                    continue
                result.append(MapValMsgRule(self, field, key_field, value_field))
>           elif field.label == descriptor.FieldDescriptor.LABEL_REPEATED:
E           AttributeError: 'google._upb._message.FieldDescriptor' object has no attribute 'label'
pip list | grep proto
protobuf                  7.34.1
protovalidate             1.1.0

Environment

  • Operating System: Linux
  • Version: Ubuntu 22.04
  • Compiler/Toolchain: N/A
  • Protobuf Compiler & Version: libprotoc 25.1
  • Protovalidate Version: 1.1.0

Possible Solution

Migration: Rely on isRepeated and isRequired for cardinality and hasPresence to check for explicit presence tracking in singular fields.

https://protobuf.dev/news/2025-07-14/

Additional Context

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions