Skip to content
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

support oneof values #10

Open
GeertJohan opened this issue Nov 12, 2015 · 11 comments
Open

support oneof values #10

GeertJohan opened this issue Nov 12, 2015 · 11 comments

Comments

@GeertJohan
Copy link
Contributor

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_ type.

Maybe there's a custom unmarshal function required, or a different work arround (sending the oneof type and value as seperate json?

@awalterschulze
Copy link
Member

No you found a missing feature. Well done :)

@awalterschulze
Copy link
Member

I am on holiday, but I'll be back next week.

@GeertJohan
Copy link
Contributor Author

I'm working on a solution.

@awalterschulze
Copy link
Member

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" notifications@github.com
wrote:

I'm working on a solution.


Reply to this email directly or view it on GitHub
#10 (comment).

@GeertJohan
Copy link
Contributor Author

Not at all. It will require some kind of workarround because json can't be directly marshalled onto protobuf onof fields.

@awalterschulze
Copy link
Member

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.

@GeertJohan GeertJohan changed the title oneof not supported support oneof values Nov 16, 2015
@bobbytables
Copy link

Any status update on this @GeertJohan ? Anything I can help with?

@yangzh
Copy link

yangzh commented Jul 13, 2017

@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!

@awalterschulze
Copy link
Member

There is no progress on this, but a contribution would be more than welcome.

@tulequ
Copy link

tulequ commented Jul 2, 2018

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)

@awalterschulze
Copy link
Member

I think a lot of this was made just before jsonpb became popular.
Does everything else keep on working?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants