OLD | NEW |
1 // Protocol Buffers - Google's data interchange format | 1 // Protocol Buffers - Google's data interchange format |
2 // Copyright 2008 Google Inc. All rights reserved. | 2 // Copyright 2008 Google Inc. All rights reserved. |
3 // https://developers.google.com/protocol-buffers/ | 3 // https://developers.google.com/protocol-buffers/ |
4 // | 4 // |
5 // Redistribution and use in source and binary forms, with or without | 5 // Redistribution and use in source and binary forms, with or without |
6 // modification, are permitted provided that the following conditions are | 6 // modification, are permitted provided that the following conditions are |
7 // met: | 7 // met: |
8 // | 8 // |
9 // * Redistributions of source code must retain the above copyright | 9 // * Redistributions of source code must retain the above copyright |
10 // notice, this list of conditions and the following disclaimer. | 10 // notice, this list of conditions and the following disclaimer. |
(...skipping 10 matching lines...) Expand all Loading... |
21 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | 21 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
22 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | 22 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
23 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 23 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
24 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 24 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
25 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 25 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
26 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 26 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
27 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 27 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
28 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 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. | 29 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
30 | 30 |
31 // Proto to test Proto3 Any serialization. | |
32 syntax = "proto3"; | 31 syntax = "proto3"; |
33 | 32 |
34 package google.protobuf.testing.anys; | 33 package google.protobuf.testing; |
35 option java_package = "com.google.protobuf.testing.anys"; | |
36 | 34 |
37 import "google/protobuf/any.proto"; | 35 import "google/protobuf/any.proto"; |
| 36 import "google/protobuf/struct.proto"; |
| 37 import "google/protobuf/timestamp.proto"; |
| 38 import "google/protobuf/duration.proto"; |
| 39 import "google/protobuf/wrappers.proto"; |
| 40 |
| 41 // Top-level test cases proto used by MarshallingTest. See description |
| 42 // at the top of the class MarshallingTest for details on how to write |
| 43 // test cases. |
| 44 message AnyTestCases { |
| 45 AnyWrapper empty_any = 1; |
| 46 AnyWrapper type_only_any = 2; |
| 47 AnyWrapper wrapper_any = 3; |
| 48 AnyWrapper any_with_timestamp_value = 4; |
| 49 AnyWrapper any_with_duration_value = 5; |
| 50 AnyWrapper any_with_struct_value = 6; |
| 51 AnyWrapper recursive_any = 7; |
| 52 AnyWrapper any_with_message_value = 8; |
| 53 AnyWrapper any_with_nested_message = 9; |
| 54 AnyWrapper any_with_message_with_wrapper_type = 10; |
| 55 AnyWrapper any_with_message_with_timestamp = 11; |
| 56 AnyWrapper any_with_message_containing_map = 12; |
| 57 AnyWrapper any_with_message_containing_struct = 13; |
| 58 AnyWrapper any_with_message_containing_repeated_message = 14; |
| 59 AnyWrapper recursive_any_with_type_field_at_end = 15; |
| 60 |
| 61 google.protobuf.Any top_level_any = 50; |
| 62 google.protobuf.Any top_level_any_with_type_field_at_end = 51; |
| 63 } |
| 64 |
| 65 message AnyWrapper { |
| 66 google.protobuf.Any any = 1; |
| 67 } |
| 68 |
| 69 // Hack to make sure the types we put into the any are included in the types. |
| 70 // Real solution is to add these types to the service config. |
| 71 message Imports { |
| 72 google.protobuf.DoubleValue dbl = 1; |
| 73 google.protobuf.Struct struct = 2; |
| 74 google.protobuf.Timestamp timestamp = 3; |
| 75 google.protobuf.Duration duration = 4; |
| 76 google.protobuf.Int32Value i32 = 5; |
| 77 Data data = 100; |
| 78 } |
| 79 |
| 80 message Data { |
| 81 int32 attr = 1; |
| 82 string str = 2; |
| 83 repeated string msgs = 3; |
| 84 Data nested_data = 4; |
| 85 google.protobuf.Int32Value int_wrapper = 5; |
| 86 google.protobuf.Timestamp time = 6; |
| 87 map<string, string> map_data = 7; |
| 88 google.protobuf.Struct struct_data = 8; |
| 89 repeated Data repeated_data = 9; |
| 90 } |
| 91 |
| 92 service AnyTestService { |
| 93 rpc Call(AnyTestCases) returns (AnyTestCases); |
| 94 rpc Call1(Imports) returns (Imports); |
| 95 } |
38 | 96 |
39 message AnyIn { | 97 message AnyIn { |
40 string something = 1; | 98 string something = 1; |
| 99 google.protobuf.Any any = 2; |
41 } | 100 } |
42 | 101 |
43 message AnyOut { | 102 message AnyOut { |
44 google.protobuf.Any any = 1; | 103 google.protobuf.Any any = 1; |
45 } | 104 } |
46 | 105 |
47 message AnyM { | 106 message AnyM { |
48 string foo = 1; | 107 string foo = 1; |
49 } | 108 } |
50 | |
51 service TestService { | |
52 rpc Call(AnyIn) returns (AnyOut); | |
53 } | |
OLD | NEW |