Skip to content

oneof fields are not read from the client correctly #396

@jasonmreding

Description

@jasonmreding

Using the following proto file:

syntax = "proto3";

package oneof;

service EchoOneofService {
  rpc EchoOneof(EchoOneofRequest) returns(EchoOneofResponse);
}

message AttributeValue
{
  oneof attribute
  {
    bool bool_value = 1;
    int32 integer_value = 2;
    double double_value = 3;
    string string_value = 4;
  }
}

message EchoOneofRequest {
 AttributeValue attribute = 1;
}

message EchoOneofResponse {
 AttributeValue attribute = 1;
}

generate a client and a server. Modify the server to just pass back the same data as it received from the client. Create a client that sets one of the fields comprising the oneof and then invoke the EchoOneof RPC. If you step into the generated LV code around the RPC and probe the class wire, you'll see the index and data are updated appropriately for the class in the request data. However, the index field for the class in the response isn't set even though the one of field has the appropriate data value. The flat->rich conversion then reassigns a default class value since the index is 0 rather than the appropriate index for the field number. I suspect the C++ client code is failing to assign the index based on the last set field value on the wire. This might also be related to #343?

AB#2936036

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions