SandroGrzicic / ScalaBuff

the scala protocol buffers (protobuf) compiler
Other
219 stars 80 forks source link

Fix generating JSON from all-empty, all-optionals #89

Closed silverbeak closed 9 years ago

silverbeak commented 10 years ago

If a buf contains only optionals (ie, the fields are all Options) AND all those fields are empty, the resulting JSON object will be malformed. Since nothing is printed in the object, the opening bracket will be eaten by the [sb.length -= 1]. This hopefully fixes that. (I noticed that I accidentally ran my cleanup script on this file too, hence the removed braces and semicolons. The important change of course is on line 397. Sorry about that...)

SandroGrzicic commented 9 years ago

Seems OK - there's no need to apologize for removing semicolons. Thanks!