Support proto3 optional with grpc_tools_node_protoc_plugin
- Dominant language
- TypeScript
- Stars
- 4.8k
- Forks
- 716
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 10
Description
### Problem description
I'm using rules_proto_grpc to generate node targets which are consumed by typescript (ts_project from rules_nodejs). rules_proto_grpc uses grpc_tools_node_protoc_plugin from the grpc-tools package to build a js_grpc_node_library. Building a js_grpc_node_library from a file (hello.proto) with an optional field results in the following error message:
```
hello.proto: is a proto3 file that contains optional fields, but code generator protoc-gen-grpc_node_plugin hasn't been updated to support optional fields in proto3. Please ask the owner of this code generator to support proto3 optional.--grpc_node_plugin_out:
```
### Reproduction steps
Use [js_grpc_node_library](https://rules-proto-grpc.com/en/latest/lang/js.html#js-grpc-node-library) to compile a proto with an optional field. For example:
`hello.proto`:
```
syntax = "proto3";
package hello.proto;
message Hello {
optional string greeting = 1;
}
```
`BUILD`:
```
proto_library(
name = "hello_proto",
srcs = glob(["*.proto"]),
)
js_grpc_node_library(
name = "hello_js_grpc",
protos = [":hello_proto"],
)
```
### Environment
- OS: Linux Ubuntu 20.04 amd64
- Node version: 16.12
- Node installation method: bazel rules_nodejs
- grpc-tools@1.11.2 (https://github.com/rules-proto-grpc/rules_proto_grpc/blob/master/js/requirements/package.json#L5)
Contributor guide
Assessment
This issue has not been assessed yet.