Protovalidate
The semantic validation library for Protobuf
Protovalidate is the semantic validation library for Protobuf. With standard annotations for common rules and CEL support for custom logic, every component in your stack enforces exactly the same constraintsin Go, JavaScript/TypeScript, Java, Python, or C++.
user.proto
syntax = "proto3";
package acme.user.v1;
import "buf/validate/validate.proto";
message User {
string id = 1 [(buf.validate.field).string.uuid = true];
uint32 age = 2 [(buf.validate.field).uint32.lte = 150]; // We can only hope.
string email = 3 [(buf.validate.field).string.email = true];
string first_name = 4 [(buf.validate.field).string.max_len = 64];
string last_name = 5 [(buf.validate.field).string.max_len = 64];
option (buf.validate.message).cel = {
id: "first_name_requires_last_name"
message: "last_name must be present if first_name is present"
expression: "!has(this.first_name) || has(this.last_name)"
};
} Start validating → Go JavaScript / TypeScript Java Python C++
Get started in minutes
Add a dependency, annotate your schemas, and get bulletproof validation in under 10 minutes.
Get startedEasy integration
Plug validation interceptors into your Connect/gRPC services.
Choose your stack... ConnectRPC + Go gRPC + Go gRPC + Java gRPC + Python
Try it online
Test validation rules, debug CEL expressions, and share code snippets with your team.
Launch playground