json_format_proto3.proto 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  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 proto3;
  32. option java_package = "com.google.protobuf.util";
  33. option java_outer_classname = "JsonFormatProto3";
  34. import "google/protobuf/duration.proto";
  35. import "google/protobuf/timestamp.proto";
  36. import "google/protobuf/wrappers.proto";
  37. import "google/protobuf/struct.proto";
  38. import "google/protobuf/any.proto";
  39. import "google/protobuf/field_mask.proto";
  40. import "google/protobuf/unittest.proto";
  41. enum EnumType {
  42. FOO = 0;
  43. BAR = 1;
  44. }
  45. message MessageType {
  46. int32 value = 1;
  47. }
  48. message TestMessage {
  49. bool bool_value = 1;
  50. int32 int32_value = 2;
  51. int64 int64_value = 3;
  52. uint32 uint32_value = 4;
  53. uint64 uint64_value = 5;
  54. float float_value = 6;
  55. double double_value = 7;
  56. string string_value = 8;
  57. bytes bytes_value = 9;
  58. EnumType enum_value = 10;
  59. MessageType message_value = 11;
  60. repeated bool repeated_bool_value = 21;
  61. repeated int32 repeated_int32_value = 22;
  62. repeated int64 repeated_int64_value = 23;
  63. repeated uint32 repeated_uint32_value = 24;
  64. repeated uint64 repeated_uint64_value = 25;
  65. repeated float repeated_float_value = 26;
  66. repeated double repeated_double_value = 27;
  67. repeated string repeated_string_value = 28;
  68. repeated bytes repeated_bytes_value = 29;
  69. repeated EnumType repeated_enum_value = 30;
  70. repeated MessageType repeated_message_value = 31;
  71. }
  72. message TestOneof {
  73. // In JSON format oneof fields behave mostly the same as optional
  74. // fields except that:
  75. // 1. Oneof fields have field presence information and will be
  76. // printed if it's set no matter whether it's the default value.
  77. // 2. Multiple oneof fields in the same oneof cannot appear at the
  78. // same time in the input.
  79. oneof oneof_value {
  80. int32 oneof_int32_value = 1;
  81. string oneof_string_value = 2;
  82. bytes oneof_bytes_value = 3;
  83. EnumType oneof_enum_value = 4;
  84. MessageType oneof_message_value = 5;
  85. }
  86. }
  87. message TestMap {
  88. map<bool, int32> bool_map = 1;
  89. map<int32, int32> int32_map = 2;
  90. map<int64, int32> int64_map = 3;
  91. map<uint32, int32> uint32_map = 4;
  92. map<uint64, int32> uint64_map = 5;
  93. map<string, int32> string_map = 6;
  94. }
  95. message TestNestedMap {
  96. map<bool, int32> bool_map = 1;
  97. map<int32, int32> int32_map = 2;
  98. map<int64, int32> int64_map = 3;
  99. map<uint32, int32> uint32_map = 4;
  100. map<uint64, int32> uint64_map = 5;
  101. map<string, int32> string_map = 6;
  102. map<string, TestNestedMap> map_map = 7;
  103. }
  104. message TestWrapper {
  105. google.protobuf.BoolValue bool_value = 1;
  106. google.protobuf.Int32Value int32_value = 2;
  107. google.protobuf.Int64Value int64_value = 3;
  108. google.protobuf.UInt32Value uint32_value = 4;
  109. google.protobuf.UInt64Value uint64_value = 5;
  110. google.protobuf.FloatValue float_value = 6;
  111. google.protobuf.DoubleValue double_value = 7;
  112. google.protobuf.StringValue string_value = 8;
  113. google.protobuf.BytesValue bytes_value = 9;
  114. repeated google.protobuf.BoolValue repeated_bool_value = 11;
  115. repeated google.protobuf.Int32Value repeated_int32_value = 12;
  116. repeated google.protobuf.Int64Value repeated_int64_value = 13;
  117. repeated google.protobuf.UInt32Value repeated_uint32_value = 14;
  118. repeated google.protobuf.UInt64Value repeated_uint64_value = 15;
  119. repeated google.protobuf.FloatValue repeated_float_value = 16;
  120. repeated google.protobuf.DoubleValue repeated_double_value = 17;
  121. repeated google.protobuf.StringValue repeated_string_value = 18;
  122. repeated google.protobuf.BytesValue repeated_bytes_value = 19;
  123. }
  124. message TestTimestamp {
  125. google.protobuf.Timestamp value = 1;
  126. repeated google.protobuf.Timestamp repeated_value = 2;
  127. }
  128. message TestDuration {
  129. google.protobuf.Duration value = 1;
  130. repeated google.protobuf.Duration repeated_value = 2;
  131. }
  132. message TestFieldMask {
  133. google.protobuf.FieldMask value = 1;
  134. }
  135. message TestStruct {
  136. google.protobuf.Struct value = 1;
  137. repeated google.protobuf.Struct repeated_value = 2;
  138. }
  139. message TestAny {
  140. google.protobuf.Any value = 1;
  141. repeated google.protobuf.Any repeated_value = 2;
  142. }
  143. message TestValue {
  144. google.protobuf.Value value = 1;
  145. repeated google.protobuf.Value repeated_value = 2;
  146. }
  147. message TestListValue {
  148. google.protobuf.ListValue value = 1;
  149. repeated google.protobuf.ListValue repeated_value = 2;
  150. }
  151. message TestBoolValue {
  152. bool bool_value = 1;
  153. map<bool, int32> bool_map = 2;
  154. }
  155. message TestCustomJsonName {
  156. int32 value = 1 [json_name = "@value"];
  157. }
  158. message TestExtensions {
  159. .protobuf_unittest.TestAllExtensions extensions = 1;
  160. }
  161. message TestEnumValue{
  162. EnumType enum_value1 = 1;
  163. EnumType enum_value2 = 2;
  164. EnumType enum_value3 = 3;
  165. }