anys.proto 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  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. package google.protobuf.testing;
  32. import "google/protobuf/any.proto";
  33. import "google/protobuf/struct.proto";
  34. import "google/protobuf/timestamp.proto";
  35. import "google/protobuf/duration.proto";
  36. import "google/protobuf/wrappers.proto";
  37. // Top-level test cases proto used by MarshallingTest. See description
  38. // at the top of the class MarshallingTest for details on how to write
  39. // test cases.
  40. message AnyTestCases {
  41. AnyWrapper empty_any = 1;
  42. AnyWrapper type_only_any = 2;
  43. AnyWrapper wrapper_any = 3;
  44. AnyWrapper any_with_timestamp_value = 4;
  45. AnyWrapper any_with_duration_value = 5;
  46. AnyWrapper any_with_struct_value = 6;
  47. AnyWrapper recursive_any = 7;
  48. AnyWrapper any_with_message_value = 8;
  49. AnyWrapper any_with_nested_message = 9;
  50. AnyWrapper any_with_message_with_wrapper_type = 10;
  51. AnyWrapper any_with_message_with_timestamp = 11;
  52. AnyWrapper any_with_message_containing_map = 12;
  53. AnyWrapper any_with_message_containing_struct = 13;
  54. AnyWrapper any_with_message_containing_repeated_message = 14;
  55. AnyWrapper recursive_any_with_type_field_at_end = 15;
  56. google.protobuf.Any top_level_any = 50;
  57. google.protobuf.Any top_level_any_with_type_field_at_end = 51;
  58. }
  59. message AnyWrapper {
  60. google.protobuf.Any any = 1;
  61. }
  62. // Hack to make sure the types we put into the any are included in the types.
  63. // Real solution is to add these types to the service config.
  64. message Imports {
  65. google.protobuf.DoubleValue dbl = 1;
  66. google.protobuf.Struct struct = 2;
  67. google.protobuf.Timestamp timestamp = 3;
  68. google.protobuf.Duration duration = 4;
  69. google.protobuf.Int32Value i32 = 5;
  70. Data data = 100;
  71. }
  72. message Data {
  73. int32 attr = 1;
  74. string str = 2;
  75. repeated string msgs = 3;
  76. Data nested_data = 4;
  77. google.protobuf.Int32Value int_wrapper = 5;
  78. google.protobuf.Timestamp time = 6;
  79. map<string, string> map_data = 7;
  80. google.protobuf.Struct struct_data = 8;
  81. repeated Data repeated_data = 9;
  82. }
  83. service AnyTestService {
  84. rpc Call(AnyTestCases) returns (AnyTestCases);
  85. rpc Call1(Imports) returns (Imports);
  86. }
  87. message AnyIn {
  88. string something = 1;
  89. google.protobuf.Any any = 2;
  90. }
  91. message AnyOut {
  92. google.protobuf.Any any = 1;
  93. }
  94. message AnyM {
  95. string foo = 1;
  96. }