have there been any changes to the canonical syntax for option?

瀏覽次數:52 次
跳到第一則未讀訊息

Jeffory Orrok

未讀,
2021年3月23日 下午4:02:112021/3/23
收件者:Protocol Buffers
Is this URL still the official language specification for proto3?

I am encountering several projects that have multi-line, non-quoted text on the rhs of option assignments, sort of resembling what you would see as an object literal in JavaScript (not JSON, as the keys aren't quoted), but sometimes (not always) with semicolons instead of commas, or sometimes, no separator other than a newline, which is supposedly forbidden in a strLit.  I have even seen this in some Google .proto files, and it is vexing me to no end.

For instance, here's a little snippet from googleapis/google/api/http.proto
service Messaging {
  rpc UpdateMessage(Message) returns (Message) {
    option (google.api.http) = {
      patch: "/v1/messages/{message_id}"
      body: "*"
    };
  }
}

The protobufjs parser, pbjs, is usually unhappy with the semicolons, when it's not simply silently failing, but for whatever reason does not complain about the lack of quotes or the newlines.  Before I die on this hill, can anyone refer me to a spec addendum that I should know about?

Thanks

Jeff

Adam Cozzette

未讀,
2021年3月24日 中午12:23:482021/3/24
收件者:Jeffory Orrok、Protocol Buffers
I think for better or worse, "what protoc implements" takes precedence over whatever the spec says. The spec came later and as far as I know we have not put a lot of effort into ensuring that it comprehensively matches the format that protoc expects. I believe the syntax you are looking at is missing from the .proto file format spec but is mentioned here as the "aggregate syntax."

--
You received this message because you are subscribed to the Google Groups "Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to protobuf+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/protobuf/18955ff8-1578-4877-a41f-dafcc5721dd8n%40googlegroups.com.
回覆所有人
回覆作者
轉寄
0 則新訊息