1 module google.protobuf.descriptor;
2 
3 import std.typecons : Yes;
4 
5 import google.protobuf;
6 
7 class FileDescriptorSet
8 {
9     @Proto(1) FileDescriptorProto[] files = protoDefaultValue!(FileDescriptorProto[]);
10 }
11 
12 class FileDescriptorProto
13 {
14     @Proto(1) string name = protoDefaultValue!string;
15     @Proto(2) string package_ = protoDefaultValue!string;
16     @Proto(3) string[] dependencies = protoDefaultValue!(string[]);
17     @Proto(4) DescriptorProto[] messageTypes = protoDefaultValue!(DescriptorProto[]);
18     @Proto(5) EnumDescriptorProto[] enumTypes = protoDefaultValue!(EnumDescriptorProto[]);
19     @Proto(6) ServiceDescriptorProto[] services = protoDefaultValue!(ServiceDescriptorProto[]);
20     @Proto(7) FieldDescriptorProto[] extensions = protoDefaultValue!(FieldDescriptorProto[]);
21     @Proto(8) FileOptions options = protoDefaultValue!FileOptions;
22     @Proto(9) SourceCodeInfo sourceCodeInfo = protoDefaultValue!SourceCodeInfo;
23     @Proto(10) int[] publicDependencies = protoDefaultValue!(int[]);
24     @Proto(11) int[] weakDependencies = protoDefaultValue!(int[]);
25     @Proto(12) string syntax = protoDefaultValue!string;
26 }
27 
28 class DescriptorProto
29 {
30     @Proto(1) string name = protoDefaultValue!string;
31     @Proto(2) FieldDescriptorProto[] fields = protoDefaultValue!(FieldDescriptorProto[]);
32     @Proto(3) DescriptorProto[] nestedTypes = protoDefaultValue!(DescriptorProto[]);
33     @Proto(4) EnumDescriptorProto[] enumTypes = protoDefaultValue!(EnumDescriptorProto[]);
34     @Proto(5) ExtensionRange[] extensionRanges = protoDefaultValue!(ExtensionRange[]);
35     @Proto(6) FieldDescriptorProto[] extensions = protoDefaultValue!(FieldDescriptorProto[]);
36     @Proto(7) MessageOptions options = protoDefaultValue!MessageOptions;
37     @Proto(8) OneofDescriptorProto[] oneofDecls = protoDefaultValue!(OneofDescriptorProto[]);
38     @Proto(9) ReservedRange[] reservedRanges = protoDefaultValue!(ReservedRange[]);
39     @Proto(10) string[] reservedNames = protoDefaultValue!(string[]);
40 
41     static class ExtensionRange
42     {
43         @Proto(1) int start = protoDefaultValue!int;
44         @Proto(2) int end = protoDefaultValue!int;
45         @Proto(3) ExtensionRangeOptions options = protoDefaultValue!ExtensionRangeOptions;
46     }
47 
48     static class ReservedRange
49     {
50         @Proto(1) int start = protoDefaultValue!int;
51         @Proto(2) int end = protoDefaultValue!int;
52     }
53 }
54 
55 class ExtensionRangeOptions
56 {
57     @Proto(999) UninterpretedOption[] uninterpretedOptions = protoDefaultValue!(UninterpretedOption[]);
58 }
59 
60 class FieldDescriptorProto
61 {
62     @Proto(1) string name = protoDefaultValue!string;
63     @Proto(2) string extendee = protoDefaultValue!string;
64     @Proto(3) int number = protoDefaultValue!int;
65     @Proto(4) Label label = protoDefaultValue!Label;
66     @Proto(5) Type type = protoDefaultValue!Type;
67     @Proto(6) string typeName = protoDefaultValue!string;
68     @Proto(7) string defaultValue = protoDefaultValue!string;
69     @Proto(8) FieldOptions options = protoDefaultValue!FieldOptions;
70     @Proto(9) int oneofIndex = -1;
71     @Proto(10) string jsonName = protoDefaultValue!string;
72 
73     enum Type
74     {
75         TYPE_ERROR = 0,
76         TYPE_DOUBLE = 1,
77         TYPE_FLOAT = 2,
78         TYPE_INT64 = 3,
79         TYPE_UINT64 = 4,
80         TYPE_INT32 = 5,
81         TYPE_FIXED64 = 6,
82         TYPE_FIXED32 = 7,
83         TYPE_BOOL = 8,
84         TYPE_STRING = 9,
85         TYPE_GROUP = 10,
86         TYPE_MESSAGE = 11,
87         TYPE_BYTES = 12,
88         TYPE_UINT32 = 13,
89         TYPE_ENUM = 14,
90         TYPE_SFIXED32 = 15,
91         TYPE_SFIXED64 = 16,
92         TYPE_SINT32 = 17,
93         TYPE_SINT64 = 18,
94     }
95 
96     enum Label
97     {
98         LABEL_ERROR = 0,
99         LABEL_OPTIONAL = 1,
100         LABEL_REQUIRED = 2,
101         LABEL_REPEATED = 3,
102     }
103 }
104 
105 class OneofDescriptorProto
106 {
107     @Proto(1) string name = protoDefaultValue!string;
108     @Proto(2) OneofOptions options = protoDefaultValue!OneofOptions;
109 }
110 
111 class EnumDescriptorProto
112 {
113     @Proto(1) string name = protoDefaultValue!string;
114     @Proto(2) EnumValueDescriptorProto[] values = protoDefaultValue!(EnumValueDescriptorProto[]);
115     @Proto(3) EnumOptions options = protoDefaultValue!EnumOptions;
116     @Proto(4) EnumReservedRange[] reservedRanges = protoDefaultValue!(EnumReservedRange[]);
117     @Proto(5) string[] reservedNames = protoDefaultValue!(string[]);
118 
119     static class EnumReservedRange
120     {
121         @Proto(1) int start = protoDefaultValue!int;
122         @Proto(2) int end = protoDefaultValue!int;
123     }
124 }
125 
126 class EnumValueDescriptorProto
127 {
128     @Proto(1) string name = protoDefaultValue!string;
129     @Proto(2) int number = protoDefaultValue!int;
130     @Proto(3) EnumValueOptions options = protoDefaultValue!EnumValueOptions;
131 }
132 
133 class ServiceDescriptorProto
134 {
135     @Proto(1) string name = protoDefaultValue!string;
136     @Proto(2) MethodDescriptorProto[] method = protoDefaultValue!(MethodDescriptorProto[]);
137     @Proto(3) ServiceOptions options = protoDefaultValue!ServiceOptions;
138 }
139 
140 class MethodDescriptorProto
141 {
142     @Proto(1) string name = protoDefaultValue!string;
143     @Proto(2) string inputType = protoDefaultValue!string;
144     @Proto(3) string outputType = protoDefaultValue!string;
145     @Proto(4) MethodOptions options = protoDefaultValue!MethodOptions;
146     @Proto(5) bool clientStreaming = protoDefaultValue!bool;
147     @Proto(6) bool serverStreaming = protoDefaultValue!bool;
148 }
149 
150 class FileOptions
151 {
152     @Proto(1) string javaPackage = protoDefaultValue!string;
153     @Proto(8) string javaOuterClassname = protoDefaultValue!string;
154     @Proto(9) OptimizeMode optimizeFor = protoDefaultValue!OptimizeMode;
155     @Proto(10) bool javaMultipleFiles = protoDefaultValue!bool;
156     @Proto(11) string goPackage = protoDefaultValue!string;
157     @Proto(16) bool ccGenericServices = protoDefaultValue!bool;
158     @Proto(17) bool javaGenericServices = protoDefaultValue!bool;
159     @Proto(18) bool pyGenericServices = protoDefaultValue!bool;
160     @Proto(20) bool javaGenerateEqualsAndHash = protoDefaultValue!bool;
161     @Proto(23) bool deprecated_ = protoDefaultValue!bool;
162     @Proto(27) bool javaStringCheckUtf8 = protoDefaultValue!bool;
163     @Proto(31) bool ccEnableArenas = protoDefaultValue!bool;
164     @Proto(36) string objcClassPrefix = protoDefaultValue!string;
165     @Proto(37) string csharpNamespace = protoDefaultValue!string;
166     @Proto(39) string swiftPrefix = protoDefaultValue!string;
167     @Proto(40) string phpClassPrefix = protoDefaultValue!string;
168     @Proto(41) string phpNamespace = protoDefaultValue!string;
169     @Proto(42) bool phpGenericServices = protoDefaultValue!bool;
170     @Proto(999) UninterpretedOption[] uninterpretedOptions = protoDefaultValue!(UninterpretedOption[]);
171 
172     enum OptimizeMode
173     {
174         UNKNOWN = 0,
175         SPEED = 1,
176         CODE_SIZE = 2,
177         LITE_RUNTIME = 3,
178     }
179 }
180 
181 class MessageOptions
182 {
183     @Proto(1) bool messageSetWireFormat = protoDefaultValue!bool;
184     @Proto(2) bool noStandardDescriptorAccessor = protoDefaultValue!bool;
185     @Proto(3) bool deprecated_ = protoDefaultValue!bool;
186     @Proto(7) bool mapEntry = protoDefaultValue!bool;
187     @Proto(999) UninterpretedOption[] uninterpretedOptions = protoDefaultValue!(UninterpretedOption[]);
188 }
189 
190 class FieldOptions
191 {
192     @Proto(1) CType ctype = protoDefaultValue!CType;
193     @Proto(2) bool packed = protoDefaultValue!bool;
194     @Proto(3) bool deprecated_ = protoDefaultValue!bool;
195     @Proto(5) bool lazy_ = protoDefaultValue!bool;
196     @Proto(6) JSType jstype = protoDefaultValue!JSType;
197     @Proto(10) bool weak = protoDefaultValue!bool;
198     @Proto(999) UninterpretedOption[] uninterpretedOptions = protoDefaultValue!(UninterpretedOption[]);
199 
200     enum CType
201     {
202         STRING = 0,
203         CORD = 1,
204         STRING_PIECE = 2,
205     }
206 
207     enum JSType
208     {
209         JS_NORMAL = 0,
210         JS_STRING = 1,
211         JS_NUMBER = 2,
212     }
213 }
214 
215 class OneofOptions
216 {
217     @Proto(999) UninterpretedOption[] uninterpretedOptions = protoDefaultValue!(UninterpretedOption[]);
218 }
219 
220 class EnumOptions
221 {
222     @Proto(2) bool allowAlias = protoDefaultValue!bool;
223     @Proto(3) bool deprecated_ = protoDefaultValue!bool;
224     @Proto(999) UninterpretedOption[] uninterpretedOptions = protoDefaultValue!(UninterpretedOption[]);
225 }
226 
227 class EnumValueOptions
228 {
229     @Proto(1) bool deprecated_ = protoDefaultValue!bool;
230     @Proto(999) UninterpretedOption[] uninterpretedOptions = protoDefaultValue!(UninterpretedOption[]);
231 }
232 
233 class ServiceOptions
234 {
235     @Proto(33) bool deprecated_ = protoDefaultValue!bool;
236     @Proto(999) UninterpretedOption[] uninterpretedOptions = protoDefaultValue!(UninterpretedOption[]);
237 }
238 
239 class MethodOptions
240 {
241     @Proto(33) bool deprecated_ = protoDefaultValue!bool;
242     @Proto(34) IdempotencyLevel idempotencyLevel = protoDefaultValue!IdempotencyLevel;
243     @Proto(999) UninterpretedOption[] uninterpretedOptions = protoDefaultValue!(UninterpretedOption[]);
244 
245     enum IdempotencyLevel
246     {
247         IDEMPOTENCY_UNKNOWN = 0,
248         NO_SIDE_EFFECTS = 1,
249         IDEMPOTENT = 2,
250     }
251 }
252 
253 class UninterpretedOption
254 {
255     @Proto(2) NamePart[] names = protoDefaultValue!(NamePart[]);
256     @Proto(3) string identifierValue = protoDefaultValue!string;
257     @Proto(4) ulong positiveIntValue = protoDefaultValue!ulong;
258     @Proto(5) long negativeIntValue = protoDefaultValue!long;
259     @Proto(6) double doubleValue = protoDefaultValue!double;
260     @Proto(7) bytes stringValue = protoDefaultValue!bytes;
261     @Proto(8) string aggregateValue = protoDefaultValue!string;
262 
263     static class NamePart
264     {
265         @Proto(1) string namePart = protoDefaultValue!string;
266         @Proto(2) bool isExtension = protoDefaultValue!bool;
267     }
268 }
269 
270 class SourceCodeInfo
271 {
272     @Proto(1) Location[] location = protoDefaultValue!(Location[]);
273 
274     static class Location
275     {
276         @Proto(1, Wire.none, Yes.packed) int[] path = protoDefaultValue!(int[]);
277         @Proto(2, Wire.none, Yes.packed) int[] span = protoDefaultValue!(int[]);
278         @Proto(3) string leadingComments = protoDefaultValue!string;
279         @Proto(4) string trailingComments = protoDefaultValue!string;
280         @Proto(6) string[] leadingDetachedComments = protoDefaultValue!(string[]);
281     }
282 }
283 
284 class GeneratedCodeInfo
285 {
286     @Proto(1) Annotation[] annotations = protoDefaultValue!(Annotation[]);
287 
288     static class Annotation
289     {
290         @Proto(1, Wire.none, Yes.packed) int[] path = protoDefaultValue!(int[]);
291         @Proto(2) string sourceFile = protoDefaultValue!string;
292         @Proto(3) int begin = protoDefaultValue!int;
293         @Proto(4) int end = protoDefaultValue!int;
294     }
295 }