njpatel / grpcc

A gRPC cli interface for easy testing against gRPC servers
Other
1.13k stars 75 forks source link

Value of oneof field is always null #34

Open c100k opened 7 years ago

c100k commented 7 years ago

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 commented 7 years ago

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

https://github.com/grpc/grpc/issues/7200 https://github.com/google/protobuf/issues/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 commented 6 years ago

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

yuimo commented 5 years ago

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)" ],