-
Notifications
You must be signed in to change notification settings - Fork 286
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Preserve unknown fields when converting between FileDescriptorProto
and ImageFile
#1855
Preserve unknown fields when converting between FileDescriptorProto
and ImageFile
#1855
Conversation
@@ -455,22 +455,19 @@ func TestBasic(t *testing.T) { | |||
) | |||
diff := cmp.Diff(protoImage, bufimage.ImageToProtoImage(newImage), protocmp.Transform()) | |||
require.Equal(t, "", diff) | |||
// TODO: all of the below proto equality checks should use cmp.Diff |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had to address this TODO because now that the ProtoReflect
method might be called (to query/set unknown fields), the internal, unexported atomicMessageState
pointer field of the message can differ between the two messages being compared (previously, by coincidence, was always nil on both sides).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
approved pending two comments (will likely have to approve again to allow github to merge)
… and `ImageFile` (#1855) This way, if a field is ever added to the descriptors and then serialized by a newer version of `buf`, an older version of `buf` won't mangle it and inadvertently drop those newer fields.
… and `ImageFile` (bufbuild#1855) This way, if a field is ever added to the descriptors and then serialized by a newer version of `buf`, an older version of `buf` won't mangle it and inadvertently drop those newer fields.
This way, if a field is ever added to the descriptors and then serialized by a newer version of
buf
, an older version ofbuf
won't mangle it and inadvertently drop those newer fields.The place in
protodescriptor
is the code path used for converting an image file to a descriptor proto. And the place inbufimage
is for the other direction.