protobug_conformance_protos 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,1204 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Code generated by protoc-gen-protobug. DO NOT EDIT.
4
+
5
+ # source: google/protobuf/test_messages_proto3.proto
6
+ # syntax: proto3
7
+ # package: protobuf_test_messages.proto3
8
+ # options:
9
+ # java_package: "com.google.protobuf_test_messages.proto3"
10
+ # optimize_for: SPEED
11
+ # cc_enable_arenas: true
12
+ # objc_class_prefix: "Proto3"
13
+
14
+ # Protocol Buffers - Google's data interchange format
15
+ # Copyright 2008 Google Inc. All rights reserved.
16
+ #
17
+ # Use of this source code is governed by a BSD-style
18
+ # license that can be found in the LICENSE file or at
19
+ # https://developers.google.com/open-source/licenses/bsd
20
+ #
21
+ # Test schema for proto3 messages. This test schema is used by:
22
+ #
23
+ # - benchmarks
24
+ # - fuzz tests
25
+ # - conformance tests
26
+
27
+ require "protobug"
28
+
29
+ require "google/protobuf/any_pb"
30
+ require "google/protobuf/duration_pb"
31
+ require "google/protobuf/field_mask_pb"
32
+ require "google/protobuf/struct_pb"
33
+ require "google/protobuf/timestamp_pb"
34
+ require "google/protobuf/wrappers_pb"
35
+
36
+ module ProtobufTestMessages
37
+ module Proto3
38
+ # This proto includes every type of field in both singular and repeated
39
+ # forms.
40
+ #
41
+ # Also, crucially, all messages and enums in this file are eventually
42
+ # submessages of this message. So for example, a fuzz test of TestAllTypes
43
+ # could trigger bugs that occur in any message type in this file. We verify
44
+ # this stays true in a unit test.
45
+ class TestAllTypesProto3
46
+ extend Protobug::Message
47
+
48
+ self.full_name = "protobuf_test_messages.proto3.TestAllTypesProto3"
49
+
50
+ class NestedMessage
51
+ extend Protobug::Message
52
+
53
+ self.full_name = "protobuf_test_messages.proto3.TestAllTypesProto3.NestedMessage"
54
+
55
+ optional(1, "a", type: :int32, proto3_optional: false)
56
+ optional(
57
+ 2,
58
+ "corecursive",
59
+ type: :message,
60
+ message_type: "protobuf_test_messages.proto3.TestAllTypesProto3",
61
+ proto3_optional: false
62
+ )
63
+ end
64
+
65
+ class NestedEnum
66
+ extend Protobug::Enum
67
+
68
+ self.full_name = "protobuf_test_messages.proto3.TestAllTypesProto3.NestedEnum"
69
+
70
+ FOO = new("FOO", 0).freeze
71
+ BAR = new("BAR", 1).freeze
72
+ BAZ = new("BAZ", 2).freeze
73
+ NEG = new("NEG", -1).freeze # Intentionally negative.
74
+ end
75
+
76
+ class AliasedEnum
77
+ extend Protobug::Enum
78
+
79
+ self.full_name = "protobuf_test_messages.proto3.TestAllTypesProto3.AliasedEnum"
80
+
81
+ ALIAS_FOO = new("ALIAS_FOO", 0).freeze
82
+ ALIAS_BAR = new("ALIAS_BAR", 1).freeze
83
+ ALIAS_BAZ = new("ALIAS_BAZ", 2).freeze
84
+ MOO = new("MOO", 2).freeze
85
+ K_moo = new("moo", 2).freeze
86
+ K_bAz = new("bAz", 2).freeze
87
+ end
88
+
89
+ # Singular
90
+ optional(
91
+ 1,
92
+ "optional_int32",
93
+ type: :int32,
94
+ json_name: "optionalInt32",
95
+ proto3_optional: false
96
+ )
97
+ optional(
98
+ 2,
99
+ "optional_int64",
100
+ type: :int64,
101
+ json_name: "optionalInt64",
102
+ proto3_optional: false
103
+ )
104
+ optional(
105
+ 3,
106
+ "optional_uint32",
107
+ type: :uint32,
108
+ json_name: "optionalUint32",
109
+ proto3_optional: false
110
+ )
111
+ optional(
112
+ 4,
113
+ "optional_uint64",
114
+ type: :uint64,
115
+ json_name: "optionalUint64",
116
+ proto3_optional: false
117
+ )
118
+ optional(
119
+ 5,
120
+ "optional_sint32",
121
+ type: :sint32,
122
+ json_name: "optionalSint32",
123
+ proto3_optional: false
124
+ )
125
+ optional(
126
+ 6,
127
+ "optional_sint64",
128
+ type: :sint64,
129
+ json_name: "optionalSint64",
130
+ proto3_optional: false
131
+ )
132
+ optional(
133
+ 7,
134
+ "optional_fixed32",
135
+ type: :fixed32,
136
+ json_name: "optionalFixed32",
137
+ proto3_optional: false
138
+ )
139
+ optional(
140
+ 8,
141
+ "optional_fixed64",
142
+ type: :fixed64,
143
+ json_name: "optionalFixed64",
144
+ proto3_optional: false
145
+ )
146
+ optional(
147
+ 9,
148
+ "optional_sfixed32",
149
+ type: :sfixed32,
150
+ json_name: "optionalSfixed32",
151
+ proto3_optional: false
152
+ )
153
+ optional(
154
+ 10,
155
+ "optional_sfixed64",
156
+ type: :sfixed64,
157
+ json_name: "optionalSfixed64",
158
+ proto3_optional: false
159
+ )
160
+ optional(
161
+ 11,
162
+ "optional_float",
163
+ type: :float,
164
+ json_name: "optionalFloat",
165
+ proto3_optional: false
166
+ )
167
+ optional(
168
+ 12,
169
+ "optional_double",
170
+ type: :double,
171
+ json_name: "optionalDouble",
172
+ proto3_optional: false
173
+ )
174
+ optional(
175
+ 13,
176
+ "optional_bool",
177
+ type: :bool,
178
+ json_name: "optionalBool",
179
+ proto3_optional: false
180
+ )
181
+ optional(
182
+ 14,
183
+ "optional_string",
184
+ type: :string,
185
+ json_name: "optionalString",
186
+ proto3_optional: false
187
+ )
188
+ optional(
189
+ 15,
190
+ "optional_bytes",
191
+ type: :bytes,
192
+ json_name: "optionalBytes",
193
+ proto3_optional: false
194
+ )
195
+ optional(
196
+ 18,
197
+ "optional_nested_message",
198
+ type: :message,
199
+ message_type:
200
+ "protobuf_test_messages.proto3.TestAllTypesProto3.NestedMessage",
201
+ json_name: "optionalNestedMessage",
202
+ proto3_optional: false
203
+ )
204
+ optional(
205
+ 19,
206
+ "optional_foreign_message",
207
+ type: :message,
208
+ message_type: "protobuf_test_messages.proto3.ForeignMessage",
209
+ json_name: "optionalForeignMessage",
210
+ proto3_optional: false
211
+ )
212
+ optional(
213
+ 21,
214
+ "optional_nested_enum",
215
+ type: :enum,
216
+ enum_type:
217
+ "protobuf_test_messages.proto3.TestAllTypesProto3.NestedEnum",
218
+ json_name: "optionalNestedEnum",
219
+ proto3_optional: false
220
+ )
221
+ optional(
222
+ 22,
223
+ "optional_foreign_enum",
224
+ type: :enum,
225
+ enum_type: "protobuf_test_messages.proto3.ForeignEnum",
226
+ json_name: "optionalForeignEnum",
227
+ proto3_optional: false
228
+ )
229
+ optional(
230
+ 23,
231
+ "optional_aliased_enum",
232
+ type: :enum,
233
+ enum_type:
234
+ "protobuf_test_messages.proto3.TestAllTypesProto3.AliasedEnum",
235
+ json_name: "optionalAliasedEnum",
236
+ proto3_optional: false
237
+ )
238
+ optional(
239
+ 24,
240
+ "optional_string_piece",
241
+ type: :string,
242
+ json_name: "optionalStringPiece",
243
+ proto3_optional: false
244
+ )
245
+ optional(
246
+ 25,
247
+ "optional_cord",
248
+ type: :string,
249
+ json_name: "optionalCord",
250
+ proto3_optional: false
251
+ )
252
+ optional(
253
+ 27,
254
+ "recursive_message",
255
+ type: :message,
256
+ message_type: "protobuf_test_messages.proto3.TestAllTypesProto3",
257
+ json_name: "recursiveMessage",
258
+ proto3_optional: false
259
+ )
260
+ # Repeated
261
+ repeated(
262
+ 31,
263
+ "repeated_int32",
264
+ type: :int32,
265
+ packed: true,
266
+ json_name: "repeatedInt32"
267
+ )
268
+ repeated(
269
+ 32,
270
+ "repeated_int64",
271
+ type: :int64,
272
+ packed: true,
273
+ json_name: "repeatedInt64"
274
+ )
275
+ repeated(
276
+ 33,
277
+ "repeated_uint32",
278
+ type: :uint32,
279
+ packed: true,
280
+ json_name: "repeatedUint32"
281
+ )
282
+ repeated(
283
+ 34,
284
+ "repeated_uint64",
285
+ type: :uint64,
286
+ packed: true,
287
+ json_name: "repeatedUint64"
288
+ )
289
+ repeated(
290
+ 35,
291
+ "repeated_sint32",
292
+ type: :sint32,
293
+ packed: true,
294
+ json_name: "repeatedSint32"
295
+ )
296
+ repeated(
297
+ 36,
298
+ "repeated_sint64",
299
+ type: :sint64,
300
+ packed: true,
301
+ json_name: "repeatedSint64"
302
+ )
303
+ repeated(
304
+ 37,
305
+ "repeated_fixed32",
306
+ type: :fixed32,
307
+ packed: true,
308
+ json_name: "repeatedFixed32"
309
+ )
310
+ repeated(
311
+ 38,
312
+ "repeated_fixed64",
313
+ type: :fixed64,
314
+ packed: true,
315
+ json_name: "repeatedFixed64"
316
+ )
317
+ repeated(
318
+ 39,
319
+ "repeated_sfixed32",
320
+ type: :sfixed32,
321
+ packed: true,
322
+ json_name: "repeatedSfixed32"
323
+ )
324
+ repeated(
325
+ 40,
326
+ "repeated_sfixed64",
327
+ type: :sfixed64,
328
+ packed: true,
329
+ json_name: "repeatedSfixed64"
330
+ )
331
+ repeated(
332
+ 41,
333
+ "repeated_float",
334
+ type: :float,
335
+ packed: true,
336
+ json_name: "repeatedFloat"
337
+ )
338
+ repeated(
339
+ 42,
340
+ "repeated_double",
341
+ type: :double,
342
+ packed: true,
343
+ json_name: "repeatedDouble"
344
+ )
345
+ repeated(
346
+ 43,
347
+ "repeated_bool",
348
+ type: :bool,
349
+ packed: true,
350
+ json_name: "repeatedBool"
351
+ )
352
+ repeated(
353
+ 44,
354
+ "repeated_string",
355
+ type: :string,
356
+ json_name: "repeatedString"
357
+ )
358
+ repeated(45, "repeated_bytes", type: :bytes, json_name: "repeatedBytes")
359
+ repeated(
360
+ 48,
361
+ "repeated_nested_message",
362
+ type: :message,
363
+ message_type:
364
+ "protobuf_test_messages.proto3.TestAllTypesProto3.NestedMessage",
365
+ json_name: "repeatedNestedMessage"
366
+ )
367
+ repeated(
368
+ 49,
369
+ "repeated_foreign_message",
370
+ type: :message,
371
+ message_type: "protobuf_test_messages.proto3.ForeignMessage",
372
+ json_name: "repeatedForeignMessage"
373
+ )
374
+ repeated(
375
+ 51,
376
+ "repeated_nested_enum",
377
+ type: :enum,
378
+ enum_type:
379
+ "protobuf_test_messages.proto3.TestAllTypesProto3.NestedEnum",
380
+ packed: true,
381
+ json_name: "repeatedNestedEnum"
382
+ )
383
+ repeated(
384
+ 52,
385
+ "repeated_foreign_enum",
386
+ type: :enum,
387
+ enum_type: "protobuf_test_messages.proto3.ForeignEnum",
388
+ packed: true,
389
+ json_name: "repeatedForeignEnum"
390
+ )
391
+ repeated(
392
+ 54,
393
+ "repeated_string_piece",
394
+ type: :string,
395
+ json_name: "repeatedStringPiece"
396
+ )
397
+ repeated(55, "repeated_cord", type: :string, json_name: "repeatedCord")
398
+ # Packed
399
+ repeated(
400
+ 75,
401
+ "packed_int32",
402
+ type: :int32,
403
+ packed: true,
404
+ json_name: "packedInt32"
405
+ )
406
+ repeated(
407
+ 76,
408
+ "packed_int64",
409
+ type: :int64,
410
+ packed: true,
411
+ json_name: "packedInt64"
412
+ )
413
+ repeated(
414
+ 77,
415
+ "packed_uint32",
416
+ type: :uint32,
417
+ packed: true,
418
+ json_name: "packedUint32"
419
+ )
420
+ repeated(
421
+ 78,
422
+ "packed_uint64",
423
+ type: :uint64,
424
+ packed: true,
425
+ json_name: "packedUint64"
426
+ )
427
+ repeated(
428
+ 79,
429
+ "packed_sint32",
430
+ type: :sint32,
431
+ packed: true,
432
+ json_name: "packedSint32"
433
+ )
434
+ repeated(
435
+ 80,
436
+ "packed_sint64",
437
+ type: :sint64,
438
+ packed: true,
439
+ json_name: "packedSint64"
440
+ )
441
+ repeated(
442
+ 81,
443
+ "packed_fixed32",
444
+ type: :fixed32,
445
+ packed: true,
446
+ json_name: "packedFixed32"
447
+ )
448
+ repeated(
449
+ 82,
450
+ "packed_fixed64",
451
+ type: :fixed64,
452
+ packed: true,
453
+ json_name: "packedFixed64"
454
+ )
455
+ repeated(
456
+ 83,
457
+ "packed_sfixed32",
458
+ type: :sfixed32,
459
+ packed: true,
460
+ json_name: "packedSfixed32"
461
+ )
462
+ repeated(
463
+ 84,
464
+ "packed_sfixed64",
465
+ type: :sfixed64,
466
+ packed: true,
467
+ json_name: "packedSfixed64"
468
+ )
469
+ repeated(
470
+ 85,
471
+ "packed_float",
472
+ type: :float,
473
+ packed: true,
474
+ json_name: "packedFloat"
475
+ )
476
+ repeated(
477
+ 86,
478
+ "packed_double",
479
+ type: :double,
480
+ packed: true,
481
+ json_name: "packedDouble"
482
+ )
483
+ repeated(
484
+ 87,
485
+ "packed_bool",
486
+ type: :bool,
487
+ packed: true,
488
+ json_name: "packedBool"
489
+ )
490
+ repeated(
491
+ 88,
492
+ "packed_nested_enum",
493
+ type: :enum,
494
+ enum_type:
495
+ "protobuf_test_messages.proto3.TestAllTypesProto3.NestedEnum",
496
+ packed: true,
497
+ json_name: "packedNestedEnum"
498
+ )
499
+ # Unpacked
500
+ repeated(89, "unpacked_int32", type: :int32, json_name: "unpackedInt32")
501
+ repeated(90, "unpacked_int64", type: :int64, json_name: "unpackedInt64")
502
+ repeated(
503
+ 91,
504
+ "unpacked_uint32",
505
+ type: :uint32,
506
+ json_name: "unpackedUint32"
507
+ )
508
+ repeated(
509
+ 92,
510
+ "unpacked_uint64",
511
+ type: :uint64,
512
+ json_name: "unpackedUint64"
513
+ )
514
+ repeated(
515
+ 93,
516
+ "unpacked_sint32",
517
+ type: :sint32,
518
+ json_name: "unpackedSint32"
519
+ )
520
+ repeated(
521
+ 94,
522
+ "unpacked_sint64",
523
+ type: :sint64,
524
+ json_name: "unpackedSint64"
525
+ )
526
+ repeated(
527
+ 95,
528
+ "unpacked_fixed32",
529
+ type: :fixed32,
530
+ json_name: "unpackedFixed32"
531
+ )
532
+ repeated(
533
+ 96,
534
+ "unpacked_fixed64",
535
+ type: :fixed64,
536
+ json_name: "unpackedFixed64"
537
+ )
538
+ repeated(
539
+ 97,
540
+ "unpacked_sfixed32",
541
+ type: :sfixed32,
542
+ json_name: "unpackedSfixed32"
543
+ )
544
+ repeated(
545
+ 98,
546
+ "unpacked_sfixed64",
547
+ type: :sfixed64,
548
+ json_name: "unpackedSfixed64"
549
+ )
550
+ repeated(99, "unpacked_float", type: :float, json_name: "unpackedFloat")
551
+ repeated(
552
+ 100,
553
+ "unpacked_double",
554
+ type: :double,
555
+ json_name: "unpackedDouble"
556
+ )
557
+ repeated(101, "unpacked_bool", type: :bool, json_name: "unpackedBool")
558
+ repeated(
559
+ 102,
560
+ "unpacked_nested_enum",
561
+ type: :enum,
562
+ enum_type:
563
+ "protobuf_test_messages.proto3.TestAllTypesProto3.NestedEnum",
564
+ json_name: "unpackedNestedEnum"
565
+ )
566
+ # Map
567
+ map(
568
+ 56,
569
+ "map_int32_int32",
570
+ key_type: :int32,
571
+ value_type: :int32,
572
+ json_name: "mapInt32Int32"
573
+ )
574
+ map(
575
+ 57,
576
+ "map_int64_int64",
577
+ key_type: :int64,
578
+ value_type: :int64,
579
+ json_name: "mapInt64Int64"
580
+ )
581
+ map(
582
+ 58,
583
+ "map_uint32_uint32",
584
+ key_type: :uint32,
585
+ value_type: :uint32,
586
+ json_name: "mapUint32Uint32"
587
+ )
588
+ map(
589
+ 59,
590
+ "map_uint64_uint64",
591
+ key_type: :uint64,
592
+ value_type: :uint64,
593
+ json_name: "mapUint64Uint64"
594
+ )
595
+ map(
596
+ 60,
597
+ "map_sint32_sint32",
598
+ key_type: :sint32,
599
+ value_type: :sint32,
600
+ json_name: "mapSint32Sint32"
601
+ )
602
+ map(
603
+ 61,
604
+ "map_sint64_sint64",
605
+ key_type: :sint64,
606
+ value_type: :sint64,
607
+ json_name: "mapSint64Sint64"
608
+ )
609
+ map(
610
+ 62,
611
+ "map_fixed32_fixed32",
612
+ key_type: :fixed32,
613
+ value_type: :fixed32,
614
+ json_name: "mapFixed32Fixed32"
615
+ )
616
+ map(
617
+ 63,
618
+ "map_fixed64_fixed64",
619
+ key_type: :fixed64,
620
+ value_type: :fixed64,
621
+ json_name: "mapFixed64Fixed64"
622
+ )
623
+ map(
624
+ 64,
625
+ "map_sfixed32_sfixed32",
626
+ key_type: :sfixed32,
627
+ value_type: :sfixed32,
628
+ json_name: "mapSfixed32Sfixed32"
629
+ )
630
+ map(
631
+ 65,
632
+ "map_sfixed64_sfixed64",
633
+ key_type: :sfixed64,
634
+ value_type: :sfixed64,
635
+ json_name: "mapSfixed64Sfixed64"
636
+ )
637
+ map(
638
+ 66,
639
+ "map_int32_float",
640
+ key_type: :int32,
641
+ value_type: :float,
642
+ json_name: "mapInt32Float"
643
+ )
644
+ map(
645
+ 67,
646
+ "map_int32_double",
647
+ key_type: :int32,
648
+ value_type: :double,
649
+ json_name: "mapInt32Double"
650
+ )
651
+ map(
652
+ 68,
653
+ "map_bool_bool",
654
+ key_type: :bool,
655
+ value_type: :bool,
656
+ json_name: "mapBoolBool"
657
+ )
658
+ map(
659
+ 69,
660
+ "map_string_string",
661
+ key_type: :string,
662
+ value_type: :string,
663
+ json_name: "mapStringString"
664
+ )
665
+ map(
666
+ 70,
667
+ "map_string_bytes",
668
+ key_type: :string,
669
+ value_type: :bytes,
670
+ json_name: "mapStringBytes"
671
+ )
672
+ map(
673
+ 71,
674
+ "map_string_nested_message",
675
+ key_type: :string,
676
+ value_type: :message,
677
+ message_type:
678
+ "protobuf_test_messages.proto3.TestAllTypesProto3.NestedMessage",
679
+ json_name: "mapStringNestedMessage"
680
+ )
681
+ map(
682
+ 72,
683
+ "map_string_foreign_message",
684
+ key_type: :string,
685
+ value_type: :message,
686
+ message_type: "protobuf_test_messages.proto3.ForeignMessage",
687
+ json_name: "mapStringForeignMessage"
688
+ )
689
+ map(
690
+ 73,
691
+ "map_string_nested_enum",
692
+ key_type: :string,
693
+ value_type: :enum,
694
+ enum_type:
695
+ "protobuf_test_messages.proto3.TestAllTypesProto3.NestedEnum",
696
+ json_name: "mapStringNestedEnum"
697
+ )
698
+ map(
699
+ 74,
700
+ "map_string_foreign_enum",
701
+ key_type: :string,
702
+ value_type: :enum,
703
+ enum_type: "protobuf_test_messages.proto3.ForeignEnum",
704
+ json_name: "mapStringForeignEnum"
705
+ )
706
+ optional(
707
+ 111,
708
+ "oneof_uint32",
709
+ type: :uint32,
710
+ json_name: "oneofUint32",
711
+ oneof: :oneof_field,
712
+ proto3_optional: false
713
+ )
714
+ optional(
715
+ 112,
716
+ "oneof_nested_message",
717
+ type: :message,
718
+ message_type:
719
+ "protobuf_test_messages.proto3.TestAllTypesProto3.NestedMessage",
720
+ json_name: "oneofNestedMessage",
721
+ oneof: :oneof_field,
722
+ proto3_optional: false
723
+ )
724
+ optional(
725
+ 113,
726
+ "oneof_string",
727
+ type: :string,
728
+ json_name: "oneofString",
729
+ oneof: :oneof_field,
730
+ proto3_optional: false
731
+ )
732
+ optional(
733
+ 114,
734
+ "oneof_bytes",
735
+ type: :bytes,
736
+ json_name: "oneofBytes",
737
+ oneof: :oneof_field,
738
+ proto3_optional: false
739
+ )
740
+ optional(
741
+ 115,
742
+ "oneof_bool",
743
+ type: :bool,
744
+ json_name: "oneofBool",
745
+ oneof: :oneof_field,
746
+ proto3_optional: false
747
+ )
748
+ optional(
749
+ 116,
750
+ "oneof_uint64",
751
+ type: :uint64,
752
+ json_name: "oneofUint64",
753
+ oneof: :oneof_field,
754
+ proto3_optional: false
755
+ )
756
+ optional(
757
+ 117,
758
+ "oneof_float",
759
+ type: :float,
760
+ json_name: "oneofFloat",
761
+ oneof: :oneof_field,
762
+ proto3_optional: false
763
+ )
764
+ optional(
765
+ 118,
766
+ "oneof_double",
767
+ type: :double,
768
+ json_name: "oneofDouble",
769
+ oneof: :oneof_field,
770
+ proto3_optional: false
771
+ )
772
+ optional(
773
+ 119,
774
+ "oneof_enum",
775
+ type: :enum,
776
+ enum_type:
777
+ "protobuf_test_messages.proto3.TestAllTypesProto3.NestedEnum",
778
+ json_name: "oneofEnum",
779
+ oneof: :oneof_field,
780
+ proto3_optional: false
781
+ )
782
+ optional(
783
+ 120,
784
+ "oneof_null_value",
785
+ type: :enum,
786
+ enum_type: "google.protobuf.NullValue",
787
+ json_name: "oneofNullValue",
788
+ oneof: :oneof_field,
789
+ proto3_optional: false
790
+ )
791
+ # Well-known types
792
+ optional(
793
+ 201,
794
+ "optional_bool_wrapper",
795
+ type: :message,
796
+ message_type: "google.protobuf.BoolValue",
797
+ json_name: "optionalBoolWrapper",
798
+ proto3_optional: false
799
+ )
800
+ optional(
801
+ 202,
802
+ "optional_int32_wrapper",
803
+ type: :message,
804
+ message_type: "google.protobuf.Int32Value",
805
+ json_name: "optionalInt32Wrapper",
806
+ proto3_optional: false
807
+ )
808
+ optional(
809
+ 203,
810
+ "optional_int64_wrapper",
811
+ type: :message,
812
+ message_type: "google.protobuf.Int64Value",
813
+ json_name: "optionalInt64Wrapper",
814
+ proto3_optional: false
815
+ )
816
+ optional(
817
+ 204,
818
+ "optional_uint32_wrapper",
819
+ type: :message,
820
+ message_type: "google.protobuf.UInt32Value",
821
+ json_name: "optionalUint32Wrapper",
822
+ proto3_optional: false
823
+ )
824
+ optional(
825
+ 205,
826
+ "optional_uint64_wrapper",
827
+ type: :message,
828
+ message_type: "google.protobuf.UInt64Value",
829
+ json_name: "optionalUint64Wrapper",
830
+ proto3_optional: false
831
+ )
832
+ optional(
833
+ 206,
834
+ "optional_float_wrapper",
835
+ type: :message,
836
+ message_type: "google.protobuf.FloatValue",
837
+ json_name: "optionalFloatWrapper",
838
+ proto3_optional: false
839
+ )
840
+ optional(
841
+ 207,
842
+ "optional_double_wrapper",
843
+ type: :message,
844
+ message_type: "google.protobuf.DoubleValue",
845
+ json_name: "optionalDoubleWrapper",
846
+ proto3_optional: false
847
+ )
848
+ optional(
849
+ 208,
850
+ "optional_string_wrapper",
851
+ type: :message,
852
+ message_type: "google.protobuf.StringValue",
853
+ json_name: "optionalStringWrapper",
854
+ proto3_optional: false
855
+ )
856
+ optional(
857
+ 209,
858
+ "optional_bytes_wrapper",
859
+ type: :message,
860
+ message_type: "google.protobuf.BytesValue",
861
+ json_name: "optionalBytesWrapper",
862
+ proto3_optional: false
863
+ )
864
+ repeated(
865
+ 211,
866
+ "repeated_bool_wrapper",
867
+ type: :message,
868
+ message_type: "google.protobuf.BoolValue",
869
+ json_name: "repeatedBoolWrapper"
870
+ )
871
+ repeated(
872
+ 212,
873
+ "repeated_int32_wrapper",
874
+ type: :message,
875
+ message_type: "google.protobuf.Int32Value",
876
+ json_name: "repeatedInt32Wrapper"
877
+ )
878
+ repeated(
879
+ 213,
880
+ "repeated_int64_wrapper",
881
+ type: :message,
882
+ message_type: "google.protobuf.Int64Value",
883
+ json_name: "repeatedInt64Wrapper"
884
+ )
885
+ repeated(
886
+ 214,
887
+ "repeated_uint32_wrapper",
888
+ type: :message,
889
+ message_type: "google.protobuf.UInt32Value",
890
+ json_name: "repeatedUint32Wrapper"
891
+ )
892
+ repeated(
893
+ 215,
894
+ "repeated_uint64_wrapper",
895
+ type: :message,
896
+ message_type: "google.protobuf.UInt64Value",
897
+ json_name: "repeatedUint64Wrapper"
898
+ )
899
+ repeated(
900
+ 216,
901
+ "repeated_float_wrapper",
902
+ type: :message,
903
+ message_type: "google.protobuf.FloatValue",
904
+ json_name: "repeatedFloatWrapper"
905
+ )
906
+ repeated(
907
+ 217,
908
+ "repeated_double_wrapper",
909
+ type: :message,
910
+ message_type: "google.protobuf.DoubleValue",
911
+ json_name: "repeatedDoubleWrapper"
912
+ )
913
+ repeated(
914
+ 218,
915
+ "repeated_string_wrapper",
916
+ type: :message,
917
+ message_type: "google.protobuf.StringValue",
918
+ json_name: "repeatedStringWrapper"
919
+ )
920
+ repeated(
921
+ 219,
922
+ "repeated_bytes_wrapper",
923
+ type: :message,
924
+ message_type: "google.protobuf.BytesValue",
925
+ json_name: "repeatedBytesWrapper"
926
+ )
927
+ optional(
928
+ 301,
929
+ "optional_duration",
930
+ type: :message,
931
+ message_type: "google.protobuf.Duration",
932
+ json_name: "optionalDuration",
933
+ proto3_optional: false
934
+ )
935
+ optional(
936
+ 302,
937
+ "optional_timestamp",
938
+ type: :message,
939
+ message_type: "google.protobuf.Timestamp",
940
+ json_name: "optionalTimestamp",
941
+ proto3_optional: false
942
+ )
943
+ optional(
944
+ 303,
945
+ "optional_field_mask",
946
+ type: :message,
947
+ message_type: "google.protobuf.FieldMask",
948
+ json_name: "optionalFieldMask",
949
+ proto3_optional: false
950
+ )
951
+ optional(
952
+ 304,
953
+ "optional_struct",
954
+ type: :message,
955
+ message_type: "google.protobuf.Struct",
956
+ json_name: "optionalStruct",
957
+ proto3_optional: false
958
+ )
959
+ optional(
960
+ 305,
961
+ "optional_any",
962
+ type: :message,
963
+ message_type: "google.protobuf.Any",
964
+ json_name: "optionalAny",
965
+ proto3_optional: false
966
+ )
967
+ optional(
968
+ 306,
969
+ "optional_value",
970
+ type: :message,
971
+ message_type: "google.protobuf.Value",
972
+ json_name: "optionalValue",
973
+ proto3_optional: false
974
+ )
975
+ optional(
976
+ 307,
977
+ "optional_null_value",
978
+ type: :enum,
979
+ enum_type: "google.protobuf.NullValue",
980
+ json_name: "optionalNullValue",
981
+ proto3_optional: false
982
+ )
983
+ repeated(
984
+ 311,
985
+ "repeated_duration",
986
+ type: :message,
987
+ message_type: "google.protobuf.Duration",
988
+ json_name: "repeatedDuration"
989
+ )
990
+ repeated(
991
+ 312,
992
+ "repeated_timestamp",
993
+ type: :message,
994
+ message_type: "google.protobuf.Timestamp",
995
+ json_name: "repeatedTimestamp"
996
+ )
997
+ repeated(
998
+ 313,
999
+ "repeated_fieldmask",
1000
+ type: :message,
1001
+ message_type: "google.protobuf.FieldMask",
1002
+ json_name: "repeatedFieldmask"
1003
+ )
1004
+ repeated(
1005
+ 324,
1006
+ "repeated_struct",
1007
+ type: :message,
1008
+ message_type: "google.protobuf.Struct",
1009
+ json_name: "repeatedStruct"
1010
+ )
1011
+ repeated(
1012
+ 315,
1013
+ "repeated_any",
1014
+ type: :message,
1015
+ message_type: "google.protobuf.Any",
1016
+ json_name: "repeatedAny"
1017
+ )
1018
+ repeated(
1019
+ 316,
1020
+ "repeated_value",
1021
+ type: :message,
1022
+ message_type: "google.protobuf.Value",
1023
+ json_name: "repeatedValue"
1024
+ )
1025
+ repeated(
1026
+ 317,
1027
+ "repeated_list_value",
1028
+ type: :message,
1029
+ message_type: "google.protobuf.ListValue",
1030
+ json_name: "repeatedListValue"
1031
+ )
1032
+ # Test field-name-to-JSON-name convention.
1033
+ # (protobuf says names can be any valid C/C++ identifier.)
1034
+ optional(401, "fieldname1", type: :int32, proto3_optional: false)
1035
+ optional(
1036
+ 402,
1037
+ "field_name2",
1038
+ type: :int32,
1039
+ json_name: "fieldName2",
1040
+ proto3_optional: false
1041
+ )
1042
+ optional(
1043
+ 403,
1044
+ "_field_name3",
1045
+ type: :int32,
1046
+ json_name: "FieldName3",
1047
+ proto3_optional: false
1048
+ )
1049
+ optional(
1050
+ 404,
1051
+ "field__name4_",
1052
+ type: :int32,
1053
+ json_name: "fieldName4",
1054
+ proto3_optional: false
1055
+ )
1056
+ optional(405, "field0name5", type: :int32, proto3_optional: false)
1057
+ optional(
1058
+ 406,
1059
+ "field_0_name6",
1060
+ type: :int32,
1061
+ json_name: "field0Name6",
1062
+ proto3_optional: false
1063
+ )
1064
+ optional(407, "fieldName7", type: :int32, proto3_optional: false)
1065
+ optional(408, "FieldName8", type: :int32, proto3_optional: false)
1066
+ optional(
1067
+ 409,
1068
+ "field_Name9",
1069
+ type: :int32,
1070
+ json_name: "fieldName9",
1071
+ proto3_optional: false
1072
+ )
1073
+ optional(
1074
+ 410,
1075
+ "Field_Name10",
1076
+ type: :int32,
1077
+ json_name: "FieldName10",
1078
+ proto3_optional: false
1079
+ )
1080
+ optional(
1081
+ 411,
1082
+ "FIELD_NAME11",
1083
+ type: :int32,
1084
+ json_name: "FIELDNAME11",
1085
+ proto3_optional: false
1086
+ )
1087
+ optional(
1088
+ 412,
1089
+ "FIELD_name12",
1090
+ type: :int32,
1091
+ json_name: "FIELDName12",
1092
+ proto3_optional: false
1093
+ )
1094
+ optional(
1095
+ 413,
1096
+ "__field_name13",
1097
+ type: :int32,
1098
+ json_name: "FieldName13",
1099
+ proto3_optional: false
1100
+ )
1101
+ optional(
1102
+ 414,
1103
+ "__Field_name14",
1104
+ type: :int32,
1105
+ json_name: "FieldName14",
1106
+ proto3_optional: false
1107
+ )
1108
+ optional(
1109
+ 415,
1110
+ "field__name15",
1111
+ type: :int32,
1112
+ json_name: "fieldName15",
1113
+ proto3_optional: false
1114
+ )
1115
+ optional(
1116
+ 416,
1117
+ "field__Name16",
1118
+ type: :int32,
1119
+ json_name: "fieldName16",
1120
+ proto3_optional: false
1121
+ )
1122
+ optional(
1123
+ 417,
1124
+ "field_name17__",
1125
+ type: :int32,
1126
+ json_name: "fieldName17",
1127
+ proto3_optional: false
1128
+ )
1129
+ optional(
1130
+ 418,
1131
+ "Field_name18__",
1132
+ type: :int32,
1133
+ json_name: "FieldName18",
1134
+ proto3_optional: false
1135
+ )
1136
+
1137
+ # Reserved for testing unknown fields
1138
+ reserved_range(501...511)
1139
+ end
1140
+
1141
+ class ForeignMessage
1142
+ extend Protobug::Message
1143
+
1144
+ self.full_name = "protobuf_test_messages.proto3.ForeignMessage"
1145
+
1146
+ optional(1, "c", type: :int32, proto3_optional: false)
1147
+ end
1148
+
1149
+ class ForeignEnum
1150
+ extend Protobug::Enum
1151
+
1152
+ self.full_name = "protobuf_test_messages.proto3.ForeignEnum"
1153
+
1154
+ FOREIGN_FOO = new("FOREIGN_FOO", 0).freeze
1155
+ FOREIGN_BAR = new("FOREIGN_BAR", 1).freeze
1156
+ FOREIGN_BAZ = new("FOREIGN_BAZ", 2).freeze
1157
+ end
1158
+
1159
+ class NullHypothesisProto3
1160
+ extend Protobug::Message
1161
+
1162
+ self.full_name = "protobuf_test_messages.proto3.NullHypothesisProto3"
1163
+ end
1164
+
1165
+ class EnumOnlyProto3
1166
+ extend Protobug::Message
1167
+
1168
+ self.full_name = "protobuf_test_messages.proto3.EnumOnlyProto3"
1169
+
1170
+ class Bool
1171
+ extend Protobug::Enum
1172
+
1173
+ self.full_name = "protobuf_test_messages.proto3.EnumOnlyProto3.Bool"
1174
+
1175
+ K_False = new("kFalse", 0).freeze
1176
+ K_True = new("kTrue", 1).freeze
1177
+ end
1178
+ end
1179
+
1180
+ def self.register_test_messages_proto3_protos(registry)
1181
+ Google::Protobuf.register_any_protos(registry)
1182
+ Google::Protobuf.register_duration_protos(registry)
1183
+ Google::Protobuf.register_field_mask_protos(registry)
1184
+ Google::Protobuf.register_struct_protos(registry)
1185
+ Google::Protobuf.register_timestamp_protos(registry)
1186
+ Google::Protobuf.register_wrappers_protos(registry)
1187
+ registry.register(ProtobufTestMessages::Proto3::TestAllTypesProto3)
1188
+ registry.register(
1189
+ ProtobufTestMessages::Proto3::TestAllTypesProto3::NestedMessage
1190
+ )
1191
+ registry.register(
1192
+ ProtobufTestMessages::Proto3::TestAllTypesProto3::NestedEnum
1193
+ )
1194
+ registry.register(
1195
+ ProtobufTestMessages::Proto3::TestAllTypesProto3::AliasedEnum
1196
+ )
1197
+ registry.register(ProtobufTestMessages::Proto3::ForeignMessage)
1198
+ registry.register(ProtobufTestMessages::Proto3::ForeignEnum)
1199
+ registry.register(ProtobufTestMessages::Proto3::NullHypothesisProto3)
1200
+ registry.register(ProtobufTestMessages::Proto3::EnumOnlyProto3)
1201
+ registry.register(ProtobufTestMessages::Proto3::EnumOnlyProto3::Bool)
1202
+ end
1203
+ end
1204
+ end