...
1// Copyright 2018 The Go Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style
3// license that can be found in the LICENSE file.
4
5syntax = "proto2";
6
7package goproto.protoc.proto2;
8
9option go_package = "google.golang.org/protobuf/cmd/protoc-gen-go/testdata/proto2";
10
11message FieldTestMessage {
12 optional bool optional_bool = 1;
13 optional Enum optional_enum = 2;
14 optional int32 optional_int32 = 3;
15 optional sint32 optional_sint32 = 4;
16 optional uint32 optional_uint32 = 5;
17 optional int64 optional_int64 = 6;
18 optional sint64 optional_sint64 = 7;
19 optional uint64 optional_uint64 = 8;
20 optional sfixed32 optional_sfixed32 = 9;
21 optional fixed32 optional_fixed32 = 10;
22 optional float optional_float = 11;
23 optional sfixed64 optional_sfixed64 = 12;
24 optional fixed64 optional_fixed64 = 13;
25 optional double optional_double = 14;
26 optional string optional_string = 15;
27 optional bytes optional_bytes = 16;
28 optional Message optional_Message = 17;
29 optional group OptionalGroup = 18 {
30 optional string optional_group = 19;
31 }
32
33 required bool required_bool = 101;
34 required Enum required_enum = 102;
35 required int32 required_int32 = 103;
36 required sint32 required_sint32 = 104;
37 required uint32 required_uint32 = 105;
38 required int64 required_int64 = 106;
39 required sint64 required_sint64 = 107;
40 required uint64 required_uint64 = 108;
41 required sfixed32 required_sfixed32 = 109;
42 required fixed32 required_fixed32 = 110;
43 required float required_float = 111;
44 required sfixed64 required_sfixed64 = 112;
45 required fixed64 required_fixed64 = 113;
46 required double required_double = 114;
47 required string required_string = 115;
48 required bytes required_bytes = 116;
49 required Message required_Message = 117;
50 required group RequiredGroup = 118 {
51 required string required_group = 119;
52 }
53
54 repeated bool repeated_bool = 201;
55 repeated Enum repeated_enum = 202;
56 repeated int32 repeated_int32 = 203;
57 repeated sint32 repeated_sint32 = 204;
58 repeated uint32 repeated_uint32 = 205;
59 repeated int64 repeated_int64 = 206;
60 repeated sint64 repeated_sint64 = 207;
61 repeated uint64 repeated_uint64 = 208;
62 repeated sfixed32 repeated_sfixed32 = 209;
63 repeated fixed32 repeated_fixed32 = 210;
64 repeated float repeated_float = 211;
65 repeated sfixed64 repeated_sfixed64 = 212;
66 repeated fixed64 repeated_fixed64 = 213;
67 repeated double repeated_double = 214;
68 repeated string repeated_string = 215;
69 repeated bytes repeated_bytes = 216;
70 repeated Message repeated_Message = 217;
71 repeated group RepeatedGroup = 218 {
72 repeated string repeated_group = 219;
73 }
74
75 optional bool default_bool = 301 [default=true];
76 optional Enum default_enum = 302 [default=ONE];
77 optional int32 default_int32 = 303 [default=1];
78 optional sint32 default_sint32 = 304 [default=1];
79 optional uint32 default_uint32 = 305 [default=1];
80 optional int64 default_int64 = 306 [default=1];
81 optional sint64 default_sint64 = 307 [default=1];
82 optional uint64 default_uint64 = 308 [default=1];
83 optional sfixed32 default_sfixed32 = 309 [default=1];
84 optional fixed32 default_fixed32 = 310 [default=1];
85 optional float default_float = 311 [default=3.14];
86 optional sfixed64 default_sfixed64 = 312 [default=1];
87 optional fixed64 default_fixed64 = 313 [default=1];
88 optional double default_double = 314 [default=3.1415];
89 optional string default_string = 315 [default="hello,\"world!\"\n"];
90 optional bytes default_bytes = 316 [default="hello,\xde\xad\xbe\xef"];
91
92 optional string default_zero_string = 350 [default=""];
93 optional bytes default_zero_bytes = 351 [default=""];
94
95 optional float default_float_neginf = 400 [default=-inf];
96 optional float default_float_posinf = 401 [default=inf];
97 optional float default_float_nan = 402 [default=nan];
98 optional double default_double_neginf = 403 [default=-inf];
99 optional double default_double_posinf = 404 [default=inf];
100 optional double default_double_nan = 405 [default=nan];
101
102 map<int32, int64> map_int32_int64 = 500;
103 map<string,Message> map_string_message = 501;
104 map<fixed64,Enum> map_fixed64_enum = 502;
105
106 oneof oneof_field {
107 bool oneof_bool = 601;
108 Enum oneof_enum = 602;
109 int32 oneof_int32 = 603;
110 sint32 oneof_sint32 = 604;
111 uint32 oneof_uint32 = 605;
112 int64 oneof_int64 = 606;
113 sint64 oneof_sint64 = 607;
114 uint64 oneof_uint64 = 608;
115 sfixed32 oneof_sfixed32 = 609;
116 fixed32 oneof_fixed32 = 610;
117 float oneof_float = 611;
118 sfixed64 oneof_sfixed64 = 612;
119 fixed64 oneof_fixed64 = 613;
120 double oneof_double = 614;
121 string oneof_string = 615;
122 bytes oneof_bytes = 616;
123 Message oneof_Message = 617;
124 group OneofGroup = 618 {
125 optional string oneof_group_field = 619;
126 }
127 int32 oneof_largest_tag = 536870911;
128 }
129
130 oneof oneof_two {
131 int32 oneof_two_1 = 700;
132 int64 oneof_two_2 = 701;
133 }
134
135 enum Enum {
136 ZERO = 0;
137 ONE = 1;
138 }
139 message Message {}
140
141 reserved 10000, 10001;
142 reserved "TEN_THOUSAND", "TEN_THOUSAND_AND_ONE";
143}
View as plain text