Skip to content

Support proto3 optional with grpc_tools_node_protoc_plugin #2083

@mmatheson

Description

@mmatheson

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 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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions