You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[Protovalidate][protovalidate] provides standard annotations to validate common rules on messages and fields, as well as the ability to use [CEL][cel] to write custom rules. It's the next generation of [protoc-gen-validate][protoc-gen-validate], the only widely used validation library for Protobuf.
9
+
[Protovalidate][protovalidate]is the semantic validation library for Protobuf. It provides standard annotations to validate common rules on messages and fields, as well as the ability to use [CEL][cel] to write custom rules. It's the next generation of [protoc-gen-validate][protoc-gen-validate].
10
10
11
11
With Protovalidate, you can annotate your Protobuf messages with both standard and custom validation rules:
12
12
13
13
```protobuf
14
14
syntax = "proto3";
15
15
16
-
package banking.v1;
16
+
package acme.user.v1;
17
17
18
18
import "buf/validate/validate.proto";
19
19
20
-
message MoneyTransfer {
21
-
string to_account_id = 1 [
22
-
// Standard rule: `to_account_id` must be a UUID
23
-
(buf.validate.field).string.uuid = true
24
-
];
20
+
message User {
21
+
string id = 1 [(buf.validate.field).string.uuid = true];
22
+
uint32 age = 2 [(buf.validate.field).uint32.lte = 150]; // We can only hope.
0 commit comments