{"action":"created","issue":{"url":"https://api.github.com/repos/dcodeIO/ProtoBuf.js/issues/95","labels_url":"https://api.github.com/repos/dcodeIO/ProtoBuf.js/issues/95/labels{/name}","comments_url":"https://api.github.com/repos/dcodeIO/ProtoBuf.js/issues/95/comments","events_url":"https://api.github.com/repos/dcodeIO/ProtoBuf.js/issues/95/events","html_url":"https://github.com/dcodeIO/ProtoBuf.js/issues/95","id":24808081,"number":95,"title":"Aggregate option syntax not supported","user":{"login":"boolking","id":415515,"avatar_url":"https://avatars.githubusercontent.com/u/415515?v=3","gravatar_id":"","url":"https://api.github.com/users/boolking","html_url":"https://github.com/boolking","followers_url":"https://api.github.com/users/boolking/followers","following_url":"https://api.github.com/users/boolking/following{/other_user}","gists_url":"https://api.github.com/users/boolking/gists{/gist_id}","starred_url":"https://api.github.com/users/boolking/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/boolking/subscriptions","organizations_url":"https://api.github.com/users/boolking/orgs","repos_url":"https://api.github.com/users/boolking/repos","events_url":"https://api.github.com/users/boolking/events{/privacy}","received_events_url":"https://api.github.com/users/boolking/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/dcodeIO/ProtoBuf.js/labels/enhancement","name":"enhancement","color":"84b6eb"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":7,"created_at":"2013-12-27T04:47:33Z","updated_at":"2015-07-17T14:15:55Z","closed_at":null,"body":"According official protobuf documentation, options can be written in aggregate syntax, so repeated field in option's message can be supported:\r\n```protobuf\r\nimport \"google/protobuf/descriptor.proto\";\r\n\r\nmessage FooOption {\r\n  optional int32 opt1 = 1;\r\n  optional string opt2 = 2;\r\n}\r\n\r\nmessage FooOptions {\r\n  repeated FooOption options = 1;\r\n}\r\n\r\nextend google.protobuf.FieldOptions {\r\n  optional FooOptions foo_options = 1234;\r\n}\r\n\r\n// usage:\r\nmessage Bar {\r\n  // alternative aggregate syntax (uses TextFormat):\r\n  optional int32 b = 2 \r\n  [(foo_options) = {options { opt1: 1234 opt2: \"baz\" } options { opt1: 4321 opt2: \"foo\" }} ];\r\n}\r\n```\r\nOfficial protobuf parser implemented text format parser and use it in aggregate option syntax parsing."},"comment":{"url":"https://api.github.com/repos/dcodeIO/ProtoBuf.js/issues/comments/122288928","html_url":"https://github.com/dcodeIO/ProtoBuf.js/issues/95#issuecomment-122288928","issue_url":"https://api.github.com/repos/dcodeIO/ProtoBuf.js/issues/95","id":122288928,"user":{"login":"dcodeIO","id":1136893,"avatar_url":"https://avatars.githubusercontent.com/u/1136893?v=3","gravatar_id":"","url":"https://api.github.com/users/dcodeIO","html_url":"https://github.com/dcodeIO","followers_url":"https://api.github.com/users/dcodeIO/followers","following_url":"https://api.github.com/users/dcodeIO/following{/other_user}","gists_url":"https://api.github.com/users/dcodeIO/gists{/gist_id}","starred_url":"https://api.github.com/users/dcodeIO/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dcodeIO/subscriptions","organizations_url":"https://api.github.com/users/dcodeIO/orgs","repos_url":"https://api.github.com/users/dcodeIO/repos","events_url":"https://api.github.com/users/dcodeIO/events{/privacy}","received_events_url":"https://api.github.com/users/dcodeIO/received_events","type":"User","site_admin":false},"created_at":"2015-07-17T14:15:55Z","updated_at":"2015-07-17T14:15:55Z","body":"The later now also works, but as it doesn't know what exactly is repeated, it just converts duplicate options to arrays. The result is:\r\n\r\n```json\r\n{\r\n  \"(foo_options).options.opt1\": [1234, 4321],\r\n  \"(foo_options).options.opt2\": [\"baz\", \"foo\"]\r\n}\r\n```"}}