How can i validate the protocol buffer data?

1,666 views
Skip to first unread message

21lo...@gmail.com

unread,
Jul 8, 2008, 10:56:27 AM7/8/08
to Protocol Buffers
How can i validate the protocol buffer data? such as the xsd for the
xml?
eg. 1.only 8 size string
2.e-mail format validate!

Hein

unread,
Jul 8, 2008, 1:23:15 PM7/8/08
to Protocol Buffers
A validation/constraints framework that would make everybody happy
would be Turing complete; therefore protocol buffers don't include it.
It is simple enough to write a bool IsWellFormed(const MyMessage&);
function.

-Hein

Kenton Varda

unread,
Jul 8, 2008, 2:13:50 PM7/8/08
to 21love.ko, Protocol Buffers
2008/7/8 21love.ko <21lo...@gmail.com>:

Sorry, but validation of this sort is not part of protocol buffers.  You'll need to write validation routines separately.  We made a conscious decision not to try to support validation in the .proto language itself because it seemed like it would require a turing-complete language to express arbitrary validators, and we wanted to keep things simple.
Reply all
Reply to author
Forward
0 new messages