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
35import "google/protobuf/any.proto";
36import "google/protobuf/duration.proto";
37import "google/protobuf/field_mask.proto";
38import "google/protobuf/struct.proto";
39import "google/protobuf/timestamp.proto";
40import "google/protobuf/wrappers.proto";
41import "google/protobuf/unittest.proto";
42
43option java_package = "com.google.protobuf.util";
44option java_outer_classname = "JsonFormatProto3";
45
46enum EnumType {
47  FOO = 0;
48  BAR = 1;
49}
50
51message MessageType {
52  int32 value = 1;
53}
54
55message TestMessage {
56  bool bool_value = 1;
57  int32 int32_value = 2;
58  int64 int64_value = 3;
59  uint32 uint32_value = 4;
60  uint64 uint64_value = 5;
61  float float_value = 6;
62  double double_value = 7;
63  string string_value = 8;
64  bytes bytes_value = 9;
65  EnumType enum_value = 10;
66  MessageType message_value = 11;
67
68  repeated bool repeated_bool_value = 21;
69  repeated int32 repeated_int32_value = 22;
70  repeated int64 repeated_int64_value = 23;
71  repeated uint32 repeated_uint32_value = 24;
72  repeated uint64 repeated_uint64_value = 25;
73  repeated float repeated_float_value = 26;
74  repeated double repeated_double_value = 27;
75  repeated string repeated_string_value = 28;
76  repeated bytes repeated_bytes_value = 29;
77  repeated EnumType repeated_enum_value = 30;
78  repeated MessageType repeated_message_value = 31;
79}
80
81message TestOneof {
82  // In JSON format oneof fields behave mostly the same as optional
83  // fields except that:
84  //   1. Oneof fields have field presence information and will be
85  //      printed if it's set no matter whether it's the default value.
86  //   2. Multiple oneof fields in the same oneof cannot appear at the
87  //      same time in the input.
88  oneof oneof_value {
89    int32 oneof_int32_value = 1;
90    string oneof_string_value = 2;
91    bytes oneof_bytes_value = 3;
92    EnumType oneof_enum_value = 4;
93    MessageType oneof_message_value = 5;
94    google.protobuf.NullValue oneof_null_value = 6;
95  }
96}
97
98message TestMap {
99  map<bool, int32> bool_map = 1;
100  map<int32, int32> int32_map = 2;
101  map<int64, int32> int64_map = 3;
102  map<uint32, int32> uint32_map = 4;
103  map<uint64, int32> uint64_map = 5;
104  map<string, int32> string_map = 6;
105}
106
107message TestNestedMap {
108  map<bool, int32> bool_map = 1;
109  map<int32, int32> int32_map = 2;
110  map<int64, int32> int64_map = 3;
111  map<uint32, int32> uint32_map = 4;
112  map<uint64, int32> uint64_map = 5;
113  map<string, int32> string_map = 6;
114  map<string, TestNestedMap> map_map = 7;
115}
116
117message TestStringMap {
118  map<string, string> string_map = 1;
119}
120
121message TestWrapper {
122  google.protobuf.BoolValue bool_value = 1;
123  google.protobuf.Int32Value int32_value = 2;
124  google.protobuf.Int64Value int64_value = 3;
125  google.protobuf.UInt32Value uint32_value = 4;
126  google.protobuf.UInt64Value uint64_value = 5;
127  google.protobuf.FloatValue float_value = 6;
128  google.protobuf.DoubleValue double_value = 7;
129  google.protobuf.StringValue string_value = 8;
130  google.protobuf.BytesValue bytes_value = 9;
131
132  repeated google.protobuf.BoolValue repeated_bool_value = 11;
133  repeated google.protobuf.Int32Value repeated_int32_value = 12;
134  repeated google.protobuf.Int64Value repeated_int64_value = 13;
135  repeated google.protobuf.UInt32Value repeated_uint32_value = 14;
136  repeated google.protobuf.UInt64Value repeated_uint64_value = 15;
137  repeated google.protobuf.FloatValue repeated_float_value = 16;
138  repeated google.protobuf.DoubleValue repeated_double_value = 17;
139  repeated google.protobuf.StringValue repeated_string_value = 18;
140  repeated google.protobuf.BytesValue repeated_bytes_value = 19;
141}
142
143message TestTimestamp {
144  google.protobuf.Timestamp value = 1;
145  repeated google.protobuf.Timestamp repeated_value = 2;
146}
147
148message TestDuration {
149  google.protobuf.Duration value = 1;
150  repeated google.protobuf.Duration repeated_value = 2;
151}
152
153message TestFieldMask {
154  google.protobuf.FieldMask value = 1;
155}
156
157message TestStruct {
158  google.protobuf.Struct value = 1;
159  repeated google.protobuf.Struct repeated_value = 2;
160}
161
162message TestAny {
163  google.protobuf.Any value = 1;
164  repeated google.protobuf.Any repeated_value = 2;
165}
166
167message TestValue {
168  google.protobuf.Value value = 1;
169  repeated google.protobuf.Value repeated_value = 2;
170}
171
172message TestListValue {
173  google.protobuf.ListValue value = 1;
174  repeated google.protobuf.ListValue repeated_value = 2;
175}
176
177message TestBoolValue {
178  bool bool_value = 1;
179  map<bool, int32> bool_map = 2;
180}
181
182message TestCustomJsonName {
183  int32 value = 1 [json_name = "@value"];
184}
185
186message TestExtensions {
187  .protobuf_unittest.TestAllExtensions extensions = 1;
188}
189
190message TestEnumValue {
191  EnumType enum_value1 = 1;
192  EnumType enum_value2 = 2;
193  EnumType enum_value3 = 3;
194}
195