protobufjs 4.1.2 → 5.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.travis.yml +3 -1
- package/README.md +147 -25
- package/bin/pbjs +2 -2
- package/bower.json +3 -3
- package/cli/pbjs/targets/amd.js +1 -1
- package/cli/pbjs/targets/json.js +9 -1
- package/cli/pbjs/targets/proto.js +48 -24
- package/cli/pbjs/util.js +1 -1
- package/cli/pbjs.js +9 -2
- package/dist/README.md +10 -10
- package/dist/{ProtoBuf-light.js → protobuf-light.js} +207 -152
- package/dist/protobuf-light.min.js +94 -0
- package/dist/protobuf-light.min.js.gz +0 -0
- package/dist/protobuf-light.min.map +8 -0
- package/dist/{ProtoBuf.js → protobuf.js} +265 -175
- package/dist/protobuf.min.js +116 -0
- package/dist/protobuf.min.js.gz +0 -0
- package/dist/protobuf.min.map +8 -0
- package/docs/ProtoBuf.Builder.Message.html +1473 -967
- package/docs/ProtoBuf.Builder.Service.html +266 -197
- package/docs/ProtoBuf.Builder.html +758 -542
- package/docs/ProtoBuf.DotProto.Parser.html +223 -161
- package/docs/ProtoBuf.DotProto.Tokenizer.html +344 -248
- package/docs/ProtoBuf.DotProto.html +20 -12
- package/docs/ProtoBuf.Element.html +554 -554
- package/docs/ProtoBuf.Map.html +158 -123
- package/docs/ProtoBuf.Reflect.Element.html +286 -143
- package/docs/ProtoBuf.Reflect.Enum.Value.html +329 -228
- package/docs/ProtoBuf.Reflect.Enum.html +757 -537
- package/docs/ProtoBuf.Reflect.Extension.html +73 -56
- package/docs/ProtoBuf.Reflect.Message.ExtensionField.html +1013 -740
- package/docs/ProtoBuf.Reflect.Message.Field.html +926 -649
- package/docs/ProtoBuf.Reflect.Message.OneOf.html +327 -245
- package/docs/ProtoBuf.Reflect.Message.html +919 -652
- package/docs/ProtoBuf.Reflect.Namespace.html +648 -447
- package/docs/ProtoBuf.Reflect.Service.Method.html +363 -251
- package/docs/ProtoBuf.Reflect.Service.RPCMethod.html +545 -397
- package/docs/ProtoBuf.Reflect.Service.html +721 -511
- package/docs/ProtoBuf.Reflect.T.html +268 -197
- package/docs/ProtoBuf.Reflect.html +20 -12
- package/docs/ProtoBuf.Util.html +169 -118
- package/docs/ProtoBuf.html +840 -628
- package/docs/ProtoBuf.js.html +271 -180
- package/docs/fonts/OpenSans-Bold-webfont.eot +0 -0
- package/docs/fonts/OpenSans-Bold-webfont.svg +1830 -0
- package/docs/fonts/OpenSans-Bold-webfont.woff +0 -0
- package/docs/fonts/OpenSans-BoldItalic-webfont.eot +0 -0
- package/docs/fonts/OpenSans-BoldItalic-webfont.svg +1830 -0
- package/docs/fonts/OpenSans-BoldItalic-webfont.woff +0 -0
- package/docs/fonts/OpenSans-Italic-webfont.eot +0 -0
- package/docs/fonts/OpenSans-Italic-webfont.svg +1830 -0
- package/docs/fonts/OpenSans-Italic-webfont.woff +0 -0
- package/docs/fonts/OpenSans-Light-webfont.eot +0 -0
- package/docs/fonts/OpenSans-Light-webfont.svg +1831 -0
- package/docs/fonts/OpenSans-Light-webfont.woff +0 -0
- package/docs/fonts/OpenSans-LightItalic-webfont.eot +0 -0
- package/docs/fonts/OpenSans-LightItalic-webfont.svg +1835 -0
- package/docs/fonts/OpenSans-LightItalic-webfont.woff +0 -0
- package/docs/fonts/OpenSans-Regular-webfont.eot +0 -0
- package/docs/fonts/OpenSans-Regular-webfont.svg +1831 -0
- package/docs/fonts/OpenSans-Regular-webfont.woff +0 -0
- package/docs/index.html +7 -5
- package/docs/styles/jsdoc-default.css +95 -75
- package/docs/styles/prettify-tomorrow.css +1 -1
- package/donate.png +0 -0
- package/examples/protoify/json.js +123 -123
- package/examples/protoify/json.json +123 -123
- package/examples/websocket/server.js +4 -4
- package/externs/{ProtoBuf.js → protobuf.js} +933 -922
- package/index.js +1 -18
- package/jsdoc.json +1 -1
- package/package.json +11 -11
- package/protobuf.png +0 -0
- package/scripts/build.js +53 -58
- package/src/ProtoBuf/Builder/Message.js +18 -9
- package/src/ProtoBuf/Builder/Service.js +3 -0
- package/src/ProtoBuf/Builder.js +34 -10
- package/src/ProtoBuf/DotProto/Parser.js +58 -23
- package/src/ProtoBuf/Reflect/Element.js +17 -4
- package/src/ProtoBuf/Reflect/Message/Field.js +6 -5
- package/src/ProtoBuf/Reflect/Message.js +9 -4
- package/src/ProtoBuf/Util.js +116 -116
- package/src/bower.json +2 -2
- package/src/google/protobuf/descriptor.json +55 -15
- package/src/{ProtoBuf.js → protobuf.js} +0 -0
- package/src/wrap.js +4 -4
- package/tests/bench.txt +373 -373
- package/tests/complex.json +8 -1
- package/tests/custom-options.json +169 -169
- package/tests/extend.json +71 -71
- package/tests/imports-weak.proto +7 -0
- package/tests/imports.json +83 -83
- package/tests/nodeunit-browser/nodeunit.css +70 -70
- package/tests/nodeunit-browser/nodeunit.js +2108 -2108
- package/tests/options.json +32 -32
- package/tests/proto2js/Bar.json +46 -46
- package/tests/suite.js +107 -82
- package/ProtoBuf.png +0 -0
- package/dist/ProtoBuf-light.min.js +0 -87
- package/dist/ProtoBuf-light.min.js.gz +0 -0
- package/dist/ProtoBuf-light.min.map +0 -8
- package/dist/ProtoBuf.min.js +0 -108
- package/dist/ProtoBuf.min.js.gz +0 -0
- package/dist/ProtoBuf.min.map +0 -8
- package/externs/ByteBuffer.js +0 -767
- package/externs/Long.js +0 -328
- package/sandbox/gapi/googleapis/google/api/annotations.proto +0 -29
- package/sandbox/gapi/googleapis/google/api/http.proto +0 -245
- package/sandbox/gapi/googleapis/google/datastore/v1beta3/datastore.proto +0 -281
- package/sandbox/gapi/googleapis/google/datastore/v1beta3/entity.proto +0 -189
- package/sandbox/gapi/googleapis/google/datastore/v1beta3/query.proto +0 -281
- package/sandbox/gapi/googleapis/google/longrunning/operations.proto +0 -144
- package/sandbox/gapi/googleapis/google/protobuf/any.proto +0 -98
- package/sandbox/gapi/googleapis/google/protobuf/any_test.proto +0 -41
- package/sandbox/gapi/googleapis/google/protobuf/api.proto +0 -201
- package/sandbox/gapi/googleapis/google/protobuf/descriptor.proto +0 -773
- package/sandbox/gapi/googleapis/google/protobuf/duration.proto +0 -95
- package/sandbox/gapi/googleapis/google/protobuf/empty.proto +0 -50
- package/sandbox/gapi/googleapis/google/protobuf/field_mask.proto +0 -167
- package/sandbox/gapi/googleapis/google/protobuf/map_lite_unittest.proto +0 -130
- package/sandbox/gapi/googleapis/google/protobuf/map_proto2_unittest.proto +0 -60
- package/sandbox/gapi/googleapis/google/protobuf/map_unittest.proto +0 -129
- package/sandbox/gapi/googleapis/google/protobuf/map_unittest_proto3.proto +0 -120
- package/sandbox/gapi/googleapis/google/protobuf/source_context.proto +0 -47
- package/sandbox/gapi/googleapis/google/protobuf/struct.proto +0 -94
- package/sandbox/gapi/googleapis/google/protobuf/timestamp.proto +0 -107
- package/sandbox/gapi/googleapis/google/protobuf/type.proto +0 -176
- package/sandbox/gapi/googleapis/google/protobuf/unittest.proto +0 -878
- package/sandbox/gapi/googleapis/google/protobuf/unittest_arena.proto +0 -46
- package/sandbox/gapi/googleapis/google/protobuf/unittest_custom_options.proto +0 -394
- package/sandbox/gapi/googleapis/google/protobuf/unittest_drop_unknown_fields.proto +0 -58
- package/sandbox/gapi/googleapis/google/protobuf/unittest_embed_optimize_for.proto +0 -51
- package/sandbox/gapi/googleapis/google/protobuf/unittest_empty.proto +0 -38
- package/sandbox/gapi/googleapis/google/protobuf/unittest_enormous_descriptor.proto +0 -1048
- package/sandbox/gapi/googleapis/google/protobuf/unittest_import.proto +0 -66
- package/sandbox/gapi/googleapis/google/protobuf/unittest_import_lite.proto +0 -52
- package/sandbox/gapi/googleapis/google/protobuf/unittest_import_proto3.proto +0 -68
- package/sandbox/gapi/googleapis/google/protobuf/unittest_import_public.proto +0 -41
- package/sandbox/gapi/googleapis/google/protobuf/unittest_import_public_lite.proto +0 -43
- package/sandbox/gapi/googleapis/google/protobuf/unittest_import_public_proto3.proto +0 -42
- package/sandbox/gapi/googleapis/google/protobuf/unittest_lite.proto +0 -385
- package/sandbox/gapi/googleapis/google/protobuf/unittest_lite_imports_nonlite.proto +0 -44
- package/sandbox/gapi/googleapis/google/protobuf/unittest_mset.proto +0 -82
- package/sandbox/gapi/googleapis/google/protobuf/unittest_mset_wire_format.proto +0 -52
- package/sandbox/gapi/googleapis/google/protobuf/unittest_no_arena.proto +0 -202
- package/sandbox/gapi/googleapis/google/protobuf/unittest_no_arena_import.proto +0 -37
- package/sandbox/gapi/googleapis/google/protobuf/unittest_no_arena_lite.proto +0 -42
- package/sandbox/gapi/googleapis/google/protobuf/unittest_no_field_presence.proto +0 -138
- package/sandbox/gapi/googleapis/google/protobuf/unittest_no_generic_services.proto +0 -54
- package/sandbox/gapi/googleapis/google/protobuf/unittest_optimize_for.proto +0 -67
- package/sandbox/gapi/googleapis/google/protobuf/unittest_preserve_unknown_enum.proto +0 -71
- package/sandbox/gapi/googleapis/google/protobuf/unittest_preserve_unknown_enum2.proto +0 -50
- package/sandbox/gapi/googleapis/google/protobuf/unittest_proto3.proto +0 -388
- package/sandbox/gapi/googleapis/google/protobuf/unittest_proto3_arena.proto +0 -206
- package/sandbox/gapi/googleapis/google/protobuf/unittest_well_known_types.proto +0 -112
- package/sandbox/gapi/googleapis/google/protobuf/unknown_enum_test.proto +0 -62
- package/sandbox/gapi/googleapis/google/protobuf/wrappers.proto +0 -117
- package/sandbox/gapi/googleapis/google/rpc/code.proto +0 -190
- package/sandbox/gapi/googleapis/google/rpc/error_details.proto +0 -157
- package/sandbox/gapi/googleapis/google/rpc/status.proto +0 -90
- package/sandbox/gapi/googleapis/google/type/color.proto +0 -163
- package/sandbox/gapi/googleapis/google/type/date.proto +0 -43
- package/sandbox/gapi/googleapis/google/type/dayofweek.proto +0 -50
- package/sandbox/gapi/googleapis/google/type/latlng.proto +0 -36
- package/sandbox/gapi/googleapis/google/type/money.proto +0 -40
- package/sandbox/gapi/googleapis/google/type/timeofday.proto +0 -42
- package/sandbox/gapi/test.js +0 -17
- package/sandbox/gapi/test.proto +0 -12
- package/sandbox/issue146/MyOptions.proto +0 -28
- package/sandbox/issue146/Sample.proto +0 -21
- package/sandbox/issue146/main.js +0 -3
- package/sandbox/issue147/enum.proto +0 -8
- package/sandbox/issue147/main.js +0 -3
- package/sandbox/issue182/commands.proto +0 -10
- package/sandbox/issue182/execute.js +0 -22
- package/sandbox/issue182/session_commands.proto +0 -14
- package/sandbox/issue289/A.proto +0 -8
- package/sandbox/issue289/B.proto +0 -8
- package/sandbox/issue289/common.proto +0 -5
- package/sandbox/issue289/main.js +0 -7
- package/sandbox/issue300/IAuth.proto +0 -14
- package/sandbox/issue300/Request.proto +0 -14
- package/sandbox/issue300/main.js +0 -26
- package/sandbox/issue42/innerextend.proto +0 -18
- package/sandbox/issue42/main.js +0 -8
- package/sandbox/issue42/outerextend.proto +0 -17
- package/tests/gtfs-realtime.proto +0 -552
- package/webpack.config.js +0 -9
|
@@ -1,95 +0,0 @@
|
|
|
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
|
-
syntax = "proto3";
|
|
31
|
-
|
|
32
|
-
package google.protobuf;
|
|
33
|
-
|
|
34
|
-
option java_generate_equals_and_hash = true;
|
|
35
|
-
option java_multiple_files = true;
|
|
36
|
-
option java_outer_classname = "DurationProto";
|
|
37
|
-
option java_package = "com.google.protobuf";
|
|
38
|
-
option csharp_namespace = "Google.Protobuf.WellKnownTypes";
|
|
39
|
-
option objc_class_prefix = "GPB";
|
|
40
|
-
|
|
41
|
-
// A Duration represents a signed, fixed-length span of time represented
|
|
42
|
-
// as a count of seconds and fractions of seconds at nanosecond
|
|
43
|
-
// resolution. It is independent of any calendar and concepts like "day"
|
|
44
|
-
// or "month". It is related to Timestamp in that the difference between
|
|
45
|
-
// two Timestamp values is a Duration and it can be added or subtracted
|
|
46
|
-
// from a Timestamp. Range is approximately +-10,000 years.
|
|
47
|
-
//
|
|
48
|
-
// Example 1: Compute Duration from two Timestamps in pseudo code.
|
|
49
|
-
//
|
|
50
|
-
// Timestamp start = ...;
|
|
51
|
-
// Timestamp end = ...;
|
|
52
|
-
// Duration duration = ...;
|
|
53
|
-
//
|
|
54
|
-
// duration.seconds = end.seconds - start.seconds;
|
|
55
|
-
// duration.nanos = end.nanos - start.nanos;
|
|
56
|
-
//
|
|
57
|
-
// if (duration.seconds < 0 && duration.nanos > 0) {
|
|
58
|
-
// duration.seconds += 1;
|
|
59
|
-
// duration.nanos -= 1000000000;
|
|
60
|
-
// } else if (durations.seconds > 0 && duration.nanos < 0) {
|
|
61
|
-
// duration.seconds -= 1;
|
|
62
|
-
// duration.nanos += 1000000000;
|
|
63
|
-
// }
|
|
64
|
-
//
|
|
65
|
-
// Example 2: Compute Timestamp from Timestamp + Duration in pseudo code.
|
|
66
|
-
//
|
|
67
|
-
// Timestamp start = ...;
|
|
68
|
-
// Duration duration = ...;
|
|
69
|
-
// Timestamp end = ...;
|
|
70
|
-
//
|
|
71
|
-
// end.seconds = start.seconds + duration.seconds;
|
|
72
|
-
// end.nanos = start.nanos + duration.nanos;
|
|
73
|
-
//
|
|
74
|
-
// if (end.nanos < 0) {
|
|
75
|
-
// end.seconds -= 1;
|
|
76
|
-
// end.nanos += 1000000000;
|
|
77
|
-
// } else if (end.nanos >= 1000000000) {
|
|
78
|
-
// end.seconds += 1;
|
|
79
|
-
// end.nanos -= 1000000000;
|
|
80
|
-
// }
|
|
81
|
-
//
|
|
82
|
-
message Duration {
|
|
83
|
-
|
|
84
|
-
// Signed seconds of the span of time. Must be from -315,576,000,000
|
|
85
|
-
// to +315,576,000,000 inclusive.
|
|
86
|
-
int64 seconds = 1;
|
|
87
|
-
|
|
88
|
-
// Signed fractions of a second at nanosecond resolution of the span
|
|
89
|
-
// of time. Durations less than one second are represented with a 0
|
|
90
|
-
// `seconds` field and a positive or negative `nanos` field. For durations
|
|
91
|
-
// of one second or more, a non-zero value for the `nanos` field must be
|
|
92
|
-
// of the same sign as the `seconds` field. Must be from -999,999,999
|
|
93
|
-
// to +999,999,999 inclusive.
|
|
94
|
-
int32 nanos = 2;
|
|
95
|
-
}
|
|
@@ -1,50 +0,0 @@
|
|
|
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
|
-
syntax = "proto3";
|
|
31
|
-
|
|
32
|
-
package google.protobuf;
|
|
33
|
-
|
|
34
|
-
option java_multiple_files = true;
|
|
35
|
-
option java_outer_classname = "EmptyProto";
|
|
36
|
-
option java_package = "com.google.protobuf";
|
|
37
|
-
option java_generate_equals_and_hash = true;
|
|
38
|
-
option csharp_namespace = "Google.Protobuf.WellKnownTypes";
|
|
39
|
-
option objc_class_prefix = "GPB";
|
|
40
|
-
|
|
41
|
-
// A generic empty message that you can re-use to avoid defining duplicated
|
|
42
|
-
// empty messages in your APIs. A typical example is to use it as the request
|
|
43
|
-
// or the response type of an API method. For instance:
|
|
44
|
-
//
|
|
45
|
-
// service Foo {
|
|
46
|
-
// rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty);
|
|
47
|
-
// }
|
|
48
|
-
//
|
|
49
|
-
// The JSON representation for `Empty` is empty JSON object `{}`.
|
|
50
|
-
message Empty {}
|
|
@@ -1,167 +0,0 @@
|
|
|
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
|
-
syntax = "proto3";
|
|
31
|
-
|
|
32
|
-
package google.protobuf;
|
|
33
|
-
|
|
34
|
-
option java_generate_equals_and_hash = true;
|
|
35
|
-
option java_multiple_files = true;
|
|
36
|
-
option java_outer_classname = "FieldMaskProto";
|
|
37
|
-
option java_package = "com.google.protobuf";
|
|
38
|
-
option csharp_namespace = "Google.Protobuf.WellKnownTypes";
|
|
39
|
-
option objc_class_prefix = "GPB";
|
|
40
|
-
|
|
41
|
-
// `FieldMask` represents a set of symbolic field paths, for example:
|
|
42
|
-
//
|
|
43
|
-
// paths: "f.a"
|
|
44
|
-
// paths: "f.b.d"
|
|
45
|
-
//
|
|
46
|
-
// Here `f` represents a field in some root message, `a` and `b`
|
|
47
|
-
// fields in the message found in `f`, and `d` a field found in the
|
|
48
|
-
// message in `f.b`.
|
|
49
|
-
//
|
|
50
|
-
// Field masks are used to specify a subset of fields that should be
|
|
51
|
-
// returned by a get operation or modified by an update operation.
|
|
52
|
-
// Field masks also have a custom JSON encoding (see below).
|
|
53
|
-
//
|
|
54
|
-
// # Field Masks in Projections
|
|
55
|
-
//
|
|
56
|
-
// When used in the context of a projection, a response message or
|
|
57
|
-
// sub-message is filtered by the API to only contain those fields as
|
|
58
|
-
// specified in the mask. For example, if the mask in the previous
|
|
59
|
-
// example is applied to a response message as follows:
|
|
60
|
-
//
|
|
61
|
-
// f {
|
|
62
|
-
// a : 22
|
|
63
|
-
// b {
|
|
64
|
-
// d : 1
|
|
65
|
-
// x : 2
|
|
66
|
-
// }
|
|
67
|
-
// y : 13
|
|
68
|
-
// }
|
|
69
|
-
// z: 8
|
|
70
|
-
//
|
|
71
|
-
// The result will not contain specific values for fields x,y and z
|
|
72
|
-
// (there value will be set to the default, and omitted in proto text
|
|
73
|
-
// output):
|
|
74
|
-
//
|
|
75
|
-
//
|
|
76
|
-
// f {
|
|
77
|
-
// a : 22
|
|
78
|
-
// b {
|
|
79
|
-
// d : 1
|
|
80
|
-
// }
|
|
81
|
-
// }
|
|
82
|
-
//
|
|
83
|
-
// A repeated field is not allowed except at the last position of a
|
|
84
|
-
// field mask.
|
|
85
|
-
//
|
|
86
|
-
// If a FieldMask object is not present in a get operation, the
|
|
87
|
-
// operation applies to all fields (as if a FieldMask of all fields
|
|
88
|
-
// had been specified).
|
|
89
|
-
//
|
|
90
|
-
// Note that a field mask does not necessarily applies to the
|
|
91
|
-
// top-level response message. In case of a REST get operation, the
|
|
92
|
-
// field mask applies directly to the response, but in case of a REST
|
|
93
|
-
// list operation, the mask instead applies to each individual message
|
|
94
|
-
// in the returned resource list. In case of a REST custom method,
|
|
95
|
-
// other definitions may be used. Where the mask applies will be
|
|
96
|
-
// clearly documented together with its declaration in the API. In
|
|
97
|
-
// any case, the effect on the returned resource/resources is required
|
|
98
|
-
// behavior for APIs.
|
|
99
|
-
//
|
|
100
|
-
// # Field Masks in Update Operations
|
|
101
|
-
//
|
|
102
|
-
// A field mask in update operations specifies which fields of the
|
|
103
|
-
// targeted resource are going to be updated. The API is required
|
|
104
|
-
// to only change the values of the fields as specified in the mask
|
|
105
|
-
// and leave the others untouched. If a resource is passed in to
|
|
106
|
-
// describe the updated values, the API ignores the values of all
|
|
107
|
-
// fields not covered by the mask.
|
|
108
|
-
//
|
|
109
|
-
// In order to reset a field's value to the default, the field must
|
|
110
|
-
// be in the mask and set to the default value in the provided resource.
|
|
111
|
-
// Hence, in order to reset all fields of a resource, provide a default
|
|
112
|
-
// instance of the resource and set all fields in the mask, or do
|
|
113
|
-
// not provide a mask as described below.
|
|
114
|
-
//
|
|
115
|
-
// If a field mask is not present on update, the operation applies to
|
|
116
|
-
// all fields (as if a field mask of all fields has been specified).
|
|
117
|
-
// Note that in the presence of schema evolution, this may mean that
|
|
118
|
-
// fields the client does not know and has therefore not filled into
|
|
119
|
-
// the request will be reset to their default. If this is unwanted
|
|
120
|
-
// behavior, a specific service may require a client to always specify
|
|
121
|
-
// a field mask, producing an error if not.
|
|
122
|
-
//
|
|
123
|
-
// As with get operations, the location of the resource which
|
|
124
|
-
// describes the updated values in the request message depends on the
|
|
125
|
-
// operation kind. In any case, the effect of the field mask is
|
|
126
|
-
// required to be honored by the API.
|
|
127
|
-
//
|
|
128
|
-
// ## Considerations for HTTP REST
|
|
129
|
-
//
|
|
130
|
-
// The HTTP kind of an update operation which uses a field mask must
|
|
131
|
-
// be set to PATCH instead of PUT in order to satisfy HTTP semantics
|
|
132
|
-
// (PUT must only be used for full updates).
|
|
133
|
-
//
|
|
134
|
-
// # JSON Encoding of Field Masks
|
|
135
|
-
//
|
|
136
|
-
// In JSON, a field mask is encoded as a single string where paths are
|
|
137
|
-
// separated by a comma. Fields name in each path are converted
|
|
138
|
-
// to/from lower-camel naming conventions.
|
|
139
|
-
//
|
|
140
|
-
// As an example, consider the following message declarations:
|
|
141
|
-
//
|
|
142
|
-
// message Profile {
|
|
143
|
-
// User user = 1;
|
|
144
|
-
// Photo photo = 2;
|
|
145
|
-
// }
|
|
146
|
-
// message User {
|
|
147
|
-
// string display_name = 1;
|
|
148
|
-
// string address = 2;
|
|
149
|
-
// }
|
|
150
|
-
//
|
|
151
|
-
// In proto a field mask for `Profile` may look as such:
|
|
152
|
-
//
|
|
153
|
-
// mask {
|
|
154
|
-
// paths: "user.display_name"
|
|
155
|
-
// paths: "photo"
|
|
156
|
-
// }
|
|
157
|
-
//
|
|
158
|
-
// In JSON, the same mask is represented as below:
|
|
159
|
-
//
|
|
160
|
-
// {
|
|
161
|
-
// mask: "user.displayName,photo"
|
|
162
|
-
// }
|
|
163
|
-
//
|
|
164
|
-
message FieldMask {
|
|
165
|
-
// The set of field mask paths.
|
|
166
|
-
repeated string paths = 1;
|
|
167
|
-
}
|
|
@@ -1,130 +0,0 @@
|
|
|
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
|
-
syntax = "proto2";
|
|
32
|
-
|
|
33
|
-
option cc_enable_arenas = true;
|
|
34
|
-
option optimize_for = LITE_RUNTIME;
|
|
35
|
-
|
|
36
|
-
import "google/protobuf/unittest_lite.proto";
|
|
37
|
-
import "google/protobuf/unittest_no_arena_lite.proto";
|
|
38
|
-
|
|
39
|
-
package protobuf_unittest;
|
|
40
|
-
|
|
41
|
-
message TestMapLite {
|
|
42
|
-
map<int32 , int32 > map_int32_int32 = 1;
|
|
43
|
-
map<int64 , int64 > map_int64_int64 = 2;
|
|
44
|
-
map<uint32 , uint32 > map_uint32_uint32 = 3;
|
|
45
|
-
map<uint64 , uint64 > map_uint64_uint64 = 4;
|
|
46
|
-
map<sint32 , sint32 > map_sint32_sint32 = 5;
|
|
47
|
-
map<sint64 , sint64 > map_sint64_sint64 = 6;
|
|
48
|
-
map<fixed32 , fixed32 > map_fixed32_fixed32 = 7;
|
|
49
|
-
map<fixed64 , fixed64 > map_fixed64_fixed64 = 8;
|
|
50
|
-
map<sfixed32, sfixed32> map_sfixed32_sfixed32 = 9;
|
|
51
|
-
map<sfixed64, sfixed64> map_sfixed64_sfixed64 = 10;
|
|
52
|
-
map<int32 , float > map_int32_float = 11;
|
|
53
|
-
map<int32 , double > map_int32_double = 12;
|
|
54
|
-
map<bool , bool > map_bool_bool = 13;
|
|
55
|
-
map<string , string > map_string_string = 14;
|
|
56
|
-
map<int32 , bytes > map_int32_bytes = 15;
|
|
57
|
-
map<int32 , MapEnumLite> map_int32_enum = 16;
|
|
58
|
-
map<int32 , ForeignMessageLite> map_int32_foreign_message = 17;
|
|
59
|
-
map<int32, int32> teboring = 18;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
message TestArenaMapLite {
|
|
63
|
-
map<int32 , int32 > map_int32_int32 = 1;
|
|
64
|
-
map<int64 , int64 > map_int64_int64 = 2;
|
|
65
|
-
map<uint32 , uint32 > map_uint32_uint32 = 3;
|
|
66
|
-
map<uint64 , uint64 > map_uint64_uint64 = 4;
|
|
67
|
-
map<sint32 , sint32 > map_sint32_sint32 = 5;
|
|
68
|
-
map<sint64 , sint64 > map_sint64_sint64 = 6;
|
|
69
|
-
map<fixed32 , fixed32 > map_fixed32_fixed32 = 7;
|
|
70
|
-
map<fixed64 , fixed64 > map_fixed64_fixed64 = 8;
|
|
71
|
-
map<sfixed32, sfixed32> map_sfixed32_sfixed32 = 9;
|
|
72
|
-
map<sfixed64, sfixed64> map_sfixed64_sfixed64 = 10;
|
|
73
|
-
map<int32 , float > map_int32_float = 11;
|
|
74
|
-
map<int32 , double > map_int32_double = 12;
|
|
75
|
-
map<bool , bool > map_bool_bool = 13;
|
|
76
|
-
map<string , string > map_string_string = 14;
|
|
77
|
-
map<int32 , bytes > map_int32_bytes = 15;
|
|
78
|
-
map<int32 , MapEnumLite> map_int32_enum = 16;
|
|
79
|
-
map<int32 , ForeignMessageArenaLite> map_int32_foreign_message = 17;
|
|
80
|
-
map<int32, .protobuf_unittest_no_arena.ForeignMessageLite>
|
|
81
|
-
map_int32_foreign_message_no_arena = 18;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
// Test embeded message with required fields
|
|
85
|
-
message TestRequiredMessageMapLite {
|
|
86
|
-
map<int32, TestRequiredLite> map_field = 1;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
message TestEnumMapLite {
|
|
90
|
-
map<int32, Proto2MapEnumLite> known_map_field = 101;
|
|
91
|
-
map<int32, Proto2MapEnumLite> unknown_map_field = 102;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
message TestEnumMapPlusExtraLite {
|
|
95
|
-
map<int32, Proto2MapEnumPlusExtraLite> known_map_field = 101;
|
|
96
|
-
map<int32, Proto2MapEnumPlusExtraLite> unknown_map_field = 102;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
message TestMessageMapLite {
|
|
100
|
-
map<int32, TestAllTypesLite> map_int32_message = 1;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
enum Proto2MapEnumLite {
|
|
104
|
-
PROTO2_MAP_ENUM_FOO_LITE = 0;
|
|
105
|
-
PROTO2_MAP_ENUM_BAR_LITE = 1;
|
|
106
|
-
PROTO2_MAP_ENUM_BAZ_LITE = 2;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
enum Proto2MapEnumPlusExtraLite {
|
|
110
|
-
E_PROTO2_MAP_ENUM_FOO_LITE = 0;
|
|
111
|
-
E_PROTO2_MAP_ENUM_BAR_LITE = 1;
|
|
112
|
-
E_PROTO2_MAP_ENUM_BAZ_LITE = 2;
|
|
113
|
-
E_PROTO2_MAP_ENUM_EXTRA_LITE = 3;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
enum MapEnumLite {
|
|
117
|
-
MAP_ENUM_FOO_LITE = 0;
|
|
118
|
-
MAP_ENUM_BAR_LITE = 1;
|
|
119
|
-
MAP_ENUM_BAZ_LITE = 2;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
message TestRequiredLite {
|
|
123
|
-
required int32 a = 1;
|
|
124
|
-
required int32 b = 2;
|
|
125
|
-
required int32 c = 3;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
message ForeignMessageArenaLite {
|
|
129
|
-
optional int32 c = 1;
|
|
130
|
-
}
|
|
@@ -1,60 +0,0 @@
|
|
|
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
|
-
syntax = "proto2";
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
// We don't put this in a package within proto2 because we need to make sure
|
|
35
|
-
// that the generated code doesn't depend on being in the proto2 namespace.
|
|
36
|
-
// In map_test_util.h we do "using namespace unittest = protobuf_unittest".
|
|
37
|
-
package protobuf_unittest;
|
|
38
|
-
|
|
39
|
-
enum Proto2MapEnum {
|
|
40
|
-
PROTO2_MAP_ENUM_FOO = 0;
|
|
41
|
-
PROTO2_MAP_ENUM_BAR = 1;
|
|
42
|
-
PROTO2_MAP_ENUM_BAZ = 2;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
enum Proto2MapEnumPlusExtra {
|
|
46
|
-
E_PROTO2_MAP_ENUM_FOO = 0;
|
|
47
|
-
E_PROTO2_MAP_ENUM_BAR = 1;
|
|
48
|
-
E_PROTO2_MAP_ENUM_BAZ = 2;
|
|
49
|
-
E_PROTO2_MAP_ENUM_EXTRA = 3;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
message TestEnumMap {
|
|
53
|
-
map<int32, Proto2MapEnum> known_map_field = 101;
|
|
54
|
-
map<int32, Proto2MapEnum> unknown_map_field = 102;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
message TestEnumMapPlusExtra {
|
|
58
|
-
map<int32, Proto2MapEnumPlusExtra> known_map_field = 101;
|
|
59
|
-
map<int32, Proto2MapEnumPlusExtra> unknown_map_field = 102;
|
|
60
|
-
}
|
|
@@ -1,129 +0,0 @@
|
|
|
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
|
-
syntax = "proto3";
|
|
32
|
-
|
|
33
|
-
option cc_enable_arenas = true;
|
|
34
|
-
|
|
35
|
-
import "google/protobuf/unittest.proto";
|
|
36
|
-
import "google/protobuf/unittest_no_arena.proto";
|
|
37
|
-
|
|
38
|
-
// We don't put this in a package within proto2 because we need to make sure
|
|
39
|
-
// that the generated code doesn't depend on being in the proto2 namespace.
|
|
40
|
-
// In map_test_util.h we do "using namespace unittest = protobuf_unittest".
|
|
41
|
-
package protobuf_unittest;
|
|
42
|
-
|
|
43
|
-
// Tests maps.
|
|
44
|
-
message TestMap {
|
|
45
|
-
map<int32 , int32 > map_int32_int32 = 1;
|
|
46
|
-
map<int64 , int64 > map_int64_int64 = 2;
|
|
47
|
-
map<uint32 , uint32 > map_uint32_uint32 = 3;
|
|
48
|
-
map<uint64 , uint64 > map_uint64_uint64 = 4;
|
|
49
|
-
map<sint32 , sint32 > map_sint32_sint32 = 5;
|
|
50
|
-
map<sint64 , sint64 > map_sint64_sint64 = 6;
|
|
51
|
-
map<fixed32 , fixed32 > map_fixed32_fixed32 = 7;
|
|
52
|
-
map<fixed64 , fixed64 > map_fixed64_fixed64 = 8;
|
|
53
|
-
map<sfixed32, sfixed32> map_sfixed32_sfixed32 = 9;
|
|
54
|
-
map<sfixed64, sfixed64> map_sfixed64_sfixed64 = 10;
|
|
55
|
-
map<int32 , float > map_int32_float = 11;
|
|
56
|
-
map<int32 , double > map_int32_double = 12;
|
|
57
|
-
map<bool , bool > map_bool_bool = 13;
|
|
58
|
-
map<string , string > map_string_string = 14;
|
|
59
|
-
map<int32 , bytes > map_int32_bytes = 15;
|
|
60
|
-
map<int32 , MapEnum > map_int32_enum = 16;
|
|
61
|
-
map<int32 , ForeignMessage> map_int32_foreign_message = 17;
|
|
62
|
-
map<string , ForeignMessage> map_string_foreign_message = 18;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
message TestMapSubmessage {
|
|
66
|
-
TestMap test_map = 1;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
message TestMessageMap {
|
|
70
|
-
map<int32, TestAllTypes> map_int32_message = 1;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
// Two map fields share the same entry default instance.
|
|
74
|
-
message TestSameTypeMap {
|
|
75
|
-
map<int32, int32> map1 = 1;
|
|
76
|
-
map<int32, int32> map2 = 2;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
enum MapEnum {
|
|
81
|
-
MAP_ENUM_FOO = 0;
|
|
82
|
-
MAP_ENUM_BAR = 1;
|
|
83
|
-
MAP_ENUM_BAZ = 2;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
// Test embeded message with required fields
|
|
87
|
-
message TestRequiredMessageMap {
|
|
88
|
-
map<int32, TestRequired> map_field = 1;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
message TestArenaMap {
|
|
92
|
-
map<int32 , int32 > map_int32_int32 = 1;
|
|
93
|
-
map<int64 , int64 > map_int64_int64 = 2;
|
|
94
|
-
map<uint32 , uint32 > map_uint32_uint32 = 3;
|
|
95
|
-
map<uint64 , uint64 > map_uint64_uint64 = 4;
|
|
96
|
-
map<sint32 , sint32 > map_sint32_sint32 = 5;
|
|
97
|
-
map<sint64 , sint64 > map_sint64_sint64 = 6;
|
|
98
|
-
map<fixed32 , fixed32 > map_fixed32_fixed32 = 7;
|
|
99
|
-
map<fixed64 , fixed64 > map_fixed64_fixed64 = 8;
|
|
100
|
-
map<sfixed32, sfixed32> map_sfixed32_sfixed32 = 9;
|
|
101
|
-
map<sfixed64, sfixed64> map_sfixed64_sfixed64 = 10;
|
|
102
|
-
map<int32 , float > map_int32_float = 11;
|
|
103
|
-
map<int32 , double > map_int32_double = 12;
|
|
104
|
-
map<bool , bool > map_bool_bool = 13;
|
|
105
|
-
map<string , string > map_string_string = 14;
|
|
106
|
-
map<int32 , bytes > map_int32_bytes = 15;
|
|
107
|
-
map<int32 , MapEnum > map_int32_enum = 16;
|
|
108
|
-
map<int32 , ForeignMessage> map_int32_foreign_message = 17;
|
|
109
|
-
map<int32, .protobuf_unittest_no_arena.ForeignMessage>
|
|
110
|
-
map_int32_foreign_message_no_arena = 18;
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
// Previously, message containing enum called Type cannot be used as value of
|
|
114
|
-
// map field.
|
|
115
|
-
message MessageContainingEnumCalledType {
|
|
116
|
-
enum Type {
|
|
117
|
-
TYPE_FOO = 0;
|
|
118
|
-
}
|
|
119
|
-
map<string, MessageContainingEnumCalledType> type = 1;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
// Previously, message cannot contain map field called "entry".
|
|
123
|
-
message MessageContainingMapCalledEntry {
|
|
124
|
-
map<int32, int32> entry = 1;
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
message TestRecursiveMapMessage {
|
|
128
|
-
map<string, TestRecursiveMapMessage> a = 1;
|
|
129
|
-
}
|