ts-proto icon indicating copy to clipboard operation
ts-proto copied to clipboard

The structure in the generated type file does not match the structure of the response

Open NikitaSharapov opened this issue 3 years ago • 2 comments

I am trying to send NullValue My ts file looks like this:

export interface FullBootRecord {
  kind?:
    | { $case: "empty"; empty: NullValue }
    | { $case: "data"; data: BootRecordWithTarget };
}

It is generated from proto:

message FullBootRecord {
    oneof kind {
        google.protobuf.NullValue empty = 1;
        BootRecordWithTarget data = 2;
    }
}

I am waiting to receive an answer:

 {kind: { $case: "empty"; empty: 0 }}

or

 {kind : { $case: "data"; data: {path: "/home/se/cache/ex.dat"} }

But I am getting the answer:

{kind: "empty", empty: "NullValue"}}

Platform: nestjs 8.0.0 Node: 14.17.1

You have thoughts on this matter? Thanks

NikitaSharapov avatar Aug 25 '21 19:08 NikitaSharapov

I made minimal reproduction repository, so you can see the problem and run your tests.

https://github.com/NikitaSharapov/grpc-problem

NikitaSharapov avatar Aug 26 '21 11:08 NikitaSharapov

@stephenh Do you know anything about that?

DenisVASI9 avatar Aug 27 '21 10:08 DenisVASI9