• 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
31// Protocol Buffers - Google's data interchange format
32// Copyright 2008 Google Inc.  All rights reserved.
33// https://developers.google.com/protocol-buffers/
34//
35// Redistribution and use in source and binary forms, with or without
36// modification, are permitted provided that the following conditions are
37// met:
38//
39//     * Redistributions of source code must retain the above copyright
40// notice, this list of conditions and the following disclaimer.
41//     * Redistributions in binary form must reproduce the above
42// copyright notice, this list of conditions and the following disclaimer
43// in the documentation and/or other materials provided with the
44// distribution.
45//     * Neither the name of Google Inc. nor the names of its
46// contributors may be used to endorse or promote products derived from
47// this software without specific prior written permission.
48//
49// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
50// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
51// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
52// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
53// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
54// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
55// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
56// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
57// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
58// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
59// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
60
61syntax = "proto3";
62
63package json_test;
64
65option java_package = "com.google.protobuf.util";
66option java_outer_classname = "JsonTestProto";
67
68import "google/protobuf/any.proto";
69import "google/protobuf/wrappers.proto";
70import "google/protobuf/timestamp.proto";
71import "google/protobuf/duration.proto";
72import "google/protobuf/field_mask.proto";
73import "google/protobuf/struct.proto";
74
75message TestAllTypes {
76  enum NestedEnum {
77    FOO = 0;
78    BAR = 1;
79    BAZ = 2;
80  }
81  message NestedMessage {
82    int32 value = 1;
83  }
84
85  int32 optional_int32 = 1;
86  int64 optional_int64 = 2;
87  uint32 optional_uint32 = 3;
88  uint64 optional_uint64 = 4;
89  sint32 optional_sint32 = 5;
90  sint64 optional_sint64 = 6;
91  fixed32 optional_fixed32 = 7;
92  fixed64 optional_fixed64 = 8;
93  sfixed32 optional_sfixed32 = 9;
94  sfixed64 optional_sfixed64 = 10;
95  float optional_float = 11;
96  double optional_double = 12;
97  bool optional_bool = 13;
98  string optional_string = 14;
99  bytes optional_bytes = 15;
100  NestedMessage optional_nested_message = 18;
101  NestedEnum optional_nested_enum = 21;
102
103  // Repeated
104  repeated int32 repeated_int32 = 31;
105  repeated int64 repeated_int64 = 32;
106  repeated uint32 repeated_uint32 = 33;
107  repeated uint64 repeated_uint64 = 34;
108  repeated sint32 repeated_sint32 = 35;
109  repeated sint64 repeated_sint64 = 36;
110  repeated fixed32 repeated_fixed32 = 37;
111  repeated fixed64 repeated_fixed64 = 38;
112  repeated sfixed32 repeated_sfixed32 = 39;
113  repeated sfixed64 repeated_sfixed64 = 40;
114  repeated float repeated_float = 41;
115  repeated double repeated_double = 42;
116  repeated bool repeated_bool = 43;
117  repeated string repeated_string = 44;
118  repeated bytes repeated_bytes = 45;
119  repeated NestedMessage repeated_nested_message = 48;
120  repeated NestedEnum repeated_nested_enum = 51;
121}
122
123message TestOneof {
124  oneof oneof_field {
125    int32 oneof_int32 = 1;
126    TestAllTypes.NestedMessage oneof_nested_message = 2;
127  }
128}
129
130message TestMap {
131  // Instead of testing all combinations (too many), we only make sure all
132  // valid types have been used at least in one field as key and in one
133  // field as value.
134  map<int32, int32> int32_to_int32_map = 1;
135  map<int64, int32> int64_to_int32_map = 2;
136  map<uint32, int32> uint32_to_int32_map = 3;
137  map<uint64, int32> uint64_to_int32_map = 4;
138  map<sint32, int32> sint32_to_int32_map = 5;
139  map<sint64, int32> sint64_to_int32_map = 6;
140  map<fixed32, int32> fixed32_to_int32_map = 7;
141  map<fixed64, int32> fixed64_to_int32_map = 8;
142  map<sfixed32, int32> sfixed32_to_int32_map = 9;
143  map<sfixed64, int32> sfixed64_to_int32_map = 10;
144  map<bool, int32> bool_to_int32_map = 11;
145  map<string, int32> string_to_int32_map = 12;
146
147  map<int32, int64> int32_to_int64_map = 101;
148  map<int32, uint32> int32_to_uint32_map = 102;
149  map<int32, uint64> int32_to_uint64_map = 103;
150  map<int32, sint32> int32_to_sint32_map = 104;
151  map<int32, sint64> int32_to_sint64_map = 105;
152  map<int32, fixed32> int32_to_fixed32_map = 106;
153  map<int32, fixed64> int32_to_fixed64_map = 107;
154  map<int32, sfixed32> int32_to_sfixed32_map = 108;
155  map<int32, sfixed64> int32_to_sfixed64_map = 109;
156  map<int32, float> int32_to_float_map = 110;
157  map<int32, double> int32_to_double_map = 111;
158  map<int32, bool> int32_to_bool_map = 112;
159  map<int32, string> int32_to_string_map = 113;
160  map<int32, bytes> int32_to_bytes_map = 114;
161  map<int32, TestAllTypes.NestedMessage> int32_to_message_map = 115;
162  map<int32, TestAllTypes.NestedEnum> int32_to_enum_map = 116;
163}
164
165message TestWrappers {
166  google.protobuf.Int32Value int32_value = 1;
167  google.protobuf.UInt32Value uint32_value = 2;
168  google.protobuf.Int64Value int64_value = 3;
169  google.protobuf.UInt64Value uint64_value = 4;
170  google.protobuf.FloatValue float_value = 5;
171  google.protobuf.DoubleValue double_value = 6;
172  google.protobuf.BoolValue bool_value = 7;
173  google.protobuf.StringValue string_value = 8;
174  google.protobuf.BytesValue bytes_value = 9;
175}
176
177message TestTimestamp {
178  google.protobuf.Timestamp timestamp_value = 1;
179}
180
181message TestDuration {
182  google.protobuf.Duration duration_value = 1;
183}
184
185message TestFieldMask {
186  google.protobuf.FieldMask field_mask_value = 1;
187}
188
189message TestStruct {
190  google.protobuf.Struct struct_value = 1;
191  google.protobuf.Value value = 2;
192  google.protobuf.ListValue list_value = 3;
193}
194
195message TestAny {
196  google.protobuf.Any any_value = 1;
197}
198
199message TestCustomJsonName {
200  int32 value = 1 [json_name = "@value"];
201}
202