type.proto 6.0 KB

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