forked from bufbuild/protoc-gen-validate
-
Notifications
You must be signed in to change notification settings - Fork 0
/
maps.proto
31 lines (23 loc) · 1.2 KB
/
maps.proto
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
syntax = "proto3";
package tests.harness.cases;
option go_package = "cases";
import "validate/validate.proto";
message MapNone { map<uint32,bool> val = 1; }
message MapMin { map<int32,float> val = 1 [(validate.rules).map.min_pairs = 2]; }
message MapMax { map<int64,double> val = 1 [(validate.rules).map.max_pairs = 3]; }
message MapMinMax { map<string,bool> val = 1 [(validate.rules).map = {min_pairs: 2, max_pairs: 4}]; }
message MapExact { map<uint64,string> val = 1 [(validate.rules).map = {min_pairs: 3, max_pairs: 3}]; }
message MapNoSparse {
map<uint32, Msg> val = 1 [(validate.rules).map.no_sparse = true];
message Msg {}
}
message MapKeys { map<sint64, string> val = 1 [(validate.rules).map.keys.sint64.lt = 0]; }
message MapValues { map<string, string> val = 1 [(validate.rules).map.values.string.min_len = 3]; }
message MapKeysPattern { map<string, string> val = 1 [(validate.rules).map.keys.string.pattern = "(?i)^[a-z0-9]+$"]; }
message MapValuesPattern { map<string, string> val = 1 [(validate.rules).map.values.string.pattern = "(?i)^[a-z0-9]+$"]; }
message MapRecursive {
map<uint32, Msg> val = 1;
message Msg {
string val = 1 [(validate.rules).string.min_len = 3];
}
}