-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathbench.proto
More file actions
96 lines (77 loc) · 3.38 KB
/
Copy pathbench.proto
File metadata and controls
96 lines (77 loc) · 3.38 KB
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
// Copyright 2023-2026 Buf Technologies, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package bench.v1;
import "buf/validate/validate.proto";
message BenchScalar {
int32 x = 1 [(buf.validate.field).int32.gt = 0];
}
message BenchRepeatedScalar {
repeated int32 x = 1 [(buf.validate.field).repeated.max_items = 10];
}
message BenchRepeatedMessage {
repeated BenchScalar x = 1 [(buf.validate.field).repeated.max_items = 10];
}
message BenchRepeatedScalarUnique {
repeated float x = 1 [(buf.validate.field).repeated.unique = true];
}
message BenchRepeatedBytesUnique {
repeated bytes x = 1 [(buf.validate.field).repeated.unique = true];
}
// Map validation benchmark.
message BenchMap {
map<string, string> entries = 1 [(buf.validate.field).map.min_pairs = 1];
}
// Complex schema benchmark.
message BenchComplexSchema {
string s1 = 1 [(buf.validate.field).string.min_len = 1];
string s2 = 2 [(buf.validate.field).string.max_len = 100];
int32 i32 = 3 [(buf.validate.field).int32.gt = 0];
int64 i64 = 4 [(buf.validate.field).int64.lt = 1000];
uint32 u32 = 5 [(buf.validate.field).uint32.gte = 1];
uint64 u64 = 6 [(buf.validate.field).uint64.lte = 1000];
sint32 si32 = 7 [(buf.validate.field).sint32.gt = 0];
sint64 si64 = 8 [(buf.validate.field).sint64.lt = 1000];
fixed32 f32 = 9 [(buf.validate.field).fixed32.gte = 1];
fixed64 f64 = 10 [(buf.validate.field).fixed64.lte = 1000];
sfixed32 sf32 = 11 [(buf.validate.field).sfixed32.gt = 0];
sfixed64 sf64 = 12 [(buf.validate.field).sfixed64.lt = 1000];
float fl = 13 [(buf.validate.field).float.finite = true];
double db = 14 [(buf.validate.field).double.finite = true];
bool bl = 15;
bytes by = 16 [(buf.validate.field).bytes.min_len = 1];
BenchScalar nested = 17;
BenchComplexSchema self_ref = 18;
repeated string rep_str = 19 [(buf.validate.field).repeated.max_items = 10];
repeated int32 rep_i32 = 20 [(buf.validate.field).repeated.min_items = 1];
repeated bytes rep_bytes = 21 [(buf.validate.field).repeated.unique = true];
repeated BenchScalar rep_msg = 22 [(buf.validate.field).repeated.max_items = 5];
map<string, string> map_str_str = 23 [(buf.validate.field).map.min_pairs = 1];
map<int32, int64> map_i32_i64 = 24 [(buf.validate.field).map.max_pairs = 10];
map<uint64, bool> map_u64_bool = 25;
map<string, bytes> map_str_bytes = 26 [(buf.validate.field).map.keys = {string: {min_len: 1}}];
map<string, BenchScalar> map_str_msg = 27 [(buf.validate.field).map.values = {required: true}];
map<int64, BenchScalar> map_i64_msg = 28;
BenchEnum enum_field = 29 [(buf.validate.field).enum.defined_only = true];
oneof choice {
string oneof_str = 30 [(buf.validate.field).string.min_len = 1];
int32 oneof_i32 = 31 [(buf.validate.field).int32.gt = 0];
BenchScalar oneof_msg = 32;
}
}
enum BenchEnum {
BENCH_ENUM_UNSPECIFIED = 0;
BENCH_ENUM_ONE = 1;
BENCH_ENUM_TWO = 2;
}