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

Value of oneof field is always null #34

Open
c100k opened this issue Jul 15, 2017 · 3 comments
Open

Value of oneof field is always null #34

c100k opened this issue Jul 15, 2017 · 3 comments

Comments

@c100k
Copy link

c100k commented Jul 15, 2017

Hi,

There is a display bug with the oneof fields. Even if one of the values is set, it always displays null.

Example :

message Message1 {
    string name = 1;
    oneof example {
        Type1 value1 = 8;
        Type2 value2 = 9;
    }
}

Output :

{
  "name": "Dexter",
  "example": null
}
@njpatel
Copy link
Owner

njpatel commented Oct 20, 2017

Tried it locally, definitely an issue, but I think it's something to do with protobuf.js rather than grpcc:

grpc/grpc#7200
protocolbuffers/protobuf#1741

Both those bugs are closed but it's still broken even if I update all the deps. I'll need to take a deeper look.

@chabmed
Copy link

chabmed commented Jun 12, 2018

Hi, any update on this subject? I use oneof in my proto but I always get null.
Thanks

@yuimo
Copy link

yuimo commented Apr 18, 2019

how could i shield null items in the response of grpcc? thanks
the result below is my response, how could i retain the non-null values only?
"requireKeywordsWithIndex": {
"age": "",
"backgrounds": [],
"directions": [],
"experiences": [],
"certs": [],
"workYears": [],
"companyTypes": [],
"gender": [],
"industries": [],
"locations": [],
"majors": [],
"maritialStatus": [],
"salary": [],
"schoolTypes": [],
"stability": [],
"targetCompany": [],
"degrees": [],
"degreeOthers": [],
"intentType": [],
"skills": [
"2.0年以上java编程(0)"
],

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

4 participants