protobuf 3.10.3 → 3.10.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -40,11 +40,13 @@
40
40
  syntax = "proto2";
41
41
 
42
42
  package google.protobuf;
43
- option go_package = "descriptor";
43
+
44
+ option go_package = "google.golang.org/protobuf/types/descriptorpb";
44
45
  option java_package = "com.google.protobuf";
45
46
  option java_outer_classname = "DescriptorProtos";
46
47
  option csharp_namespace = "Google.Protobuf.Reflection";
47
48
  option objc_class_prefix = "GPB";
49
+ option cc_enable_arenas = true;
48
50
 
49
51
  // descriptor.proto must be optimized for speed because reflection-based
50
52
  // algorithms don't work during bootstrapping.
@@ -58,8 +60,8 @@ message FileDescriptorSet {
58
60
 
59
61
  // Describes a complete .proto file.
60
62
  message FileDescriptorProto {
61
- optional string name = 1; // file name, relative to root of source tree
62
- optional string package = 2; // e.g. "foo", "foo.bar", etc.
63
+ optional string name = 1; // file name, relative to root of source tree
64
+ optional string package = 2; // e.g. "foo", "foo.bar", etc.
63
65
 
64
66
  // Names of files imported by this file.
65
67
  repeated string dependency = 3;
@@ -99,8 +101,10 @@ message DescriptorProto {
99
101
  repeated EnumDescriptorProto enum_type = 4;
100
102
 
101
103
  message ExtensionRange {
102
- optional int32 start = 1;
103
- optional int32 end = 2;
104
+ optional int32 start = 1; // Inclusive.
105
+ optional int32 end = 2; // Exclusive.
106
+
107
+ optional ExtensionRangeOptions options = 3;
104
108
  }
105
109
  repeated ExtensionRange extension_range = 5;
106
110
 
@@ -112,8 +116,8 @@ message DescriptorProto {
112
116
  // fields or extension ranges in the same message. Reserved ranges may
113
117
  // not overlap.
114
118
  message ReservedRange {
115
- optional int32 start = 1; // Inclusive.
116
- optional int32 end = 2; // Exclusive.
119
+ optional int32 start = 1; // Inclusive.
120
+ optional int32 end = 2; // Exclusive.
117
121
  }
118
122
  repeated ReservedRange reserved_range = 9;
119
123
  // Reserved field names, which may not be used by fields in the same message.
@@ -121,44 +125,56 @@ message DescriptorProto {
121
125
  repeated string reserved_name = 10;
122
126
  }
123
127
 
128
+ message ExtensionRangeOptions {
129
+ // The parser stores options it doesn't recognize here. See above.
130
+ repeated UninterpretedOption uninterpreted_option = 999;
131
+
132
+
133
+ // Clients can define custom options in extensions of this message. See above.
134
+ extensions 1000 to max;
135
+ }
136
+
124
137
  // Describes a field within a message.
125
138
  message FieldDescriptorProto {
126
139
  enum Type {
127
140
  // 0 is reserved for errors.
128
141
  // Order is weird for historical reasons.
129
- TYPE_DOUBLE = 1;
130
- TYPE_FLOAT = 2;
142
+ TYPE_DOUBLE = 1;
143
+ TYPE_FLOAT = 2;
131
144
  // Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT64 if
132
145
  // negative values are likely.
133
- TYPE_INT64 = 3;
134
- TYPE_UINT64 = 4;
146
+ TYPE_INT64 = 3;
147
+ TYPE_UINT64 = 4;
135
148
  // Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT32 if
136
149
  // negative values are likely.
137
- TYPE_INT32 = 5;
138
- TYPE_FIXED64 = 6;
139
- TYPE_FIXED32 = 7;
140
- TYPE_BOOL = 8;
141
- TYPE_STRING = 9;
142
- TYPE_GROUP = 10; // Tag-delimited aggregate.
143
- TYPE_MESSAGE = 11; // Length-delimited aggregate.
150
+ TYPE_INT32 = 5;
151
+ TYPE_FIXED64 = 6;
152
+ TYPE_FIXED32 = 7;
153
+ TYPE_BOOL = 8;
154
+ TYPE_STRING = 9;
155
+ // Tag-delimited aggregate.
156
+ // Group type is deprecated and not supported in proto3. However, Proto3
157
+ // implementations should still be able to parse the group wire format and
158
+ // treat group fields as unknown fields.
159
+ TYPE_GROUP = 10;
160
+ TYPE_MESSAGE = 11; // Length-delimited aggregate.
144
161
 
145
162
  // New in version 2.
146
- TYPE_BYTES = 12;
147
- TYPE_UINT32 = 13;
148
- TYPE_ENUM = 14;
149
- TYPE_SFIXED32 = 15;
150
- TYPE_SFIXED64 = 16;
151
- TYPE_SINT32 = 17; // Uses ZigZag encoding.
152
- TYPE_SINT64 = 18; // Uses ZigZag encoding.
153
- };
163
+ TYPE_BYTES = 12;
164
+ TYPE_UINT32 = 13;
165
+ TYPE_ENUM = 14;
166
+ TYPE_SFIXED32 = 15;
167
+ TYPE_SFIXED64 = 16;
168
+ TYPE_SINT32 = 17; // Uses ZigZag encoding.
169
+ TYPE_SINT64 = 18; // Uses ZigZag encoding.
170
+ }
154
171
 
155
172
  enum Label {
156
173
  // 0 is reserved for errors
157
- LABEL_OPTIONAL = 1;
158
- LABEL_REQUIRED = 2;
159
- LABEL_REPEATED = 3;
160
- // TODO(sanjay): Should we add LABEL_MAP?
161
- };
174
+ LABEL_OPTIONAL = 1;
175
+ LABEL_REQUIRED = 2;
176
+ LABEL_REPEATED = 3;
177
+ }
162
178
 
163
179
  optional string name = 1;
164
180
  optional int32 number = 3;
@@ -197,11 +213,35 @@ message FieldDescriptorProto {
197
213
  optional string json_name = 10;
198
214
 
199
215
  optional FieldOptions options = 8;
216
+
217
+ // If true, this is a proto3 "optional". When a proto3 field is optional, it
218
+ // tracks presence regardless of field type.
219
+ //
220
+ // When proto3_optional is true, this field must be belong to a oneof to
221
+ // signal to old proto3 clients that presence is tracked for this field. This
222
+ // oneof is known as a "synthetic" oneof, and this field must be its sole
223
+ // member (each proto3 optional field gets its own synthetic oneof). Synthetic
224
+ // oneofs exist in the descriptor only, and do not generate any API. Synthetic
225
+ // oneofs must be ordered after all "real" oneofs.
226
+ //
227
+ // For message fields, proto3_optional doesn't create any semantic change,
228
+ // since non-repeated message fields always track presence. However it still
229
+ // indicates the semantic detail of whether the user wrote "optional" or not.
230
+ // This can be useful for round-tripping the .proto file. For consistency we
231
+ // give message fields a synthetic oneof also, even though it is not required
232
+ // to track presence. This is especially important because the parser can't
233
+ // tell if a field is a message or an enum, so it must always create a
234
+ // synthetic oneof.
235
+ //
236
+ // Proto2 optional fields do not set this flag, because they already indicate
237
+ // optional with `LABEL_OPTIONAL`.
238
+ optional bool proto3_optional = 17;
200
239
  }
201
240
 
202
241
  // Describes a oneof.
203
242
  message OneofDescriptorProto {
204
243
  optional string name = 1;
244
+ optional OneofOptions options = 2;
205
245
  }
206
246
 
207
247
  // Describes an enum type.
@@ -211,6 +251,26 @@ message EnumDescriptorProto {
211
251
  repeated EnumValueDescriptorProto value = 2;
212
252
 
213
253
  optional EnumOptions options = 3;
254
+
255
+ // Range of reserved numeric values. Reserved values may not be used by
256
+ // entries in the same enum. Reserved ranges may not overlap.
257
+ //
258
+ // Note that this is distinct from DescriptorProto.ReservedRange in that it
259
+ // is inclusive such that it can appropriately represent the entire int32
260
+ // domain.
261
+ message EnumReservedRange {
262
+ optional int32 start = 1; // Inclusive.
263
+ optional int32 end = 2; // Inclusive.
264
+ }
265
+
266
+ // Range of reserved numeric values. Reserved numeric values may not be used
267
+ // by enum values in the same enum declaration. Reserved ranges may not
268
+ // overlap.
269
+ repeated EnumReservedRange reserved_range = 4;
270
+
271
+ // Reserved enum value names, which may not be reused. A given name may only
272
+ // be reserved once.
273
+ repeated string reserved_name = 5;
214
274
  }
215
275
 
216
276
  // Describes a value within an enum.
@@ -241,9 +301,9 @@ message MethodDescriptorProto {
241
301
  optional MethodOptions options = 4;
242
302
 
243
303
  // Identifies if client streams multiple client messages
244
- optional bool client_streaming = 5 [default=false];
304
+ optional bool client_streaming = 5 [default = false];
245
305
  // Identifies if server streams multiple server messages
246
- optional bool server_streaming = 6 [default=false];
306
+ optional bool server_streaming = 6 [default = false];
247
307
  }
248
308
 
249
309
 
@@ -279,7 +339,6 @@ message MethodDescriptorProto {
279
339
  // If this turns out to be popular, a web service will be set up
280
340
  // to automatically assign option numbers.
281
341
 
282
-
283
342
  message FileOptions {
284
343
 
285
344
  // Sets the Java package where classes generated from this .proto will be
@@ -289,34 +348,23 @@ message FileOptions {
289
348
  optional string java_package = 1;
290
349
 
291
350
 
292
- // If set, all the classes from the .proto file are wrapped in a single
293
- // outer class with the given name. This applies to both Proto1
294
- // (equivalent to the old "--one_java_file" option) and Proto2 (where
295
- // a .proto always translates to a single class, but you may want to
296
- // explicitly choose the class name).
351
+ // Controls the name of the wrapper Java class generated for the .proto file.
352
+ // That class will always contain the .proto file's getDescriptor() method as
353
+ // well as any top-level extensions defined in the .proto file.
354
+ // If java_multiple_files is disabled, then all the other classes from the
355
+ // .proto file will be nested inside the single wrapper outer class.
297
356
  optional string java_outer_classname = 8;
298
357
 
299
- // If set true, then the Java code generator will generate a separate .java
358
+ // If enabled, then the Java code generator will generate a separate .java
300
359
  // file for each top-level message, enum, and service defined in the .proto
301
- // file. Thus, these types will *not* be nested inside the outer class
302
- // named by java_outer_classname. However, the outer class will still be
360
+ // file. Thus, these types will *not* be nested inside the wrapper class
361
+ // named by java_outer_classname. However, the wrapper class will still be
303
362
  // generated to contain the file's getDescriptor() method as well as any
304
363
  // top-level extensions defined in the file.
305
- optional bool java_multiple_files = 10 [default=false];
306
-
307
- // If set true, then the Java code generator will generate equals() and
308
- // hashCode() methods for all messages defined in the .proto file.
309
- // This increases generated code size, potentially substantially for large
310
- // protos, which may harm a memory-constrained application.
311
- // - In the full runtime this is a speed optimization, as the
312
- // AbstractMessage base class includes reflection-based implementations of
313
- // these methods.
314
- // - In the lite runtime, setting this option changes the semantics of
315
- // equals() and hashCode() to more closely match those of the full runtime;
316
- // the generated methods compute their results based on field values rather
317
- // than object identity. (Implementations should not assume that hashcodes
318
- // will be consistent across runtimes or versions of the protocol compiler.)
319
- optional bool java_generate_equals_and_hash = 20 [default=false];
364
+ optional bool java_multiple_files = 10 [default = false];
365
+
366
+ // This option does nothing.
367
+ optional bool java_generate_equals_and_hash = 20 [deprecated=true];
320
368
 
321
369
  // If set true, then the Java2 code generator will generate code that
322
370
  // throws an exception whenever an attempt is made to assign a non-UTF-8
@@ -324,17 +372,17 @@ message FileOptions {
324
372
  // Message reflection will do the same.
325
373
  // However, an extension field still accepts non-UTF-8 byte sequences.
326
374
  // This option has no effect on when used with the lite runtime.
327
- optional bool java_string_check_utf8 = 27 [default=false];
375
+ optional bool java_string_check_utf8 = 27 [default = false];
328
376
 
329
377
 
330
378
  // Generated classes can be optimized for speed or code size.
331
379
  enum OptimizeMode {
332
- SPEED = 1; // Generate complete code for parsing, serialization,
333
- // etc.
334
- CODE_SIZE = 2; // Use ReflectionOps to implement these methods.
335
- LITE_RUNTIME = 3; // Generate code using MessageLite and the lite runtime.
380
+ SPEED = 1; // Generate complete code for parsing, serialization,
381
+ // etc.
382
+ CODE_SIZE = 2; // Use ReflectionOps to implement these methods.
383
+ LITE_RUNTIME = 3; // Generate code using MessageLite and the lite runtime.
336
384
  }
337
- optional OptimizeMode optimize_for = 9 [default=SPEED];
385
+ optional OptimizeMode optimize_for = 9 [default = SPEED];
338
386
 
339
387
  // Sets the Go package where structs generated from this .proto will be
340
388
  // placed. If omitted, the Go package will be derived from the following:
@@ -345,6 +393,7 @@ message FileOptions {
345
393
 
346
394
 
347
395
 
396
+
348
397
  // Should generic services be generated in each language? "Generic" services
349
398
  // are not specific to any particular RPC system. They are generated by the
350
399
  // main code generators in each language (without additional plugins).
@@ -355,19 +404,20 @@ message FileOptions {
355
404
  // that generate code specific to your particular RPC system. Therefore,
356
405
  // these default to false. Old code which depends on generic services should
357
406
  // explicitly set them to true.
358
- optional bool cc_generic_services = 16 [default=false];
359
- optional bool java_generic_services = 17 [default=false];
360
- optional bool py_generic_services = 18 [default=false];
407
+ optional bool cc_generic_services = 16 [default = false];
408
+ optional bool java_generic_services = 17 [default = false];
409
+ optional bool py_generic_services = 18 [default = false];
410
+ optional bool php_generic_services = 42 [default = false];
361
411
 
362
412
  // Is this file deprecated?
363
413
  // Depending on the target platform, this can emit Deprecated annotations
364
414
  // for everything in the file, or it will be completely ignored; in the very
365
415
  // least, this is a formalization for deprecating files.
366
- optional bool deprecated = 23 [default=false];
416
+ optional bool deprecated = 23 [default = false];
367
417
 
368
418
  // Enables the use of arenas for the proto messages in this file. This applies
369
419
  // only to generated classes for C++.
370
- optional bool cc_enable_arenas = 31 [default=false];
420
+ optional bool cc_enable_arenas = 31 [default = true];
371
421
 
372
422
 
373
423
  // Sets the objective c class prefix which is prepended to all objective c
@@ -377,15 +427,41 @@ message FileOptions {
377
427
  // Namespace for generated classes; defaults to the package.
378
428
  optional string csharp_namespace = 37;
379
429
 
380
- // Whether the nano proto compiler should generate in the deprecated non-nano
381
- // suffixed package.
382
- optional bool javanano_use_deprecated_package = 38;
430
+ // By default Swift generators will take the proto package and CamelCase it
431
+ // replacing '.' with underscore and use that to prefix the types/symbols
432
+ // defined. When this options is provided, they will use this value instead
433
+ // to prefix the types/symbols defined.
434
+ optional string swift_prefix = 39;
383
435
 
384
- // The parser stores options it doesn't recognize here. See above.
436
+ // Sets the php class prefix which is prepended to all php generated classes
437
+ // from this .proto. Default is empty.
438
+ optional string php_class_prefix = 40;
439
+
440
+ // Use this option to change the namespace of php generated classes. Default
441
+ // is empty. When this option is empty, the package name will be used for
442
+ // determining the namespace.
443
+ optional string php_namespace = 41;
444
+
445
+ // Use this option to change the namespace of php generated metadata classes.
446
+ // Default is empty. When this option is empty, the proto file name will be
447
+ // used for determining the namespace.
448
+ optional string php_metadata_namespace = 44;
449
+
450
+ // Use this option to change the package of ruby generated classes. Default
451
+ // is empty. When this option is not set, the package name will be used for
452
+ // determining the ruby package.
453
+ optional string ruby_package = 45;
454
+
455
+
456
+ // The parser stores options it doesn't recognize here.
457
+ // See the documentation for the "Options" section above.
385
458
  repeated UninterpretedOption uninterpreted_option = 999;
386
459
 
387
- // Clients can define custom options in extensions of this message. See above.
460
+ // Clients can define custom options in extensions of this message.
461
+ // See the documentation for the "Options" section above.
388
462
  extensions 1000 to max;
463
+
464
+ reserved 38;
389
465
  }
390
466
 
391
467
  message MessageOptions {
@@ -407,18 +483,20 @@ message MessageOptions {
407
483
  //
408
484
  // Because this is an option, the above two restrictions are not enforced by
409
485
  // the protocol compiler.
410
- optional bool message_set_wire_format = 1 [default=false];
486
+ optional bool message_set_wire_format = 1 [default = false];
411
487
 
412
488
  // Disables the generation of the standard "descriptor()" accessor, which can
413
489
  // conflict with a field of the same name. This is meant to make migration
414
490
  // from proto1 easier; new code should avoid fields named "descriptor".
415
- optional bool no_standard_descriptor_accessor = 2 [default=false];
491
+ optional bool no_standard_descriptor_accessor = 2 [default = false];
416
492
 
417
493
  // Is this message deprecated?
418
494
  // Depending on the target platform, this can emit Deprecated annotations
419
495
  // for the message, or it will be completely ignored; in the very least,
420
496
  // this is a formalization for deprecating messages.
421
- optional bool deprecated = 3 [default=false];
497
+ optional bool deprecated = 3 [default = false];
498
+
499
+ reserved 4, 5, 6;
422
500
 
423
501
  // Whether the message is an automatically generated map entry type for the
424
502
  // maps field.
@@ -435,7 +513,7 @@ message MessageOptions {
435
513
  //
436
514
  // Implementations may choose not to generate the map_entry=true message, but
437
515
  // use a native map in the target language to hold the keys and values.
438
- // The reflection APIs in such implementions still need to work as
516
+ // The reflection APIs in such implementations still need to work as
439
517
  // if the field is a repeated message field.
440
518
  //
441
519
  // NOTE: Do not set the option in .proto files. Always use the maps syntax
@@ -443,6 +521,10 @@ message MessageOptions {
443
521
  // parser.
444
522
  optional bool map_entry = 7;
445
523
 
524
+ reserved 8; // javalite_serializable
525
+ reserved 9; // javanano_as_lite
526
+
527
+
446
528
  // The parser stores options it doesn't recognize here. See above.
447
529
  repeated UninterpretedOption uninterpreted_option = 999;
448
530
 
@@ -471,16 +553,17 @@ message FieldOptions {
471
553
  // false will avoid using packed encoding.
472
554
  optional bool packed = 2;
473
555
 
474
-
475
556
  // The jstype option determines the JavaScript type used for values of the
476
557
  // field. The option is permitted only for 64 bit integral and fixed types
477
- // (int64, uint64, sint64, fixed64, sfixed64). By default these types are
478
- // represented as JavaScript strings. This avoids loss of precision that can
479
- // happen when a large value is converted to a floating point JavaScript
480
- // numbers. Specifying JS_NUMBER for the jstype causes the generated
481
- // JavaScript code to use the JavaScript "number" type instead of strings.
482
- // This option is an enum to permit additional types to be added,
483
- // e.g. goog.math.Integer.
558
+ // (int64, uint64, sint64, fixed64, sfixed64). A field with jstype JS_STRING
559
+ // is represented as JavaScript string, which avoids loss of precision that
560
+ // can happen when a large value is converted to a floating point JavaScript.
561
+ // Specifying JS_NUMBER for the jstype causes the generated JavaScript code to
562
+ // use the JavaScript "number" type. The behavior of the default option
563
+ // JS_NORMAL is implementation dependent.
564
+ //
565
+ // This option is an enum to permit additional types to be added, e.g.
566
+ // goog.math.Integer.
484
567
  optional JSType jstype = 6 [default = JS_NORMAL];
485
568
  enum JSType {
486
569
  // Use the default type.
@@ -512,7 +595,7 @@ message FieldOptions {
512
595
  //
513
596
  //
514
597
  // Note that implementations may choose not to check required fields within
515
- // a lazy sub-message. That is, calling IsInitialized() on the outher message
598
+ // a lazy sub-message. That is, calling IsInitialized() on the outer message
516
599
  // may return true even if the inner message has missing required fields.
517
600
  // This is necessary because otherwise the inner message would have to be
518
601
  // parsed in order to perform the check, defeating the purpose of lazy
@@ -521,18 +604,28 @@ message FieldOptions {
521
604
  // implementation must either *always* check its required fields, or *never*
522
605
  // check its required fields, regardless of whether or not the message has
523
606
  // been parsed.
524
- optional bool lazy = 5 [default=false];
607
+ optional bool lazy = 5 [default = false];
525
608
 
526
609
  // Is this field deprecated?
527
610
  // Depending on the target platform, this can emit Deprecated annotations
528
611
  // for accessors, or it will be completely ignored; in the very least, this
529
612
  // is a formalization for deprecating fields.
530
- optional bool deprecated = 3 [default=false];
613
+ optional bool deprecated = 3 [default = false];
531
614
 
532
615
  // For Google-internal migration only. Do not use.
533
- optional bool weak = 10 [default=false];
616
+ optional bool weak = 10 [default = false];
534
617
 
535
618
 
619
+ // The parser stores options it doesn't recognize here. See above.
620
+ repeated UninterpretedOption uninterpreted_option = 999;
621
+
622
+ // Clients can define custom options in extensions of this message. See above.
623
+ extensions 1000 to max;
624
+
625
+ reserved 4; // removed jtype
626
+ }
627
+
628
+ message OneofOptions {
536
629
  // The parser stores options it doesn't recognize here. See above.
537
630
  repeated UninterpretedOption uninterpreted_option = 999;
538
631
 
@@ -550,7 +643,9 @@ message EnumOptions {
550
643
  // Depending on the target platform, this can emit Deprecated annotations
551
644
  // for the enum, or it will be completely ignored; in the very least, this
552
645
  // is a formalization for deprecating enums.
553
- optional bool deprecated = 3 [default=false];
646
+ optional bool deprecated = 3 [default = false];
647
+
648
+ reserved 5; // javanano_as_lite
554
649
 
555
650
  // The parser stores options it doesn't recognize here. See above.
556
651
  repeated UninterpretedOption uninterpreted_option = 999;
@@ -564,7 +659,7 @@ message EnumValueOptions {
564
659
  // Depending on the target platform, this can emit Deprecated annotations
565
660
  // for the enum value, or it will be completely ignored; in the very least,
566
661
  // this is a formalization for deprecating enum values.
567
- optional bool deprecated = 1 [default=false];
662
+ optional bool deprecated = 1 [default = false];
568
663
 
569
664
  // The parser stores options it doesn't recognize here. See above.
570
665
  repeated UninterpretedOption uninterpreted_option = 999;
@@ -584,7 +679,7 @@ message ServiceOptions {
584
679
  // Depending on the target platform, this can emit Deprecated annotations
585
680
  // for the service, or it will be completely ignored; in the very least,
586
681
  // this is a formalization for deprecating services.
587
- optional bool deprecated = 33 [default=false];
682
+ optional bool deprecated = 33 [default = false];
588
683
 
589
684
  // The parser stores options it doesn't recognize here. See above.
590
685
  repeated UninterpretedOption uninterpreted_option = 999;
@@ -604,7 +699,18 @@ message MethodOptions {
604
699
  // Depending on the target platform, this can emit Deprecated annotations
605
700
  // for the method, or it will be completely ignored; in the very least,
606
701
  // this is a formalization for deprecating methods.
607
- optional bool deprecated = 33 [default=false];
702
+ optional bool deprecated = 33 [default = false];
703
+
704
+ // Is this method side-effect-free (or safe in HTTP parlance), or idempotent,
705
+ // or neither? HTTP based RPC implementation may choose GET verb for safe
706
+ // methods, and PUT verb for idempotent methods instead of the default POST.
707
+ enum IdempotencyLevel {
708
+ IDEMPOTENCY_UNKNOWN = 0;
709
+ NO_SIDE_EFFECTS = 1; // implies idempotent
710
+ IDEMPOTENT = 2; // idempotent, but may have side effects
711
+ }
712
+ optional IdempotencyLevel idempotency_level = 34
713
+ [default = IDEMPOTENCY_UNKNOWN];
608
714
 
609
715
  // The parser stores options it doesn't recognize here. See above.
610
716
  repeated UninterpretedOption uninterpreted_option = 999;
@@ -685,7 +791,7 @@ message SourceCodeInfo {
685
791
  // beginning of the "extend" block and is shared by all extensions within
686
792
  // the block.
687
793
  // - Just because a location's span is a subset of some other location's span
688
- // does not mean that it is a descendent. For example, a "group" defines
794
+ // does not mean that it is a descendant. For example, a "group" defines
689
795
  // both a type and a field in a single declaration. Thus, the locations
690
796
  // corresponding to the type and field and their components will overlap.
691
797
  // - Code which tries to interpret locations should probably be designed to
@@ -716,14 +822,14 @@ message SourceCodeInfo {
716
822
  // [ 4, 3, 2, 7 ]
717
823
  // this path refers to the whole field declaration (from the beginning
718
824
  // of the label to the terminating semicolon).
719
- repeated int32 path = 1 [packed=true];
825
+ repeated int32 path = 1 [packed = true];
720
826
 
721
827
  // Always has exactly three or four elements: start line, start column,
722
828
  // end line (optional, otherwise assumed same as start line), end column.
723
829
  // These are packed into a single field for efficiency. Note that line
724
830
  // and column numbers are zero-based -- typically you will want to add
725
831
  // 1 to each before displaying to a user.
726
- repeated int32 span = 2 [packed=true];
832
+ repeated int32 span = 2 [packed = true];
727
833
 
728
834
  // If this SourceCodeInfo represents a complete declaration, these are any
729
835
  // comments appearing before and after the declaration which appear to be
@@ -777,3 +883,29 @@ message SourceCodeInfo {
777
883
  repeated string leading_detached_comments = 6;
778
884
  }
779
885
  }
886
+
887
+ // Describes the relationship between generated code and its original source
888
+ // file. A GeneratedCodeInfo message is associated with only one generated
889
+ // source file, but may contain references to different source .proto files.
890
+ message GeneratedCodeInfo {
891
+ // An Annotation connects some span of text in generated code to an element
892
+ // of its generating .proto file.
893
+ repeated Annotation annotation = 1;
894
+ message Annotation {
895
+ // Identifies the element in the original source .proto file. This field
896
+ // is formatted the same as SourceCodeInfo.Location.path.
897
+ repeated int32 path = 1 [packed = true];
898
+
899
+ // Identifies the filesystem path to the original source .proto.
900
+ optional string source_file = 2;
901
+
902
+ // Identifies the starting offset in bytes in the generated code
903
+ // that relates to the identified object.
904
+ optional int32 begin = 3;
905
+
906
+ // Identifies the ending offset in bytes in the generated code that
907
+ // relates to the identified offset. The end offset should be one past
908
+ // the last relevant byte (so the length of the text = end - begin).
909
+ optional int32 end = 4;
910
+ }
911
+ }
data/proto/rpc.proto CHANGED
@@ -22,6 +22,8 @@
22
22
  //
23
23
  // Protobufs needed for socket rpcs.
24
24
 
25
+ syntax = "proto2";
26
+
25
27
  package protobuf.socketrpc;
26
28
 
27
29
  message Request
@@ -17,7 +17,7 @@ RSpec.describe 'code generation' do
17
17
  end
18
18
 
19
19
  expected_output =
20
- ::Google::Protobuf::Compiler::CodeGeneratorResponse.encode(:file => expected_file_descriptors)
20
+ ::Google::Protobuf::Compiler::CodeGeneratorResponse.encode(:file => expected_file_descriptors, :supported_features => 1)
21
21
 
22
22
  code_generator = ::Protobuf::CodeGenerator.new(bytes)
23
23
  code_generator.eval_unknown_extensions!
@@ -37,7 +37,7 @@ RSpec.describe 'code generation' do
37
37
  :name => file_name, :content => file_content)
38
38
 
39
39
  expected_response =
40
- ::Google::Protobuf::Compiler::CodeGeneratorResponse.encode(:file => [expected_file_output])
40
+ ::Google::Protobuf::Compiler::CodeGeneratorResponse.encode(:file => [expected_file_output], :supported_features => 1)
41
41
 
42
42
  code_generator = ::Protobuf::CodeGenerator.new(request.encode)
43
43
  code_generator.eval_unknown_extensions!
@@ -23,7 +23,7 @@ RSpec.describe ::Protobuf::CodeGenerator do
23
23
  end
24
24
 
25
25
  let(:expected_response_bytes) do
26
- COMPILER::CodeGeneratorResponse.encode(:file => [output_file1, output_file2])
26
+ COMPILER::CodeGeneratorResponse.encode(:file => [output_file1, output_file2], :supported_features => 1)
27
27
  end
28
28
 
29
29
  before do
@@ -2,7 +2,7 @@ require 'spec_helper'
2
2
 
3
3
  RSpec.describe Protobuf::Rpc::Middleware::ExceptionHandler do
4
4
  let(:app) { proc { |env| env } }
5
- let(:env) { Protobuf::Rpc::Env.new }
5
+ let(:env) { Protobuf::Rpc::Env.new("server" => "cooldude") }
6
6
 
7
7
  subject { described_class.new(app) }
8
8
 
@@ -17,7 +17,7 @@ RSpec.describe Protobuf::Rpc::Middleware::ExceptionHandler do
17
17
  end
18
18
 
19
19
  context "when exceptions occur" do
20
- let(:encoded_error) { error.encode }
20
+ let(:encoded_error) { error.encode(:server => "cooldude") }
21
21
  let(:error) { Protobuf::Rpc::MethodNotFound.new('Boom!') }
22
22
 
23
23
  before { allow(app).to receive(:call).and_raise(error, 'Boom!') }
@@ -42,7 +42,7 @@ RSpec.describe Protobuf::Rpc::Middleware::ExceptionHandler do
42
42
  end
43
43
 
44
44
  context "when exception is not a Protobuf error" do
45
- let(:encoded_error) { error.encode }
45
+ let(:encoded_error) { error.encode(:server => "cooldude") }
46
46
  let(:error) { Protobuf::Rpc::RpcFailed.new('Boom!') }
47
47
 
48
48
  before { allow(app).to receive(:call).and_raise(RuntimeError, 'Boom!') }
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
  require 'timecop'
3
- require 'active_support/core_ext/numeric/time'
3
+ require 'active_support/all'
4
4
 
5
5
  RSpec.describe ::Protobuf::Rpc::Stat do
6
6