type.proto 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  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;
  32. import "google/protobuf/any.proto";
  33. import "google/protobuf/source_context.proto";
  34. option cc_enable_arenas = true;
  35. option java_package = "com.google.protobuf";
  36. option java_outer_classname = "TypeProto";
  37. option java_multiple_files = true;
  38. option objc_class_prefix = "GPB";
  39. option csharp_namespace = "Google.Protobuf.WellKnownTypes";
  40. option go_package = "google.golang.org/protobuf/types/known/typepb";
  41. // A protocol buffer message type.
  42. message Type {
  43. // The fully qualified message name.
  44. string name = 1;
  45. // The list of fields.
  46. repeated Field fields = 2;
  47. // The list of types appearing in `oneof` definitions in this type.
  48. repeated string oneofs = 3;
  49. // The protocol buffer options.
  50. repeated Option options = 4;
  51. // The source context.
  52. SourceContext source_context = 5;
  53. // The source syntax.
  54. Syntax syntax = 6;
  55. // The source edition string, only valid when syntax is SYNTAX_EDITIONS.
  56. string edition = 7;
  57. }
  58. // A single field of a message type.
  59. message Field {
  60. // Basic field types.
  61. enum Kind {
  62. // Field type unknown.
  63. TYPE_UNKNOWN = 0;
  64. // Field type double.
  65. TYPE_DOUBLE = 1;
  66. // Field type float.
  67. TYPE_FLOAT = 2;
  68. // Field type int64.
  69. TYPE_INT64 = 3;
  70. // Field type uint64.
  71. TYPE_UINT64 = 4;
  72. // Field type int32.
  73. TYPE_INT32 = 5;
  74. // Field type fixed64.
  75. TYPE_FIXED64 = 6;
  76. // Field type fixed32.
  77. TYPE_FIXED32 = 7;
  78. // Field type bool.
  79. TYPE_BOOL = 8;
  80. // Field type string.
  81. TYPE_STRING = 9;
  82. // Field type group. Proto2 syntax only, and deprecated.
  83. TYPE_GROUP = 10;
  84. // Field type message.
  85. TYPE_MESSAGE = 11;
  86. // Field type bytes.
  87. TYPE_BYTES = 12;
  88. // Field type uint32.
  89. TYPE_UINT32 = 13;
  90. // Field type enum.
  91. TYPE_ENUM = 14;
  92. // Field type sfixed32.
  93. TYPE_SFIXED32 = 15;
  94. // Field type sfixed64.
  95. TYPE_SFIXED64 = 16;
  96. // Field type sint32.
  97. TYPE_SINT32 = 17;
  98. // Field type sint64.
  99. TYPE_SINT64 = 18;
  100. }
  101. // Whether a field is optional, required, or repeated.
  102. enum Cardinality {
  103. // For fields with unknown cardinality.
  104. CARDINALITY_UNKNOWN = 0;
  105. // For optional fields.
  106. CARDINALITY_OPTIONAL = 1;
  107. // For required fields. Proto2 syntax only.
  108. CARDINALITY_REQUIRED = 2;
  109. // For repeated fields.
  110. CARDINALITY_REPEATED = 3;
  111. }
  112. // The field type.
  113. Kind kind = 1;
  114. // The field cardinality.
  115. Cardinality cardinality = 2;
  116. // The field number.
  117. int32 number = 3;
  118. // The field name.
  119. string name = 4;
  120. // The field type URL, without the scheme, for message or enumeration
  121. // types. Example: `"type.googleapis.com/google.protobuf.Timestamp"`.
  122. string type_url = 6;
  123. // The index of the field type in `Type.oneofs`, for message or enumeration
  124. // types. The first type has index 1; zero means the type is not in the list.
  125. int32 oneof_index = 7;
  126. // Whether to use alternative packed wire representation.
  127. bool packed = 8;
  128. // The protocol buffer options.
  129. repeated Option options = 9;
  130. // The field JSON name.
  131. string json_name = 10;
  132. // The string value of the default value of this field. Proto2 syntax only.
  133. string default_value = 11;
  134. }
  135. // Enum type definition.
  136. message Enum {
  137. // Enum type name.
  138. string name = 1;
  139. // Enum value definitions.
  140. repeated EnumValue enumvalue = 2;
  141. // Protocol buffer options.
  142. repeated Option options = 3;
  143. // The source context.
  144. SourceContext source_context = 4;
  145. // The source syntax.
  146. Syntax syntax = 5;
  147. // The source edition string, only valid when syntax is SYNTAX_EDITIONS.
  148. string edition = 6;
  149. }
  150. // Enum value definition.
  151. message EnumValue {
  152. // Enum value name.
  153. string name = 1;
  154. // Enum value number.
  155. int32 number = 2;
  156. // Protocol buffer options.
  157. repeated Option options = 3;
  158. }
  159. // A protocol buffer option, which can be attached to a message, field,
  160. // enumeration, etc.
  161. message Option {
  162. // The option's name. For protobuf built-in options (options defined in
  163. // descriptor.proto), this is the short name. For example, `"map_entry"`.
  164. // For custom options, it should be the fully-qualified name. For example,
  165. // `"google.api.http"`.
  166. string name = 1;
  167. // The option's value packed in an Any message. If the value is a primitive,
  168. // the corresponding wrapper type defined in google/protobuf/wrappers.proto
  169. // should be used. If the value is an enum, it should be stored as an int32
  170. // value using the google.protobuf.Int32Value type.
  171. Any value = 2;
  172. }
  173. // The syntax in which a protocol buffer element is defined.
  174. enum Syntax {
  175. // Syntax `proto2`.
  176. SYNTAX_PROTO2 = 0;
  177. // Syntax `proto3`.
  178. SYNTAX_PROTO3 = 1;
  179. // Syntax `editions`.
  180. SYNTAX_EDITIONS = 2;
  181. }