type.proto 5.7 KB

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