We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
According official protobuf documentation, options can be written in aggregate syntax, so repeated field in option's message can be supported:
See also: https://developers.google.com/protocol-buffers/docs/proto#customoptions
syntax = "proto3"; import "google/protobuf/descriptor.proto"; message FooOption { optional int32 opt1 = 1; optional string opt2 = 2; } message FooOptions { repeated FooOption options = 1; } extend google.protobuf.FieldOptions { optional FooOptions foo_options = 1234; } // usage: message Bar { // alternative aggregate syntax (uses TextFormat): int32 b = 2 [(foo_options) = { opt1: 123, opt2: "baz" }]; }
package main import ( "os" "github.com/emicklei/proto" ) func main() { reader, _ := os.Open("test.proto") defer reader.Close() parser := proto.NewParser(reader) definition, _ := parser.Parse() formatter := proto.NewFormatter(os.Stdout, " ") formatter.Format(definition) }
syntax = "proto3"; import "google/protobuf/descriptor.proto"; message FooOption { optional int32 opt1 = 1; optional string opt2 = 2; } message FooOptions { repeated FooOption options = 1; } extend google.protobuf.FieldOptions { optional FooOptions foo_options = 1234; }
The text was updated successfully, but these errors were encountered:
thank you for reporting this and providing a test example.
Sorry, something went wrong.
fix Issue #8, aggregate option syntax case
c27dc4d
No branches or pull requests
According official protobuf documentation, options can be written in aggregate syntax, so repeated field in option's message can be supported:
See also: https://developers.google.com/protocol-buffers/docs/proto#customoptions
Input (test.proto)
TestCode
Output
The text was updated successfully, but these errors were encountered: