-
Notifications
You must be signed in to change notification settings - Fork 15.9k
Description
I'm not sure where this documentation is hosted, but the following specifications for the protobuf language:
https://developers.google.com/protocol-buffers/docs/reference/proto2-spec
https://developers.google.com/protocol-buffers/docs/reference/proto3-spec
Are incomplete, they say nothing about the syntax of message literals when used in options. For example, this example from the developer guide for options:
optional int32 b = 2 [(foo_options) = { opt1: 123 opt2: "baz" }];Is, according to the specs referenced above, not valid protobuf syntax, which specifies options as:
option = "option" optionName "=" constant ";"
optionName = ( ident | "(" fullIdent ")" ) { "." ident }
constant = fullIdent | ( [ "-" | "+" ] intLit ) | ( [ "-" | "+" ] floatLit ) | strLit | boolLit
This matters because right now I've encountered a problem in the JavaScript protocol buffers support where it differs in its opinion of what is valid syntax for message literals in options from protoc, but where does the bug lie? In protoc, or in the JavaScript protobuf parser? And even if we establish which one the bug lies in, what is the correct behavior? Without a spec that specifies what the correct syntax is, neither has a bug, and there's no way to resolve it because there's no correct behavior defined.