grpc / grpc/grpc-node

Working with google.protobuf.Struct

Open
#1,263 11 comments 2 reactions 0 assignees View on GitHub
package: @grpc/proto-loader
Dominant language
TypeScript
Stars
4.8k
Forks
716
Avg merge
2d 3h
Merged PRs (30d)
10

Description

Hi, I have a gRPC server in Go with the following proto:

```
message Request {
google.protobuf.StringValue Id = 1;
google.protobuf.Struct Filter = 2;
}
```
I am writing a client in Node but I am not sure how to set the `Filter` field. I am using dynamic proto loading.

My imports:
```
const grpc = require('grpc');
const protoLoader = require('@grpc/proto-loader');
require('google-protobuf/google/protobuf/struct_pb');
```
I tried sending Struct field using follwoing ways:
1.
```
var item = new proto.google.protobuf.Struct({
fields: {
Name: {
string_value: 'name'
}
}
});
```
2.
```
const plainObj = { 'Name':'name' };
const item = proto.google.protobuf.Struct.fromJavaScript(plainObj);
```

Both ways did not work. I am receiving empty value on the server.

Thanks

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.