On Cash we communicate with the web and mobile apps via both protocol buffers and JSON. For both data formats, we use proto2 as a schema language. It defines what our message types are, what their fields are, and gives us a language-neutral place to document all the things. This approach is very lowest-common-denominator: we can't use features that JSON lacks (default values, bytestring values) nor those that proto2 lacks (map types). It’s imperfect but productive!
Google recently released an alpha of proto3, which is very suited to our use case. It sheds features that JSON can't express and adds a map type. This is fantastic.
Here's a sample of proto3 output if you're curious. The code generated by the alpha looks & works like the code from proto2.
- Source: person.proto
- proto3: Person.java, PersonOrBuilder.java, PersonOuterClass.java
- proto2: Person.java, PersonOrBuilder.java, PersonOuterClass.java
- Wire: Person.java
I think the Wire generated code is still the best API for most projects. We'll add support for proto3 once the syntax & feature set is final.