-
Notifications
You must be signed in to change notification settings - Fork 16
Extension fields appear to be ignored #103
Copy link
Copy link
Open
Description
It appears that extension fields are not parsed/emitted even though they are part of the underlying FDSet. This appears to be the case both for direct extensions and message extensions (which is where I first ran into this)
To replicate:
foo.proto
syntax = "proto2";
message Foo {
required int32 foo = 1;
extensions 100 to 199;
}
message BazExt {
optional int32 baz = 1;
}
extend Foo {
optional int32 bar = 125;
optional BazExt baz_ext = 126;
}foo.message
foo: 1
[bar]: 2
[baz_ext] {
baz: 3
}
reproduce
$ protoc -I . foo.proto --encode=Foo < foo.message | protoc --decode_raw
1: 1
125: 2
126 {
1: 3
}
$ protoc -I . foo.proto --encode=Foo < foo.message | protoc -I . foo.proto --decode=Foo
foo: 1
[bar]: 2
[baz_ext] {
baz: 3
}
$ protoc -I . foo.proto -o foo.fdset
$ PROTOC_INCLUDE="$PB_FDSET_DIR" pq --protofile "$PB_FDSET_DIR/descriptor.proto" --msgtype google.protobuf.FileDescriptorSet < foo.fdset | jq -c '.file[].extension[]'
{"name":"bar","extendee":".Foo","number":125,"label":"LABEL_OPTIONAL","type":"TYPE_INT32","type_name":null,"default_value":null,"options":null,"oneof_index":null,"json_name":"bar","proto3_optional":null}
{"name":"baz_ext","extendee":".Foo","number":126,"label":"LABEL_OPTIONAL","type":"TYPE_MESSAGE","type_name":".BazExt","default_value":null,"options":null,"oneof_index":null,"json_name":"bazExt","proto3_optional":null}
$ pq --fdsetfile foo.fdset --msgtype Foo < <(protoc -I . foo.proto --encode=Foo < foo.message)
{
"foo": 1
}Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels