Can you provide a brief example that reproduces the issue?
When I try building my own example, it appears to work as you describe it
works as expected:
host:~$ irb
irb(main):001> require 'google/protobuf/descriptor_pb'
=> true
irb(main):002>
Google::Protobuf::FieldDescriptorProto.descriptor.lookup("options")
=> #<Google::Protobuf::FieldDescriptor:0x00007ffa48705ab8>
irb(main):003>
Google::Protobuf::FieldDescriptorProto.descriptor.lookup("options").type
=> :message
irb(main):004>
Google::Protobuf::FieldDescriptorProto.descriptor.lookup("options").subtype
=> #<Google::Protobuf::Descriptor:0x00007ffa48862000>
irb(main):005>
Google::Protobuf::FieldDescriptorProto.descriptor.lookup("options").options
=> <Google::Protobuf::FieldOptions: targets: [], edition_defaults: [],
uninterpreted_option: []>
irb(main):006>
Google::Protobuf::FieldDescriptorProto.descriptor.lookup("options").subtype.options
=> <Google::Protobuf::MessageOptions: uninterpreted_option: []>
irb(main):007>
Google::Protobuf::FieldDescriptorProto.descriptor.lookup("options").subtype.options.map_entry
=> false
On Sunday, December 1, 2024 at 6:21:35 PM UTC-5 [email protected] wrote:
> require 'google/protobuf/descriptor_pb'
>
> On Tuesday, November 26, 2024 at 1:20:15 AM UTC-8 Maxime Liron wrote:
>
>> Hey!
>>
>> I'm upgrading my app's google-protobuf ruby gem dep from 3.25.3 to 4.28.2.
>>
>> I had code that would check message descriptors to detect map types. It's
>> now raising.
>>
>> I used to do `descriptor.type == :message &&
>> descriptor.subtype.options.map_entry` to check if a message is a map.
>>
>> Now this raises a rather cryptic `Cannot find MessageOptions in
>> DescriptorPool`.
>> Seems like any call of `.options` on any message descriptor in my
>> codebase raises this error.
>>
>> Any suggestions on how to detect a map now?
>>
>> ```
>> > bundle exec grpc_tools_ruby_protoc --version
>> libprotoc 27.2
>> ```
>>
>
--
You received this message because you are subscribed to the Google Groups
"Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion visit
https://groups.google.com/d/msgid/protobuf/6dc71209-83e6-4851-b315-3373b246d129n%40googlegroups.com.