protobuf-validator
Validates objects against protocol buffer schemas
Motivation
Even if you don't use the binary serialization format, Protocol Buffer IDL is still a nice data modeling language, allowing you to define messages with typed fields, required/optional constraints, etc. This module allows you to validate JavaScript objects against protobuf schemas, which is useful if you have a JSON API but need to validate user submitted objects, for example.
Example
Assuming you have a file called models.proto
:
message Person { required string name = 0; optional int32 age = 1;}
var validate = 'models.proto'; // valid; // throws "Person.name must be a valid string value";
License
MIT