Debian Codegraph @

third_party/google/protobuf/type.proto

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