• 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
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  }
95}
96
97message TestMap {
98  map<bool, int32> bool_map = 1;
99  map<int32, int32> int32_map = 2;
100  map<int64, int32> int64_map = 3;
101  map<uint32, int32> uint32_map = 4;
102  map<uint64, int32> uint64_map = 5;
103  map<string, int32> string_map = 6;
104}
105
106message TestNestedMap {
107  map<bool, int32> bool_map = 1;
108  map<int32, int32> int32_map = 2;
109  map<int64, int32> int64_map = 3;
110  map<uint32, int32> uint32_map = 4;
111  map<uint64, int32> uint64_map = 5;
112  map<string, int32> string_map = 6;
113  map<string, TestNestedMap> map_map = 7;
114}
115
116message TestWrapper {
117  google.protobuf.BoolValue bool_value = 1;
118  google.protobuf.Int32Value int32_value = 2;
119  google.protobuf.Int64Value int64_value = 3;
120  google.protobuf.UInt32Value uint32_value = 4;
121  google.protobuf.UInt64Value uint64_value = 5;
122  google.protobuf.FloatValue float_value = 6;
123  google.protobuf.DoubleValue double_value = 7;
124  google.protobuf.StringValue string_value = 8;
125  google.protobuf.BytesValue bytes_value = 9;
126
127  repeated google.protobuf.BoolValue repeated_bool_value = 11;
128  repeated google.protobuf.Int32Value repeated_int32_value = 12;
129  repeated google.protobuf.Int64Value repeated_int64_value = 13;
130  repeated google.protobuf.UInt32Value repeated_uint32_value = 14;
131  repeated google.protobuf.UInt64Value repeated_uint64_value = 15;
132  repeated google.protobuf.FloatValue repeated_float_value = 16;
133  repeated google.protobuf.DoubleValue repeated_double_value = 17;
134  repeated google.protobuf.StringValue repeated_string_value = 18;
135  repeated google.protobuf.BytesValue repeated_bytes_value = 19;
136}
137
138message TestTimestamp {
139  google.protobuf.Timestamp value = 1;
140  repeated google.protobuf.Timestamp repeated_value = 2;
141}
142
143message TestDuration {
144  google.protobuf.Duration value = 1;
145  repeated google.protobuf.Duration repeated_value = 2;
146}
147
148message TestFieldMask {
149  google.protobuf.FieldMask value = 1;
150}
151
152message TestStruct {
153  google.protobuf.Struct value = 1;
154  repeated google.protobuf.Struct repeated_value = 2;
155}
156
157message TestAny {
158  google.protobuf.Any value = 1;
159  repeated google.protobuf.Any repeated_value = 2;
160}
161
162message TestValue {
163  google.protobuf.Value value = 1;
164  repeated google.protobuf.Value repeated_value = 2;
165}
166
167message TestListValue {
168  google.protobuf.ListValue value = 1;
169  repeated google.protobuf.ListValue repeated_value = 2;
170}
171
172message TestBoolValue {
173  bool bool_value = 1;
174  map<bool, int32> bool_map = 2;
175}
176
177message TestCustomJsonName {
178  int32 value = 1 [json_name = "@value"];
179}
180
181message TestExtensions {
182  .protobuf_unittest.TestAllExtensions extensions = 1;
183}
184
185message TestEnumValue {
186  EnumType enum_value1 = 1;
187  EnumType enum_value2 = 2;
188  EnumType enum_value3 = 3;
189}
190