1// Go support for Protocol Buffers - Google's data interchange format
2//
3// Copyright 2015 The Go Authors.  All rights reserved.
4// https://github.com/golang/protobuf
5//
6// Redistribution and use in source and binary forms, with or without
7// modification, are permitted provided that the following conditions are
8// met:
9//
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
15// distribution.
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.
19//
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.
31
32syntax = "proto2";
33
34import "google/protobuf/any.proto";
35import "google/protobuf/duration.proto";
36import "google/protobuf/struct.proto";
37import "google/protobuf/timestamp.proto";
38import "google/protobuf/wrappers.proto";
39
40package jsonpb;
41
42import weak "gogoproto/gogo.proto";
43
44// Test message for holding primitive types.
45message Simple {
46  optional bool o_bool = 1;
47  optional int32 o_int32 = 2;
48  optional int64 o_int64 = 3;
49  optional uint32 o_uint32 = 4;
50  optional uint64 o_uint64 = 5;
51  optional sint32 o_sint32 = 6;
52  optional sint64 o_sint64 = 7;
53  optional float o_float = 8;
54  optional double o_double = 9;
55  optional string o_string = 10;
56  optional bytes o_bytes = 11;
57  optional bytes o_cast_bytes = 12 [(gogoproto.casttype) = "Bytes"];
58}
59
60// Test message for holding repeated primitives.
61message Repeats {
62  repeated bool r_bool = 1;
63  repeated int32 r_int32 = 2;
64  repeated int64 r_int64 = 3;
65  repeated uint32 r_uint32 = 4;
66  repeated uint64 r_uint64 = 5;
67  repeated sint32 r_sint32 = 6;
68  repeated sint64 r_sint64 = 7;
69  repeated float r_float = 8;
70  repeated double r_double = 9;
71  repeated string r_string = 10;
72  repeated bytes r_bytes = 11;
73}
74
75// Test message for holding enums and nested messages.
76message Widget {
77  enum Color {
78    RED = 0;
79    GREEN = 1;
80    BLUE = 2;
81  };
82  optional Color color = 1;
83  repeated Color r_color = 2;
84
85  optional Simple simple = 10;
86  repeated Simple r_simple = 11;
87
88  optional Repeats repeats = 20;
89  repeated Repeats r_repeats = 21;
90}
91
92message Maps {
93  map<int64, string> m_int64_str = 1;
94  map<bool, Simple> m_bool_simple = 2;
95}
96
97message MsgWithOneof {
98  oneof union {
99    string title = 1;
100    int64 salary = 2;
101    string Country = 3;
102    string home_address = 4;
103  }
104}
105
106message Real {
107  optional double value = 1;
108  extensions 100 to max;
109}
110
111extend Real {
112  optional string name = 124;
113}
114
115message Complex {
116  extend Real {
117    optional Complex real_extension = 123;
118  }
119  optional double imaginary = 1;
120  extensions 100 to max;
121}
122
123message KnownTypes {
124  optional google.protobuf.Any an = 14;
125  optional google.protobuf.Duration dur = 1;
126  optional google.protobuf.Struct st = 12;
127  optional google.protobuf.Timestamp ts = 2;
128
129  optional google.protobuf.DoubleValue dbl = 3;
130  optional google.protobuf.FloatValue flt = 4;
131  optional google.protobuf.Int64Value i64 = 5;
132  optional google.protobuf.UInt64Value u64 = 6;
133  optional google.protobuf.Int32Value i32 = 7;
134  optional google.protobuf.UInt32Value u32 = 8;
135  optional google.protobuf.BoolValue bool = 9;
136  optional google.protobuf.StringValue str = 10;
137  optional google.protobuf.BytesValue bytes = 11;
138}
139