-
Notifications
You must be signed in to change notification settings - Fork 419
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
WIP: Recognize the AllowPartial flag when parsing Any #49
WIP: Recognize the AllowPartial flag when parsing Any #49
Conversation
We were not passing down and honoring the AllowPartial flag when parsing anypb.Any.
@@ -176,7 +176,7 @@ func (d decoder) unmarshalAny(m protoreflect.Message) error { | |||
// Use another decoder to parse the unread bytes for @type field. This | |||
// avoids advancing a read from current decoder because the current JSON | |||
// object may contain the fields of the embedded type. | |||
dec := decoder{d.Clone(), UnmarshalOptions{RecursionLimit: d.opts.RecursionLimit}} | |||
dec := decoder{d.Clone(), UnmarshalOptions{RecursionLimit: d.opts.RecursionLimit, AllowPartial: d.opts.AllowPartial}} |
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.
Not sure if I should also plumb through DiscardUnknown (or maybe all the options?). Those are the two options that cloud.google.com/go passes today: e.g. https://github.com/googleapis/google-cloud-go/blob/b23a08492a7724ce6f1f95395b7f71feb9b3de66/ai/generativelanguage/apiv1beta/generative_client.go#L600
Related issue in older proto lib is golang/protobuf#1620 |
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.
Thank you for your interest into contributing to this project.
Unfortunately this project does not accept GitHub pull requests as the source-of-truth for this project is hosted at https://go.googlesource.com/protobuf. This project page on GitHub is a mirror of that other repository.
If you would like to contribute to this project, please follow the contribution guidelines for instructions on how to send a change. If the change you'd like to make is more substantial or introduces any new features, then it should first be discussed on the issue tracker.
wantMessage: func() proto.Message { | ||
return &anypb.Any{ | ||
TypeUrl: "type.googleapis.com/google.protobuf.Empty", | ||
} | ||
}(), |
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.
This function wrapping is unnecessary. Since the function doesn’t do anything other than return an anypb.Any
composite literal.
Thank you @puellanivis - I commented on the related issue golang/protobuf#1620 (comment) and opened a CL in https://go-review.git.corp.google.com/c/protobuf/+/617516 Thank you also to @chressie for the pointers this morning! I'm going to close this PR. |
We were not passing down and honoring the AllowPartial flag when parsing anypb.Any.