Hi Protobufs team, I am currently using json-schema to verify my data in a REST+JSON network protocol. Obviously, protobufs is better. The .proto definitions are more clear, it's easier to maintain over time, and the code-gen from .proto files reduces boilerplate greatly.
However, the json-schema has one advantage that I sorely miss, which is basic data validation rules for the contents of individual fields. I frequently use the string pattern match, int min/max value, and min/max count on arrays. I've created an issue of the feature request (https://github.com/google/protobuf/issues/3600) and an example in Go that demonstrates the kind of boilerplate validation code that lacking these features makes a developer have to write themselves: https://github.com/jaybennett89/protox-go-example. It really wouldn't be hard to have the generated Marshal/Unmarshal code automatically apply data validation rules, once a decent way of expressing them in the .proto file is agreed upon. I'm wondering, how do Google developers maintain these business rules in gRPC/Protobufs servers? For example, a maxItems 100 rule in a repeating field. Or a regex pattern match on a string field to ensure it complies with the format of some internal RFC. I think this feature would be simple and widely used. Protobufs implements almost all the same rules as json-schema, except these kind of rules. -- You received this message because you are subscribed to the Google Groups "Protocol Buffers" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/protobuf. For more options, visit https://groups.google.com/d/optout.
