From a66697ede1343138c3592cf9b9823e0b7e8ccd02 Mon Sep 17 00:00:00 2001 From: Bo Yang Date: Mon, 19 Sep 2016 13:45:07 -0700 Subject: [PATCH] Integrate internal changes --- google/protobuf/any.proto | 1 - google/protobuf/api.proto | 1 - google/protobuf/descriptor.proto | 25 ++---- google/protobuf/duration.proto | 8 +- google/protobuf/empty.proto | 1 - google/protobuf/field_mask.proto | 7 +- google/protobuf/source_context.proto | 1 - google/protobuf/struct.proto | 2 +- google/protobuf/timestamp.proto | 9 +- google/protobuf/type.proto | 2 +- google/protobuf/unittest.proto | 8 ++ .../util/internal/testdata/anys.proto | 69 +++++++++++++-- .../util/internal/testdata/books.proto | 5 ++ .../util/internal/testdata/maps.proto | 76 ++++++++++++++-- .../util/internal/testdata/oneofs.proto | 31 ++++--- .../util/internal/testdata/proto3.proto | 42 +++++++++ .../util/internal/testdata/struct.proto | 86 +++++++++++++++++-- .../testdata/timestamp_duration.proto | 47 ++++++++-- google/protobuf/wrappers.proto | 1 - 19 files changed, 348 insertions(+), 74 deletions(-) create mode 100644 google/protobuf/util/internal/testdata/proto3.proto diff --git a/google/protobuf/any.proto b/google/protobuf/any.proto index 81dcf46ccfd22..9bd3f50a4537c 100644 --- a/google/protobuf/any.proto +++ b/google/protobuf/any.proto @@ -37,7 +37,6 @@ option go_package = "github.com/golang/protobuf/ptypes/any"; option java_package = "com.google.protobuf"; option java_outer_classname = "AnyProto"; option java_multiple_files = true; -option java_generate_equals_and_hash = true; option objc_class_prefix = "GPB"; // `Any` contains an arbitrary serialized protocol buffer message along with a diff --git a/google/protobuf/api.proto b/google/protobuf/api.proto index dbe87b8f54abc..bbbe9833071b8 100644 --- a/google/protobuf/api.proto +++ b/google/protobuf/api.proto @@ -39,7 +39,6 @@ option csharp_namespace = "Google.Protobuf.WellKnownTypes"; option java_package = "com.google.protobuf"; option java_outer_classname = "ApiProto"; option java_multiple_files = true; -option java_generate_equals_and_hash = true; option objc_class_prefix = "GPB"; // Api is a light-weight descriptor for a protocol buffer service. diff --git a/google/protobuf/descriptor.proto b/google/protobuf/descriptor.proto index 28410d4a9ab57..23a9fe9285d72 100644 --- a/google/protobuf/descriptor.proto +++ b/google/protobuf/descriptor.proto @@ -45,7 +45,6 @@ option java_package = "com.google.protobuf"; option java_outer_classname = "DescriptorProtos"; option csharp_namespace = "Google.Protobuf.Reflection"; option objc_class_prefix = "GPB"; -option java_generate_equals_and_hash = true; // descriptor.proto must be optimized for speed because reflection-based // algorithms don't work during bootstrapping. @@ -306,19 +305,10 @@ message FileOptions { // top-level extensions defined in the file. optional bool java_multiple_files = 10 [default=false]; - // If set true, then the Java code generator will generate equals() and - // hashCode() methods for all messages defined in the .proto file. - // This increases generated code size, potentially substantially for large - // protos, which may harm a memory-constrained application. - // - In the full runtime this is a speed optimization, as the - // AbstractMessage base class includes reflection-based implementations of - // these methods. - // - In the lite runtime, setting this option changes the semantics of - // equals() and hashCode() to more closely match those of the full runtime; - // the generated methods compute their results based on field values rather - // than object identity. (Implementations should not assume that hashcodes - // will be consistent across runtimes or versions of the protocol compiler.) - optional bool java_generate_equals_and_hash = 20 [default=false]; + // BEGIN PROTOBUF-OPENSOURCE + // // This option does nothing. + // optional bool java_generate_equals_and_hash = 20 [deprecated=true]; + // END PROTOBUF-OPENSOURCE // If set true, then the Java2 code generator will generate code that // throws an exception whenever an attempt is made to assign a non-UTF-8 @@ -448,6 +438,8 @@ message MessageOptions { // Clients can define custom options in extensions of this message. See above. extensions 1000 to max; + + reserved 8; // javalite_serializable } message FieldOptions { @@ -471,7 +463,6 @@ message FieldOptions { // false will avoid using packed encoding. optional bool packed = 2; - // The jstype option determines the JavaScript type used for values of the // field. The option is permitted only for 64 bit integral and fixed types // (int64, uint64, sint64, fixed64, sfixed64). By default these types are @@ -512,7 +503,7 @@ message FieldOptions { // // // Note that implementations may choose not to check required fields within - // a lazy sub-message. That is, calling IsInitialized() on the outher message + // a lazy sub-message. That is, calling IsInitialized() on the outer message // may return true even if the inner message has missing required fields. // This is necessary because otherwise the inner message would have to be // parsed in order to perform the check, defeating the purpose of lazy @@ -538,6 +529,8 @@ message FieldOptions { // Clients can define custom options in extensions of this message. See above. extensions 1000 to max; + + reserved 4; // removed jtype } message OneofOptions { diff --git a/google/protobuf/duration.proto b/google/protobuf/duration.proto index 96c1796d6594a..7f461f408d82f 100644 --- a/google/protobuf/duration.proto +++ b/google/protobuf/duration.proto @@ -33,11 +33,11 @@ syntax = "proto3"; package google.protobuf; option csharp_namespace = "Google.Protobuf.WellKnownTypes"; +option cc_enable_arenas = true; option go_package = "github.com/golang/protobuf/ptypes/duration"; option java_package = "com.google.protobuf"; option java_outer_classname = "DurationProto"; option java_multiple_files = true; -option java_generate_equals_and_hash = true; option objc_class_prefix = "GPB"; // A Duration represents a signed, fixed-length span of time represented @@ -81,6 +81,12 @@ option objc_class_prefix = "GPB"; // end.nanos -= 1000000000; // } // +// Example 3: Compute Duration from datetime.timedelta in Python. +// +// td = datetime.timedelta(days=3, minutes=10) +// duration = Duration() +// duration.FromTimedelta(td) +// // message Duration { diff --git a/google/protobuf/empty.proto b/google/protobuf/empty.proto index 37f4cd10eee57..03cacd233088d 100644 --- a/google/protobuf/empty.proto +++ b/google/protobuf/empty.proto @@ -37,7 +37,6 @@ option go_package = "github.com/golang/protobuf/ptypes/empty"; option java_package = "com.google.protobuf"; option java_outer_classname = "EmptyProto"; option java_multiple_files = true; -option java_generate_equals_and_hash = true; option objc_class_prefix = "GPB"; option cc_enable_arenas = true; diff --git a/google/protobuf/field_mask.proto b/google/protobuf/field_mask.proto index c51de09a832c2..b6d32a792185f 100644 --- a/google/protobuf/field_mask.proto +++ b/google/protobuf/field_mask.proto @@ -37,7 +37,6 @@ option java_package = "com.google.protobuf"; option java_outer_classname = "FieldMaskProto"; option java_multiple_files = true; option objc_class_prefix = "GPB"; -option java_generate_equals_and_hash = true; // `FieldMask` represents a set of symbolic field paths, for example: // @@ -82,7 +81,7 @@ option java_generate_equals_and_hash = true; // } // // A repeated field is not allowed except at the last position of a -// field mask. +// paths string. // // If a FieldMask object is not present in a get operation, the // operation applies to all fields (as if a FieldMask of all fields @@ -109,8 +108,8 @@ option java_generate_equals_and_hash = true; // // If a repeated field is specified for an update operation, the existing // repeated values in the target resource will be overwritten by the new values. -// Note that a repeated field is only allowed in the last position of a field -// mask. +// Note that a repeated field is only allowed in the last position of a `paths` +// string. // // If a sub-message is specified in the last position of the field mask for an // update operation, then the existing sub-message in the target resource is diff --git a/google/protobuf/source_context.proto b/google/protobuf/source_context.proto index a2c08e2b57d36..79137ce8e172b 100644 --- a/google/protobuf/source_context.proto +++ b/google/protobuf/source_context.proto @@ -36,7 +36,6 @@ option csharp_namespace = "Google.Protobuf.WellKnownTypes"; option java_package = "com.google.protobuf"; option java_outer_classname = "SourceContextProto"; option java_multiple_files = true; -option java_generate_equals_and_hash = true; option objc_class_prefix = "GPB"; // `SourceContext` represents information about the source of a diff --git a/google/protobuf/struct.proto b/google/protobuf/struct.proto index beeba81188888..7d7808e7fbb69 100644 --- a/google/protobuf/struct.proto +++ b/google/protobuf/struct.proto @@ -33,11 +33,11 @@ syntax = "proto3"; package google.protobuf; option csharp_namespace = "Google.Protobuf.WellKnownTypes"; +option cc_enable_arenas = true; option go_package = "github.com/golang/protobuf/ptypes/struct;structpb"; option java_package = "com.google.protobuf"; option java_outer_classname = "StructProto"; option java_multiple_files = true; -option java_generate_equals_and_hash = true; option objc_class_prefix = "GPB"; diff --git a/google/protobuf/timestamp.proto b/google/protobuf/timestamp.proto index 7992a85886fb0..67e2eba4f8536 100644 --- a/google/protobuf/timestamp.proto +++ b/google/protobuf/timestamp.proto @@ -38,7 +38,6 @@ option go_package = "github.com/golang/protobuf/ptypes/timestamp"; option java_package = "com.google.protobuf"; option java_outer_classname = "TimestampProto"; option java_multiple_files = true; -option java_generate_equals_and_hash = true; option objc_class_prefix = "GPB"; // A Timestamp represents a point in time independent of any time zone @@ -90,16 +89,14 @@ option objc_class_prefix = "GPB"; // // Example 5: Compute Timestamp from current time in Python. // -// now = time.time() -// seconds = int(now) -// nanos = int((now - seconds) * 10**9) -// timestamp = Timestamp(seconds=seconds, nanos=nanos) +// timestamp = Timestamp() +// timestamp.GetCurrentTime() // // message Timestamp { // Represents seconds of UTC time since Unix epoch - // 1970-01-01T00:00:00Z. Must be from from 0001-01-01T00:00:00Z to + // 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to // 9999-12-31T23:59:59Z inclusive. int64 seconds = 1; diff --git a/google/protobuf/type.proto b/google/protobuf/type.proto index 1c9cf53da8a38..504cd25db3496 100644 --- a/google/protobuf/type.proto +++ b/google/protobuf/type.proto @@ -36,10 +36,10 @@ import "google/protobuf/any.proto"; import "google/protobuf/source_context.proto"; option csharp_namespace = "Google.Protobuf.WellKnownTypes"; +option cc_enable_arenas = true; option java_package = "com.google.protobuf"; option java_outer_classname = "TypeProto"; option java_multiple_files = true; -option java_generate_equals_and_hash = true; option objc_class_prefix = "GPB"; // A protocol buffer message type. diff --git a/google/protobuf/unittest.proto b/google/protobuf/unittest.proto index d5206d2463b8c..cc2f4b34a003f 100644 --- a/google/protobuf/unittest.proto +++ b/google/protobuf/unittest.proto @@ -878,3 +878,11 @@ service TestService { message BarRequest {} message BarResponse {} +message TestJsonName { + optional int32 field_name1 = 1; + optional int32 fieldName2 = 2; + optional int32 FieldName3 = 3; + optional int32 _field_name4 = 4; + optional int32 FIELD_NAME5 = 5; + optional int32 field_name6 = 6 [json_name = "@type"]; +} diff --git a/google/protobuf/util/internal/testdata/anys.proto b/google/protobuf/util/internal/testdata/anys.proto index 18c59cbb96308..a9ebca3d43f34 100644 --- a/google/protobuf/util/internal/testdata/anys.proto +++ b/google/protobuf/util/internal/testdata/anys.proto @@ -28,16 +28,75 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// Proto to test Proto3 Any serialization. syntax = "proto3"; -package google.protobuf.testing.anys; -option java_package = "com.google.protobuf.testing.anys"; +package google.protobuf.testing; import "google/protobuf/any.proto"; +import "google/protobuf/struct.proto"; +import "google/protobuf/timestamp.proto"; +import "google/protobuf/duration.proto"; +import "google/protobuf/wrappers.proto"; + +// Top-level test cases proto used by MarshallingTest. See description +// at the top of the class MarshallingTest for details on how to write +// test cases. +message AnyTestCases { + AnyWrapper empty_any = 1; + AnyWrapper type_only_any = 2; + AnyWrapper wrapper_any = 3; + AnyWrapper any_with_timestamp_value = 4; + AnyWrapper any_with_duration_value = 5; + AnyWrapper any_with_struct_value = 6; + AnyWrapper recursive_any = 7; + AnyWrapper any_with_message_value = 8; + AnyWrapper any_with_nested_message = 9; + AnyWrapper any_with_message_with_wrapper_type = 10; + AnyWrapper any_with_message_with_timestamp = 11; + AnyWrapper any_with_message_containing_map = 12; + AnyWrapper any_with_message_containing_struct = 13; + AnyWrapper any_with_message_containing_repeated_message = 14; + AnyWrapper recursive_any_with_type_field_at_end = 15; + + google.protobuf.Any top_level_any = 50; + google.protobuf.Any top_level_any_with_type_field_at_end = 51; +} + +message AnyWrapper { + google.protobuf.Any any = 1; +} + +// Hack to make sure the types we put into the any are included in the types. +// Real solution is to add these types to the service config. +message Imports { + google.protobuf.DoubleValue dbl = 1; + google.protobuf.Struct struct = 2; + google.protobuf.Timestamp timestamp = 3; + google.protobuf.Duration duration = 4; + google.protobuf.Int32Value i32 = 5; + Data data = 100; +} + +message Data { + int32 attr = 1; + string str = 2; + repeated string msgs = 3; + Data nested_data = 4; + google.protobuf.Int32Value int_wrapper = 5; + google.protobuf.Timestamp time = 6; + map map_data = 7; + google.protobuf.Struct struct_data = 8; + repeated Data repeated_data = 9; +} + +service AnyTestService { + rpc Call(AnyTestCases) returns (AnyTestCases); + rpc Call1(Imports) returns (Imports); +} message AnyIn { string something = 1; + google.protobuf.Any any = 2; } message AnyOut { @@ -47,7 +106,3 @@ message AnyOut { message AnyM { string foo = 1; } - -service TestService { - rpc Call(AnyIn) returns (AnyOut); -} diff --git a/google/protobuf/util/internal/testdata/books.proto b/google/protobuf/util/internal/testdata/books.proto index 1cbbba4781f04..9fe4f7aa8cc02 100644 --- a/google/protobuf/util/internal/testdata/books.proto +++ b/google/protobuf/util/internal/testdata/books.proto @@ -31,6 +31,10 @@ // Author: sven@google.com (Sven Mawson) // // Sample protos for testing. + +// Some of the older enums don't use CAPITALS_WITH_UNDERSCORES for testing. +// LINT: LEGACY_NAMES + syntax = "proto2"; package google.protobuf.testing; @@ -60,6 +64,7 @@ message Book { FICTION = 1; KIDS = 2; ACTION_AND_ADVENTURE = 3; + arts_and_photography = 4; } optional Type type = 11; diff --git a/google/protobuf/util/internal/testdata/maps.proto b/google/protobuf/util/internal/testdata/maps.proto index 6475ecddc2561..0f381b320bedb 100644 --- a/google/protobuf/util/internal/testdata/maps.proto +++ b/google/protobuf/util/internal/testdata/maps.proto @@ -28,11 +28,76 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// Proto to test proto3 maps. syntax = "proto3"; -package google.protobuf.testing.maps; -option java_package = "com.google.protobuf.testing.maps"; +package google.protobuf.testing; + +// Top-level test cases proto used by MarshallingTest. See description +// at the top of the class MarshallingTest for details on how to write +// test cases. +message MapsTestCases { + EmptyMap empty_map = 1; + StringtoInt string_to_int = 2; + IntToString int_to_string = 3; + Mixed1 mixed1 = 4; + Mixed2 mixed2 = 5; + MapOfObjects map_of_objects = 6; + + // Empty key tests + StringtoInt empty_key_string_to_int1 = 7; + StringtoInt empty_key_string_to_int2 = 8; + StringtoInt empty_key_string_to_int3 = 9; + BoolToString empty_key_bool_to_string = 10; + IntToString empty_key_int_to_string = 11; + Mixed1 empty_key_mixed = 12; + MapOfObjects empty_key_map_objects = 13; +} + +message EmptyMap { + map map = 1; +} + +message StringtoInt { + map map = 1; +} + +message IntToString { + map map = 1; +} + +message BoolToString { + map map = 1; +} + +message Mixed1 { + string msg = 1; + map map = 2; +} + +message Mixed2 { + enum E { + E0 = 0; + E1 = 1; + E2 = 2; + E3 = 3; + } + map map = 1; + E ee = 2; +} + +message MapOfObjects { + message M { + string inner_text = 1; + } + map map = 1; +} + +message DummyRequest { +} + +service MapsTestService { + rpc Call(DummyRequest) returns (MapsTestCases); +} message MapIn { string other = 1; @@ -79,8 +144,3 @@ message MapOutWireFormat { message MapM { string foo = 1; } - -service TestService { - rpc Call1(MapIn) returns (MapOut); - rpc Call2(MapIn) returns (MapOut); -} diff --git a/google/protobuf/util/internal/testdata/oneofs.proto b/google/protobuf/util/internal/testdata/oneofs.proto index 5bc9fa084d1d1..c37da08316650 100644 --- a/google/protobuf/util/internal/testdata/oneofs.proto +++ b/google/protobuf/util/internal/testdata/oneofs.proto @@ -28,7 +28,7 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// Proto to test oneofs. +// Proto to test proto3 oneofs. syntax = "proto3"; import "google/protobuf/any.proto"; @@ -36,7 +36,6 @@ import "google/protobuf/struct.proto"; import "google/protobuf/timestamp.proto"; package google.protobuf.testing.oneofs; -option java_package = "com.google.protobuf.testing.oneofs"; message OneOfsRequest { string value = 1; @@ -45,24 +44,34 @@ message OneOfsRequest { int32 int_data = 3; // Simple message Data message_data = 4; + MoreData more_data = 5; // Well known types - google.protobuf.Struct struct_data = 5; - google.protobuf.Value value_data = 6; - google.protobuf.ListValue list_value_data = 7; - google.protobuf.Timestamp ts_data = 8; + google.protobuf.Struct struct_data = 6; + google.protobuf.Value value_data = 7; + google.protobuf.ListValue list_value_data = 8; + google.protobuf.Timestamp ts_data = 9; } google.protobuf.Any any_data = 19; } +message RequestWithSimpleOneof { + string value = 1; + oneof data { + string str_data = 2; + int32 int_data = 3; + Data message_data = 4; + MoreData more_data = 5; + } +} + message Data { int32 data_value = 1; } -message Response { - string value = 1; +message MoreData { + string str_value = 1; } -service TestService { - // Test call. - rpc Call(OneOfsRequest) returns (Response); +message Response { + string value = 1; } diff --git a/google/protobuf/util/internal/testdata/proto3.proto b/google/protobuf/util/internal/testdata/proto3.proto new file mode 100644 index 0000000000000..c013cee31e45e --- /dev/null +++ b/google/protobuf/util/internal/testdata/proto3.proto @@ -0,0 +1,42 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +syntax = "proto3"; + +package google.protobuf.testing; + +message Proto3Message { + enum NestedEnum { + FOO = 0; + BAR = 1; + BAZ = 2; + } + NestedEnum enum_value = 1; +} diff --git a/google/protobuf/util/internal/testdata/struct.proto b/google/protobuf/util/internal/testdata/struct.proto index c15aba0d6d988..7b1cc1b954cde 100644 --- a/google/protobuf/util/internal/testdata/struct.proto +++ b/google/protobuf/util/internal/testdata/struct.proto @@ -28,18 +28,90 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// Proto to test proto3 struct. syntax = "proto3"; -package google.protobuf.testing.structs; -option java_package = "com.google.protobuf.testing.structs"; +package google.protobuf.testing; import "google/protobuf/struct.proto"; -message StructType { - google.protobuf.Struct object = 1; +message StructTestCases { + StructWrapper empty_value = 1; + StructWrapper empty_value2 = 2; + StructWrapper null_value = 3; + StructWrapper simple_struct = 4; + StructWrapper longer_struct = 5; + StructWrapper struct_with_nested_struct = 6; + StructWrapper struct_with_nested_list = 7; + StructWrapper struct_with_list_of_nulls = 8; + StructWrapper struct_with_list_of_lists = 9; + StructWrapper struct_with_list_of_structs = 10; + StructWrapper struct_with_empty_list = 11; + StructWrapper struct_with_list_with_empty_struct = 12; + google.protobuf.Struct top_level_struct = 13; + google.protobuf.Struct top_level_struct_with_empty_list = 14; + google.protobuf.Struct top_level_struct_with_list_with_empty_struct = 15; + ValueWrapper value_wrapper_simple = 16; + ValueWrapper value_wrapper_with_struct = 17; + ValueWrapper value_wrapper_with_list = 18; + ValueWrapper value_wrapper_with_empty_list = 19; + ValueWrapper value_wrapper_with_list_with_empty_struct = 20; + ListValueWrapper list_value_wrapper = 21; + ListValueWrapper list_value_wrapper_with_empty_list = 22; + ListValueWrapper list_value_wrapper_with_list_with_empty_struct = 23; + google.protobuf.Value top_level_value_simple = 24; + google.protobuf.Value top_level_value_with_struct = 25; + google.protobuf.Value top_level_value_with_list = 26; + google.protobuf.Value top_level_value_with_empty_list = 27; + google.protobuf.Value top_level_value_with_list_with_empty_struct = 28; + google.protobuf.ListValue top_level_listvalue = 29; + google.protobuf.ListValue top_level_empty_listvalue = 30; + google.protobuf.ListValue top_level_listvalue_with_empty_struct = 31; + RepeatedValueWrapper repeated_value = 32; + RepeatedValueWrapper repeated_value_nested_list = 33; + RepeatedValueWrapper repeated_value_nested_list2 = 34; + RepeatedValueWrapper repeated_value_nested_list3 = 35; + RepeatedListValueWrapper repeated_listvalue = 36; + MapOfStruct map_of_struct = 37; + MapOfStruct map_of_struct_value = 38; + MapOfStruct map_of_listvalue = 39; +} + +message StructWrapper { + google.protobuf.Struct struct = 1; +} + +message ValueWrapper { + google.protobuf.Value value = 1; +} + +message RepeatedValueWrapper { + repeated google.protobuf.Value values = 1; +} + +message ListValueWrapper { + google.protobuf.ListValue shopping_list = 1; } -service TestService { - rpc Call(StructType) returns (StructType); +message RepeatedListValueWrapper { + repeated google.protobuf.ListValue dimensions = 1; +} + +message MapOfStruct { + map struct_map = 1; + map value_map = 2; + map listvalue_map = 3; +} + +// Hack to test return types with Struct as top-level message. Struct typers +// cannot be directly used in API requests. Hence using Dummy as request type. +message Dummy { + string text = 1; +} + +service StructTestService { + rpc Call(Dummy) returns (StructTestCases); +} + +message StructType { + google.protobuf.Struct object = 1; } diff --git a/google/protobuf/util/internal/testdata/timestamp_duration.proto b/google/protobuf/util/internal/testdata/timestamp_duration.proto index 56351f168cb00..b74484ce58dd9 100644 --- a/google/protobuf/util/internal/testdata/timestamp_duration.proto +++ b/google/protobuf/util/internal/testdata/timestamp_duration.proto @@ -28,20 +28,53 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// Proto to test proto3 Timestamp and Duration. syntax = "proto3"; -package google.protobuf.testing.timestampduration; -option java_package = "com.google.protobuf.testing.timestampduration"; +package google.protobuf.testing; import "google/protobuf/timestamp.proto"; import "google/protobuf/duration.proto"; +message TimestampDurationTestCases { + // Timestamp tests + TimeStampType epoch = 1; + TimeStampType epoch2 = 2; + TimeStampType mintime = 3; + TimeStampType maxtime = 4; + TimeStampType timeval1 = 5; + TimeStampType timeval2 = 6; + TimeStampType timeval3 = 7; + TimeStampType timeval4 = 8; + TimeStampType timeval5 = 9; + TimeStampType timeval6 = 10; + TimeStampType timeval7 = 11; + google.protobuf.Timestamp timeval8 = 12; + + // Duration tests + DurationType zero_duration = 101; + DurationType min_duration = 102; + DurationType max_duration = 103; + DurationType duration1 = 104; + DurationType duration2 = 105; + DurationType duration3 = 106; + DurationType duration4 = 107; + google.protobuf.Duration duration5 = 108; +} + +message TimeStampType { + google.protobuf.Timestamp timestamp = 1; +} + +message DurationType { + google.protobuf.Duration duration = 1; +} + +service TimestampDurationTestService { + rpc Call(TimestampDurationTestCases) returns (TimestampDurationTestCases); +} + message TimestampDuration { google.protobuf.Timestamp ts = 1; google.protobuf.Duration dur = 2; -} - -service TestService { - rpc Call(TimestampDuration) returns (TimestampDuration); + repeated google.protobuf.Timestamp rep_ts = 3; } diff --git a/google/protobuf/wrappers.proto b/google/protobuf/wrappers.proto index 4828ad9ae9391..01947639ac4e4 100644 --- a/google/protobuf/wrappers.proto +++ b/google/protobuf/wrappers.proto @@ -43,7 +43,6 @@ option go_package = "github.com/golang/protobuf/ptypes/wrappers"; option java_package = "com.google.protobuf"; option java_outer_classname = "WrappersProto"; option java_multiple_files = true; -option java_generate_equals_and_hash = true; option objc_class_prefix = "GPB"; // Wrapper message for `double`.