0

I'm seeing one piece of code like the following:

rpc SayFallback (FooRequest) returns (FooResponse) { option (com.example.proto.options.bar) = { value : "{ message:\"baz\" }"; }; }

and another like the following:

rpc SayFallback (FooRequest) returns (FooResponse) { option (com.example.proto.options.bar) = { value : "{ message:\"baz\" }" }; }

The first has a ; on the line with value while the second doesn't. Are either OK according to the standard?

Noel Yap
  • 18,822
  • 21
  • 92
  • 144

1 Answers1

1

Yes, they are considered optional. See the protobuf file source snippet:

  while (!TryConsumeEndOfDeclaration("}", NULL)) {
    if (AtEnd()) {
      AddError("Reached end of input in method options (missing '}').");
      return false;
    }

    if (TryConsumeEndOfDeclaration(";", NULL)) {
      // empty statement; ignore
    } else {
      ...
  }
Carl Mastrangelo
  • 5,970
  • 1
  • 28
  • 37