• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// Protocol Buffers - Google's data interchange format
2// Copyright 2008 Google Inc.  All rights reserved.
3// https://developers.google.com/protocol-buffers/
4//
5// Redistribution and use in source and binary forms, with or without
6// modification, are permitted provided that the following conditions are
7// met:
8//
9//     * Redistributions of source code must retain the above copyright
10// notice, this list of conditions and the following disclaimer.
11//     * Redistributions in binary form must reproduce the above
12// copyright notice, this list of conditions and the following disclaimer
13// in the documentation and/or other materials provided with the
14// distribution.
15//     * Neither the name of Google Inc. nor the names of its
16// contributors may be used to endorse or promote products derived from
17// this software without specific prior written permission.
18//
19// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
31syntax = "proto3";
32
33package proto3;
34
35
36import "google/protobuf/duration.proto";
37import "google/protobuf/timestamp.proto";
38import "google/protobuf/wrappers.proto";
39import "google/protobuf/struct.proto";
40import "google/protobuf/any.proto";
41import "google/protobuf/field_mask.proto";
42import "google/protobuf/unittest.proto";
43
44enum EnumType {
45  FOO = 0;
46  BAR = 1;
47}
48
49message MessageType {
50  int32 value = 1;
51}
52
53message TestMessage {
54  bool bool_value = 1;
55  int32 int32_value = 2;
56  int64 int64_value = 3;
57  uint32 uint32_value = 4;
58  uint64 uint64_value = 5;
59  float float_value = 6;
60  double double_value = 7;
61  string string_value = 8;
62  bytes bytes_value = 9;
63  EnumType enum_value = 10;
64  MessageType message_value = 11;
65
66  repeated bool repeated_bool_value = 21;
67  repeated int32 repeated_int32_value = 22;
68  repeated int64 repeated_int64_value = 23;
69  repeated uint32 repeated_uint32_value = 24;
70  repeated uint64 repeated_uint64_value = 25;
71  repeated float repeated_float_value = 26;
72  repeated double repeated_double_value = 27;
73  repeated string repeated_string_value = 28;
74  repeated bytes repeated_bytes_value = 29;
75  repeated EnumType repeated_enum_value = 30;
76  repeated MessageType repeated_message_value = 31;
77}
78
79message TestOneof {
80  // In JSON format oneof fields behave mostly the same as optional
81  // fields except that:
82  //   1. Oneof fields have field presence information and will be
83  //      printed if it's set no matter whether it's the default value.
84  //   2. Multiple oneof fields in the same oneof cannot appear at the
85  //      same time in the input.
86  oneof oneof_value {
87    int32 oneof_int32_value = 1;
88    string oneof_string_value = 2;
89    bytes oneof_bytes_value = 3;
90    EnumType oneof_enum_value = 4;
91    MessageType oneof_message_value = 5;
92  }
93}
94
95message TestMap {
96  map<bool, int32> bool_map = 1;
97  map<int32, int32> int32_map = 2;
98  map<int64, int32> int64_map = 3;
99  map<uint32, int32> uint32_map = 4;
100  map<uint64, int32> uint64_map = 5;
101  map<string, int32> string_map = 6;
102}
103
104message TestNestedMap {
105  map<bool, int32> bool_map = 1;
106  map<int32, int32> int32_map = 2;
107  map<int64, int32> int64_map = 3;
108  map<uint32, int32> uint32_map = 4;
109  map<uint64, int32> uint64_map = 5;
110  map<string, int32> string_map = 6;
111  map<string, TestNestedMap> map_map = 7;
112}
113
114message TestWrapper {
115  google.protobuf.BoolValue bool_value = 1;
116  google.protobuf.Int32Value int32_value = 2;
117  google.protobuf.Int64Value int64_value = 3;
118  google.protobuf.UInt32Value uint32_value = 4;
119  google.protobuf.UInt64Value uint64_value = 5;
120  google.protobuf.FloatValue float_value = 6;
121  google.protobuf.DoubleValue double_value = 7;
122  google.protobuf.StringValue string_value = 8;
123  google.protobuf.BytesValue bytes_value = 9;
124
125  repeated google.protobuf.BoolValue repeated_bool_value = 11;
126  repeated google.protobuf.Int32Value repeated_int32_value = 12;
127  repeated google.protobuf.Int64Value repeated_int64_value = 13;
128  repeated google.protobuf.UInt32Value repeated_uint32_value = 14;
129  repeated google.protobuf.UInt64Value repeated_uint64_value = 15;
130  repeated google.protobuf.FloatValue repeated_float_value = 16;
131  repeated google.protobuf.DoubleValue repeated_double_value = 17;
132  repeated google.protobuf.StringValue repeated_string_value = 18;
133  repeated google.protobuf.BytesValue repeated_bytes_value = 19;
134}
135
136message TestTimestamp {
137  google.protobuf.Timestamp value = 1;
138  repeated google.protobuf.Timestamp repeated_value = 2;
139}
140
141message TestDuration {
142  google.protobuf.Duration value = 1;
143  repeated google.protobuf.Duration repeated_value = 2;
144}
145
146message TestFieldMask {
147  google.protobuf.FieldMask value = 1;
148}
149
150message TestStruct {
151  google.protobuf.Struct value = 1;
152  repeated google.protobuf.Struct repeated_value = 2;
153}
154
155message TestAny {
156  google.protobuf.Any value = 1;
157  repeated google.protobuf.Any repeated_value = 2;
158}
159
160message TestValue {
161  google.protobuf.Value value = 1;
162  repeated google.protobuf.Value repeated_value = 2;
163}
164
165message TestListValue {
166  google.protobuf.ListValue value = 1;
167  repeated google.protobuf.ListValue repeated_value = 2;
168}
169
170message TestBoolValue {
171  bool bool_value = 1;
172  map<bool, int32> bool_map = 2;
173}
174
175message TestCustomJsonName {
176  int32 value = 1 [json_name = "@value"];
177}
178
179message TestExtensions {
180  .protobuf_unittest.TestAllExtensions extensions = 1;
181}
182