You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would expect to retrieve the value of the custom_settings with the following code:
hint := proto.GetExtension(fd.Options(), E_Hint).(Hint)
where fd is the protoreflect.FieldDescriptor for the field.
This works fine for regular non-map fields (either scalar or message field), but doesn't seem to work for maps.
and I tried to use fd or fd.MapKey() or fd.MapValue(), but still no luck there.
What did you expect to see?
Retrieve the expected custom options, in above case, HINT_RED.
What did you see instead?
HINT_UNKNOWN
Make sure you include information that can help us debug (full error message, exception listing, stack trace, logs).
Anything else we should know about your project / environment?
The text was updated successfully, but these errors were encountered:
What version of protobuf and what language are you using?
The latest release of Go package of "google.golang.org/protobuf/proto" and related packages
What did you do?
I was trying to use custom options to augment behavior, and this doesn't seem to work for map fields.
For example, in my .proto file:
`
enum Hint {
HINT_UNKNOWN = 0;
HINT_RED = 1;
HINT_BLUE = 2;
}
message SomeMessage {
map<uint32, string> attrs = 1 [(hint)=HINT_RED];
}
`
I would expect to retrieve the value of the custom_settings with the following code:
hint := proto.GetExtension(fd.Options(), E_Hint).(Hint)
where fd is the
protoreflect.FieldDescriptor
for the field.This works fine for regular non-map fields (either scalar or message field), but doesn't seem to work for maps.
and I tried to use
fd
orfd.MapKey()
orfd.MapValue()
, but still no luck there.What did you expect to see?
Retrieve the expected custom options, in above case, HINT_RED.
What did you see instead?
HINT_UNKNOWN
Make sure you include information that can help us debug (full error message, exception listing, stack trace, logs).
Anything else we should know about your project / environment?
The text was updated successfully, but these errors were encountered: