forked from bufbuild/protoc-gen-validate
-
Notifications
You must be signed in to change notification settings - Fork 0
/
oneofs.proto
43 lines (36 loc) · 1.11 KB
/
oneofs.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
32
33
34
35
36
37
38
39
40
41
42
43
syntax = "proto3";
package tests.harness.cases;
option go_package = "github.com/envoyproxy/protoc-gen-validate/tests/harness/cases/go;cases";
import "validate/validate.proto";
message TestOneOfMsg {
bool val = 1 [(validate.rules).bool.const = true];
}
message OneOfNone {
oneof o {
string x = 1;
int32 y = 2;
}
}
message OneOf {
oneof o {
string x = 1 [(validate.rules).string.prefix = "foo"];
int32 y = 2 [(validate.rules).int32.gt = 0];
TestOneOfMsg z = 3;
}
}
message OneOfRequired {
oneof o {
option (validate.required) = true;
string x = 1;
int32 y = 2;
int32 name_with_underscores = 3;
int32 under_and_1_number = 4;
}
}
message OneOfIgnoreEmpty {
oneof o {
string x = 1 [(validate.rules).string = {ignore_empty: true, min_len: 3, max_len: 5}];
bytes y = 2 [(validate.rules).bytes = {ignore_empty: true, min_len: 3, max_len: 5}];
int32 z = 3 [(validate.rules).int32 = {lte: 128, gte: 256, ignore_empty: true}];
}
}