-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Aggregate option syntax not supported #95
Comments
Interesting, never heard of that. Can you provide me with a link? |
Just above this link: |
Hi, Is there any progress in this? The aggregate syntax is also described here, at the bottom of the custom options section: |
/bump has any progress been made on this? |
Just thought I could do it and gave it a try, but I then realized that this is one of the edges where the initial custom design bites back. The internal workings of ProtoBuf.js do not rely on any descriptors to be present and thus it just parses any options "as is". In this exact case however, there is no way to know whether an option is repeated or something. I am sure it can be done "somehow", but that old parser code gives me headaches. |
Works now: optional string desc3 = 4 [(foo_options) = { opt1: 123 opt2: "baz" }]; Parses now, but exposes just the last array-option element: optional string desc4 = 5 [(foo_options) = {options { opt1: 1234 opt2: "baz" } options { opt1: 4321 opt2: "foo" }} ]; |
The latter now also works, but as ProtoBuf.js doesn't know what exactly is repeated, it just converts duplicate options to arrays. The result is: {
"(foo_options).options.opt1": [1234, 4321],
"(foo_options).options.opt2": ["baz", "foo"]
} |
awesome! 👍 |
This doesn't seem to work with options defined in imported files, not under Proto3 at least. I can whip up a sample tomorrow if you'd like, just thought I'd comment now. :) |
Closing this for now. Feel free to send a pull request if this is still a requirement. |
According official protobuf documentation, options can be written in aggregate syntax, so repeated field in option's message can be supported:
Official protobuf parser implemented text format parser and use it in aggregate option syntax parsing.
The text was updated successfully, but these errors were encountered: