-
Notifications
You must be signed in to change notification settings - Fork 806
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
NULL deserialization of Oneof when using GRPC #238
Comments
It would be great if you could reproduce this without grpc? |
My initial tests seem to work fine. I'll add in pieces that are being used outside of GRPC (WKT, annotations..) to a test repo to reflect the production case I ran into as I go and reach out when I find something. Haven't looked into grpc's proto marshaling, but I'm assuming the use "github.com/golang/protobuf/proto". Here's a repo w/ the tests https://github.com/buckhx/gogo-test |
wow nice effort. Thank you. Give me a few minutes. |
I just cloned it and ran the test and it is passing, is this intended? |
Also note I just merge alot of updates from golang/protobuf |
Yeah those tests passed, but it's not an exact replica of my environment in
the project that is getting the nulls so I'll add in a few more things and
see if they break these tests.
Also I'll try your updates and see if I'm still getting nulls in my other
project.
The only funky thing I noticed in these tests is that the json
serialization is CamelCase on the oneofs and lower_snake on the other
fields.
…On Sat, Dec 10, 2016, 1:26 PM Walter Schulze ***@***.***> wrote:
Also note I just merge alot of updates from golang/protobuf
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#238 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AATNZx_K41kGZUgtw12Fjn32wH_S-NE1ks5rGu7GgaJpZM4LINox>
.
|
Ok wait I think I am seeing a problem in your code. |
Also this might be interesting for you, since you are using grpc and json |
Good call on the jsonpb. I was just using it for debugging, but will be using grpc-gateway so that's a good data point. I pulled out the json parts to avoid an red herrings. The tests now break in https://github.com/buckhx/gogo-test w/ what I am seeing in my original grpc project. Using "github.com/golang/protobuf/proto" w/ a gogo proto that includes a oneof seems to be the issue. Not sure if there's a mechanism that can be hooked into to pick the serializer for grpc as was suggested in the jsonpb thread or not. Here's the test log using "github.com/golang/protobuf/proto"
|
grpc has a WithCodec method that might be useful when used with this You are not supposed to serialize a gogoprotobuf generated proto message with golang/protobuf. Except when using gogoproto_import=false, because then the generated code will still using the golang/protobuf library. |
I assume my answer fixed this issue, otherwise please reopen |
A message with a oneof is not properly serializing using GRPC.
Here's an example of the a json-encoded message payload before it is written and then after is is read. I encountered this having a client send a message to a GRPC method and the oneof be null on the server.
I'm sure this could be replicated w/out GRPC for easy debugging.
Switching to golang/protobuf has proper oneof serialization
The text was updated successfully, but these errors were encountered: