1 // Go support for Protocol Buffers - Google's data interchange format
3 // Copyright 2010 The Go Authors. All rights reserved.
4 // https://github.com/golang/protobuf
6 // Redistribution and use in source and binary forms, with or without
7 // modification, are permitted provided that the following conditions are
10 // * Redistributions of source code must retain the above copyright
11 // notice, this list of conditions and the following disclaimer.
12 // * Redistributions in binary form must reproduce the above
13 // copyright notice, this list of conditions and the following disclaimer
14 // in the documentation and/or other materials provided with the
16 // * Neither the name of Google Inc. nor the names of its
17 // contributors may be used to endorse or promote products derived from
18 // this software without specific prior written permission.
20 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34 // This package holds interesting messages.
35 package my.test; // dotted package name
38 import "multi/multi1.proto"; // unused import
41 // deliberately skipping 0
46 // This enum represents days of the week.
48 option allow_alias = true;
52 LUNDI = 1; // same value as MONDAY
55 // This is a message that might be sent somewhere.
62 repeated int64 key = 1;
63 // optional imp.ImportedMessage imported_message = 2;
64 optional Color hue = 3; // no default
65 optional HatType hat = 4 [default=FEDORA];
66 // optional imp.ImportedMessage.Owner owner = 6;
67 optional float deadline = 7 [default=inf];
68 optional group SomeGroup = 8 {
69 optional int32 group_field = 9;
72 // These foreign types are in imp2.proto,
73 // which is publicly imported by imp.proto.
74 // optional imp.PubliclyImportedMessage pub = 10;
75 // optional imp.PubliclyImportedEnum pub_enum = 13 [default=HAIR];
78 // This is a map field. It will generate map[int32]string.
79 map<int32, string> name_mapping = 14;
80 // This is a map field whose value type is a message.
81 map<sint64, Reply> msg_mapping = 15;
83 optional int32 reset = 12;
84 // This field should not conflict with any getters.
85 optional string get_key = 16;
90 required int64 key_that_needs_1234camel_CasIng = 1;
91 optional int64 value = 2 [default=7];
92 optional int64 _my_field_name_2 = 3;
98 repeated Entry found = 1;
99 repeated int32 compact_keys = 2 [packed=true];
100 extensions 100 to max;
104 optional string name = 1;
105 extensions 100 to max;
108 message ReplyExtensions {
110 optional double time = 101;
111 optional ReplyExtensions carrot = 105;
114 optional ReplyExtensions donut = 101;
118 message OtherReplyExtensions {
119 optional int32 key = 1;
122 // top-level extension
124 optional string tag = 103;
125 optional OtherReplyExtensions donut = 106;
126 // optional imp.ImportedMessage elephant = 107; // extend with message from another file.
130 // Extensions will be encoded in MessageSet wire format.
131 option message_set_wire_format = true;
132 extensions 100 to max;
136 optional bool make_me_cry = 1;
138 // This is a oneof, called "union".
147 sint32 delta = 12; // name will conflict with Delta below
149 group SomeGroup = 14 {
150 optional string member = 15;