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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
|
package NProtobufJsonTest;
import "google/protobuf/duration.proto";
import "google/protobuf/timestamp.proto";
import "library/cpp/protobuf/json/proto/enum_options.proto";
enum EEnum {
E_0 = 0;
E_1 = 1;
E_2 = 2;
E_3 = 3;
};
enum EJsonEnum {
J_0 = 0 [(json_enum_value)="enum_0"];
J_1 = 1 [(json_enum_value)="enum_1"];
}
message TFlatOptional {
optional int32 I32 = 1;
optional int64 I64 = 2;
optional uint32 UI32 = 3;
optional uint64 UI64 = 4;
optional sint32 SI32 = 5;
optional sint64 SI64 = 6;
optional fixed32 FI32 = 7;
optional fixed64 FI64 = 8;
optional sfixed32 SFI32 = 9;
optional sfixed64 SFI64 = 10;
optional bool Bool = 11;
optional string String = 12;
optional bytes Bytes = 13;
optional EEnum Enum = 14;
optional float Float = 15;
optional double Double = 16;
optional string OneString = 17;
optional string OneTwoString = 18;
optional string ABC = 19;
optional string UserID = 20;
};
message TFlatRequired {
required int32 I32 = 1;
required int64 I64 = 2;
required uint32 UI32 = 3;
required uint64 UI64 = 4;
required sint32 SI32 = 5;
required sint64 SI64 = 6;
required fixed32 FI32 = 7;
required fixed64 FI64 = 8;
required sfixed32 SFI32 = 9;
required sfixed64 SFI64 = 10;
required bool Bool = 11;
required string String = 12;
required bytes Bytes = 13;
required EEnum Enum = 14;
required float Float = 15;
required double Double = 16;
required string OneString = 17;
required string OneTwoString = 18;
required string ABC = 19;
required string UserID = 20;
};
message TFlatRepeated {
repeated int32 I32 = 1;
repeated int64 I64 = 2;
repeated uint32 UI32 = 3;
repeated uint64 UI64 = 4;
repeated sint32 SI32 = 5;
repeated sint64 SI64 = 6;
repeated fixed32 FI32 = 7;
repeated fixed64 FI64 = 8;
repeated sfixed32 SFI32 = 9;
repeated sfixed64 SFI64 = 10;
repeated bool Bool = 11;
repeated string String = 12;
repeated bytes Bytes = 13;
repeated EEnum Enum = 14;
repeated float Float = 15;
repeated double Double = 16;
repeated string OneString = 17;
repeated string OneTwoString = 18;
repeated string ABC = 19;
repeated string UserID = 20;
};
message TFlatDefault {
optional int32 I32 = 1 [default = 132];
optional int64 I64 = 2 [default = 164];
optional uint32 UI32 = 3 [default = 232];
optional uint64 UI64 = 4 [default = 264];
optional sint32 SI32 = 5 [default = 332];
optional sint64 SI64 = 6 [default = 364];
optional fixed32 FI32 = 7 [default = 432];
optional fixed64 FI64 = 8 [default = 464];
optional sfixed32 SFI32 = 9 [default = 532];
optional sfixed64 SFI64 = 10 [default = 564];
optional bool Bool = 11 [default = true];
optional string String = 12 [default = "string"];
optional bytes Bytes = 13 [default = "bytes"];
optional EEnum Enum = 14 [default = E_2];
optional float Float = 15 [default = 0.123];
optional double Double = 16 [default = 0.456];
optional string OneString = 17 [default = "string"];
optional string OneTwoString = 18 [default = "string"];
optional string ABC = 19 [default = "abc"];
optional string UserID = 20 [default = "some_id"];
};
message TFlatOneOfDefault {
oneof Choice {
string ChoiceOne = 1 [default = "one"];
string ChoiceTwo = 2 [default = "two"];
}
}
message TCompositeOptional {
optional TFlatOptional Part = 1;
};
message TCompositeRequired {
required TFlatRequired Part = 1;
};
message TCompositeRepeated {
repeated TFlatOptional Part = 1;
};
message TMapType {
map<string, string> Items = 1;
};
message TNameGeneratorType {
optional int32 Field = 1;
};
message TEnumValueGeneratorType {
enum EEnum {
ENUM_42 = 1;
};
optional EEnum Enum = 1;
};
message TComplexMapType {
map<int32, int32> I32 = 1;
map<int64, int64> I64 = 2;
map<uint32, uint32> UI32 = 3;
map<uint64, uint64> UI64 = 4;
map<sint32, sint32> SI32 = 5;
map<sint64, sint64> SI64 = 6;
map<fixed32, fixed32> FI32 = 7;
map<fixed64, fixed64> FI64 = 8;
map<sfixed32, sfixed32> SFI32 = 9;
map<sfixed64, sfixed64> SFI64 = 10;
map<bool, bool> Bool = 11;
map<string, string> String = 12;
map<string, EEnum> Enum = 13;
map<string, float> Float = 14;
map<string, double> Double = 15;
map<string, TComplexMapType> Nested = 16;
};
message TWithJsonName {
optional int32 my_upper = 1 [json_name = "My-Upper"];
optional int32 My_lower = 2 [json_name = "my-lower"];
optional int32 Def_upper = 3; // json_name = "DefUpper"
optional int32 def_lower = 4; // json_name = "defLower"
}
message TSingleRequiredString {
required string String = 1;
}
message TSingleDefaultString {
optional string String = 1 [default = "value"];
}
message TSingleRepeatedString {
repeated string RepeatedString = 1;
}
message TSingleRepeatedInt {
repeated int32 RepeatedInt = 1;
}
message TSingleDuration {
required google.protobuf.Duration Duration = 1;
}
message TSingleTimestamp {
required google.protobuf.Timestamp Timestamp = 1;
}
message TExtensionField {
extensions 100 to 199;
}
message TCustomJsonEnumValue {
optional EJsonEnum JsonEnum = 1 [json_name="json_enum"];
}
extend TExtensionField {
optional int32 bar = 123;
}
|