Debian Codegraph @

test/proto2pb/test_all_types.proto

raw
1 // LINT: ALLOW_GROUPS
2 syntax = "proto2";
3
4 package google.expr.proto2.test;
5
6 option go_package = "github.com/google/cel-go/test/proto2pb";
7
8 import "google/protobuf/any.proto";
9 import "google/protobuf/duration.proto";
10 import "google/protobuf/struct.proto";
11 import "google/protobuf/timestamp.proto";
12 import "google/protobuf/wrappers.proto";
13
14 // This proto includes every type of field in both singular and repeated
15 // forms.
16 message TestAllTypes {
17 message NestedMessage {
18 // The field name "b" fails to compile in proto1 because it conflicts with
19 // a local variable named "b" in one of the generated methods.
20 // This file needs to compile in proto1 to test backwards-compatibility.
21 optional int32 bb = 1;
22 }
23
24 enum NestedEnum {
25 FOO = 0;
26 BAR = 1;
27 BAZ = 2;
28 }
29
30 // Singular
31 optional int32 single_int32 = 1 [default = -32];
32 optional int64 single_int64 = 2 [default = -64];
33 optional uint32 single_uint32 = 3 [default = 32];
34 optional uint64 single_uint64 = 4 [default = 64];
35 optional sint32 single_sint32 = 5;
36 optional sint64 single_sint64 = 6;
37 optional fixed32 single_fixed32 = 7;
38 optional fixed64 single_fixed64 = 8;
39 optional sfixed32 single_sfixed32 = 9;
40 optional sfixed64 single_sfixed64 = 10;
41 optional float single_float = 11 [default = 3.0];
42 optional double single_double = 12 [default = 6.4];
43 optional bool single_bool = 13 [default = true];
44 optional string single_string = 14 [default = "empty"];
45 optional bytes single_bytes = 15 [default = "none"];
46 optional NestedEnum standalone_enum = 22;
47 optional group NestedGroup = 23 {
48 optional int32 nested_id = 24;
49 optional string nested_name = 25;
50 }
51
52 // Wellknown.
53 optional google.protobuf.Any single_any = 100;
54 optional google.protobuf.Duration single_duration = 101;
55 optional google.protobuf.Timestamp single_timestamp = 102;
56 optional google.protobuf.Struct single_struct = 103;
57 optional google.protobuf.Value single_value = 104;
58 optional google.protobuf.Int64Value single_int64_wrapper = 105;
59 optional google.protobuf.Int32Value single_int32_wrapper = 106;
60 optional google.protobuf.DoubleValue single_double_wrapper = 107;
61 optional google.protobuf.FloatValue single_float_wrapper = 108;
62 optional google.protobuf.UInt64Value single_uint64_wrapper = 109;
63 optional google.protobuf.UInt32Value single_uint32_wrapper = 110;
64 optional google.protobuf.StringValue single_string_wrapper = 111;
65 optional google.protobuf.BoolValue single_bool_wrapper = 112;
66 optional google.protobuf.BytesValue single_bytes_wrapper = 113;
67
68 // Nested messages
69 oneof nested_type {
70 NestedMessage single_nested_message = 18;
71 NestedEnum single_nested_enum = 21 [default = BAR];
72 }
73
74 // Repeated
75 repeated int32 repeated_int32 = 31;
76 repeated int64 repeated_int64 = 32;
77 repeated uint32 repeated_uint32 = 33;
78 repeated uint64 repeated_uint64 = 34;
79 repeated sint32 repeated_sint32 = 35;
80 repeated sint64 repeated_sint64 = 36;
81 repeated fixed32 repeated_fixed32 = 37;
82 repeated fixed64 repeated_fixed64 = 38;
83 repeated sfixed32 repeated_sfixed32 = 39;
84 repeated sfixed64 repeated_sfixed64 = 40;
85 repeated float repeated_float = 41;
86 repeated double repeated_double = 42;
87 repeated bool repeated_bool = 43;
88 repeated string repeated_string = 44;
89 repeated bytes repeated_bytes = 45;
90
91 repeated NestedMessage repeated_nested_message = 48;
92
93 repeated NestedEnum repeated_nested_enum = 51;
94
95 repeated string repeated_string_piece = 54 [ctype = STRING_PIECE];
96 repeated string repeated_cord = 55 [ctype = CORD];
97
98 repeated NestedMessage repeated_lazy_message = 57;
99
100 // Map
101 map<string, string> map_string_string = 58;
102 map<int64, NestedTestAllTypes> map_int64_nested_type = 59;
103 }
104
105 // This proto includes a recursively nested message.
106 message NestedTestAllTypes {
107 optional NestedTestAllTypes child = 1;
108 optional TestAllTypes payload = 2;
109 }
110
111 // This proto is used to show how extensions are tracked as fields
112 // with fully qualified names.
113 message ExampleType {
114 optional string name = 1;
115 optional int64 in = 2;
116 extensions 100 to max;
117 }
118
119 // Message scoped extensions.
120 message ExtendedExampleType {
121 extend ExampleType {
122 repeated string extended_examples = 103;
123 optional GlobalEnum enum_ext = 104;
124 }
125 }
126
127 // This proto tests that global enums are resolved correctly.
128 enum GlobalEnum {
129 GOO = 0;
130 GAR = 1;
131 GAZ = 2;
132 }
133