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

oneof fields are not read from the client correctly #396

Open
jasonmreding opened this issue Nov 19, 2024 · 1 comment
Open

oneof fields are not read from the client correctly #396

jasonmreding opened this issue Nov 19, 2024 · 1 comment
Labels
type: bug Something isn't working

Comments

@jasonmreding
Copy link
Collaborator

jasonmreding commented Nov 19, 2024

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

@nischalks
Copy link
Collaborator

@jasonmreding let us know incase you have a fix, we can group a bunch of bugs together and make a release for you. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants