[ Web Proxy ]
URL:
Viewing: https://protovalidate.com [Back]  [Original]

Protovalidate | Protovalidate Skip to content
Docs Playground GitHub
CtrlK
Cancel

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

rocket_launch

Add a dependency, annotate your schemas, and get bulletproof validation in under 10 minutes.

Get started

Easy integration

flash_on

Plug validation interceptors into your Connect/gRPC services.

Choose your stack... ConnectRPC + Go gRPC + Go gRPC + Java gRPC + Python

Try it online

code

Test validation rules, debug CEL expressions, and share code snippets with your team.

Launch playground

Web Proxy Viewer  |  New URL  |  Original Page