letmegrpc
letmegrpc copied to clipboard
support oneof values
It looks like oneof is not supported. The JSON doesn't seem to be marshalled onto the oneof structure correctly. The oneof is ofcourse defined as interface field using the is
Maybe there's a custom unmarshal function required, or a different work arround (sending the oneof type and value as seperate json?
No you found a missing feature. Well done :)
I am on holiday, but I'll be back next week.
I'm working on a solution.
sorry about the code quality. I would really appreciate a pull request, but I would also totally understand if you find that the code is to horrible to edit. good luck On Nov 13, 2015 5:32 PM, "Geert-Johan Riemer" [email protected] wrote:
I'm working on a solution.
— Reply to this email directly or view it on GitHub https://github.com/gogo/letmegrpc/issues/10#issuecomment-156464607.
Not at all. It will require some kind of workarround because json can't be directly marshalled onto protobuf onof fields.
proto3 supports json as one of its serialization formats and proto3 has oneof, so we should check how the jsonpb package serializes oneof fields.
It is some of the hackiest code I have written in a while. Also one of my first projects with a significant amount of javascript. Luckily the user doesn't have to write the code so we are also using letmgerpc for about 4 guis at the moment. oneof would be a great additional feature.
Any status update on this @GeertJohan ? Anything I can help with?
@awalterschulze gogoproto /letmegrpc are both great and I'm really enjoying them.
Hey, I happened to hit this very bug in my project, and came to this bug report. Is there any progress for this? it would be great if this can be resolved soon. Thanks!
There is no progress on this, but a contribution would be more than welcome.
I don't know, why don't just use jsonpb for Unmarshal it?
I just try replace err := json.Unmarshal([]byte(jsonString), msg)
into err := jsonpb.UnmarshalString(jsonString, msg)
and it just work fine (in my usecase)
I think a lot of this was made just before jsonpb became popular. Does everything else keep on working?