deimos-ruby 2.1.2 → 2.1.4
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/karafka.rb +71 -1
- data/lib/deimos/schema_backends/avro_schema_coercer.rb +2 -0
- data/lib/deimos/schema_class/record.rb +2 -2
- data/lib/deimos/version.rb +1 -1
- data/lib/generators/deimos/schema_class/templates/schema_enum.rb.tt +6 -3
- data/lib/generators/deimos/schema_class_generator.rb +10 -14
- data/regenerate_test_schema_classes.rb +0 -66
- data/spec/schemas/my_namespace/my_schema.rb +1 -1
- data/spec/schemas/my_namespace/my_updated_schema.rb +2 -1
- data/spec/snapshots/consumers-no-nest.snap +95 -45
- data/spec/snapshots/consumers.snap +107 -49
- data/spec/snapshots/consumers_and_producers-no-nest.snap +90 -67
- data/spec/snapshots/consumers_and_producers.snap +102 -71
- data/spec/snapshots/consumers_circular-no-nest.snap +95 -45
- data/spec/snapshots/consumers_circular.snap +107 -49
- data/spec/snapshots/consumers_complex_types-no-nest.snap +95 -45
- data/spec/snapshots/consumers_complex_types.snap +107 -49
- data/spec/snapshots/consumers_nested-no-nest.snap +88 -38
- data/spec/snapshots/consumers_nested.snap +100 -42
- data/spec/snapshots/namespace_folders.snap +106 -73
- data/spec/snapshots/namespace_map.snap +106 -73
- data/spec/snapshots/producers_with_key-no-nest.snap +97 -60
- data/spec/snapshots/producers_with_key.snap +109 -64
- metadata +2 -2
@@ -12,7 +12,8 @@ module Schemas
|
|
12
12
|
attr_accessor :response_id
|
13
13
|
|
14
14
|
# @override
|
15
|
-
def initialize(response_id: nil)
|
15
|
+
def initialize(_from_message: false, response_id: nil)
|
16
|
+
@_from_message = _from_message
|
16
17
|
super
|
17
18
|
self.response_id = response_id
|
18
19
|
end
|
@@ -55,7 +56,8 @@ module Schemas
|
|
55
56
|
attr_accessor :a_record_field
|
56
57
|
|
57
58
|
# @override
|
58
|
-
def initialize(a_record_field: nil)
|
59
|
+
def initialize(_from_message: false, a_record_field: nil)
|
60
|
+
@_from_message = _from_message
|
59
61
|
super
|
60
62
|
self.a_record_field = a_record_field
|
61
63
|
end
|
@@ -80,13 +82,20 @@ module Schemas
|
|
80
82
|
|
81
83
|
# Autogenerated Schema for Enum at com.my-namespace.AnEnum
|
82
84
|
class AnEnum < Deimos::SchemaClass::Enum
|
83
|
-
# @return ['sym1', 'sym2']
|
84
|
-
attr_accessor :an_enum
|
85
|
-
|
86
85
|
# @override
|
87
86
|
def symbols
|
88
87
|
%w(sym1 sym2)
|
89
88
|
end
|
89
|
+
|
90
|
+
|
91
|
+
def sym1?
|
92
|
+
@value == 'sym1'
|
93
|
+
end
|
94
|
+
|
95
|
+
def sym2?
|
96
|
+
@value == 'sym2'
|
97
|
+
end
|
98
|
+
|
90
99
|
end
|
91
100
|
|
92
101
|
|
@@ -130,7 +139,7 @@ module Schemas
|
|
130
139
|
end
|
131
140
|
|
132
141
|
# @override
|
133
|
-
def initialize(a_string: nil,
|
142
|
+
def initialize(_from_message: false, a_string: nil,
|
134
143
|
a_int: nil,
|
135
144
|
a_long: nil,
|
136
145
|
a_float: nil,
|
@@ -142,6 +151,7 @@ module Schemas
|
|
142
151
|
timestamp: nil,
|
143
152
|
message_id: nil,
|
144
153
|
a_record: nil)
|
154
|
+
@_from_message = _from_message
|
145
155
|
super
|
146
156
|
self.a_string = a_string
|
147
157
|
self.a_int = a_int
|
@@ -202,7 +212,8 @@ module Schemas
|
|
202
212
|
attr_accessor :response_id
|
203
213
|
|
204
214
|
# @override
|
205
|
-
def initialize(response_id: nil)
|
215
|
+
def initialize(_from_message: false, response_id: nil)
|
216
|
+
@_from_message = _from_message
|
206
217
|
super
|
207
218
|
self.response_id = response_id
|
208
219
|
end
|
@@ -243,8 +254,9 @@ module Schemas
|
|
243
254
|
attr_accessor :some_int
|
244
255
|
|
245
256
|
# @override
|
246
|
-
def initialize(test_id: nil,
|
257
|
+
def initialize(_from_message: false, test_id: nil,
|
247
258
|
some_int: nil)
|
259
|
+
@_from_message = _from_message
|
248
260
|
super
|
249
261
|
self.test_id = test_id
|
250
262
|
self.some_int = some_int
|
@@ -295,10 +307,11 @@ module Schemas
|
|
295
307
|
attr_accessor :some_optional_int
|
296
308
|
|
297
309
|
# @override
|
298
|
-
def initialize(some_int: nil,
|
310
|
+
def initialize(_from_message: false, some_int: nil,
|
299
311
|
some_float: nil,
|
300
312
|
some_string: nil,
|
301
313
|
some_optional_int: nil)
|
314
|
+
@_from_message = _from_message
|
302
315
|
super
|
303
316
|
self.some_int = some_int
|
304
317
|
self.some_float = some_float
|
@@ -354,11 +367,12 @@ module Schemas
|
|
354
367
|
end
|
355
368
|
|
356
369
|
# @override
|
357
|
-
def initialize(test_id: nil,
|
370
|
+
def initialize(_from_message: false, test_id: nil,
|
358
371
|
test_float: nil,
|
359
372
|
test_array: nil,
|
360
373
|
some_nested_record: nil,
|
361
374
|
some_optional_record: nil)
|
375
|
+
@_from_message = _from_message
|
362
376
|
super
|
363
377
|
self.test_id = test_id
|
364
378
|
self.test_float = test_float
|
@@ -414,8 +428,9 @@ module Schemas
|
|
414
428
|
attr_accessor :some_int
|
415
429
|
|
416
430
|
# @override
|
417
|
-
def initialize(test_id: nil,
|
431
|
+
def initialize(_from_message: false, test_id: nil,
|
418
432
|
some_int: nil)
|
433
|
+
@_from_message = _from_message
|
419
434
|
super
|
420
435
|
self.test_id = test_id
|
421
436
|
self.some_int = some_int
|
@@ -458,8 +473,9 @@ module Schemas
|
|
458
473
|
attr_accessor :part_two
|
459
474
|
|
460
475
|
# @override
|
461
|
-
def initialize(part_one: nil,
|
476
|
+
def initialize(_from_message: false, part_one: nil,
|
462
477
|
part_two: nil)
|
478
|
+
@_from_message = _from_message
|
463
479
|
super
|
464
480
|
self.part_one = part_one
|
465
481
|
self.part_two = part_two
|
@@ -500,7 +516,8 @@ module Schemas
|
|
500
516
|
attr_accessor :id
|
501
517
|
|
502
518
|
# @override
|
503
|
-
def initialize(id: nil)
|
519
|
+
def initialize(_from_message: false, id: nil)
|
520
|
+
@_from_message = _from_message
|
504
521
|
super
|
505
522
|
self.id = id
|
506
523
|
end
|
@@ -539,7 +556,8 @@ module Schemas
|
|
539
556
|
attr_accessor :test_id
|
540
557
|
|
541
558
|
# @override
|
542
|
-
def initialize(test_id: nil)
|
559
|
+
def initialize(_from_message: false, test_id: nil)
|
560
|
+
@_from_message = _from_message
|
543
561
|
super
|
544
562
|
self.test_id = test_id
|
545
563
|
end
|
@@ -580,8 +598,9 @@ module Schemas
|
|
580
598
|
attr_accessor :some_bool
|
581
599
|
|
582
600
|
# @override
|
583
|
-
def initialize(test_id: nil,
|
601
|
+
def initialize(_from_message: false, test_id: nil,
|
584
602
|
some_bool: nil)
|
603
|
+
@_from_message = _from_message
|
585
604
|
super
|
586
605
|
self.test_id = test_id
|
587
606
|
self.some_bool = some_bool
|
@@ -626,7 +645,8 @@ module Schemas
|
|
626
645
|
attr_accessor :property
|
627
646
|
|
628
647
|
# @override
|
629
|
-
def initialize(property: nil)
|
648
|
+
def initialize(_from_message: false, property: nil)
|
649
|
+
@_from_message = _from_message
|
630
650
|
super
|
631
651
|
self.property = property
|
632
652
|
end
|
@@ -663,7 +683,8 @@ module Schemas
|
|
663
683
|
end
|
664
684
|
|
665
685
|
# @override
|
666
|
-
def initialize(properties: {})
|
686
|
+
def initialize(_from_message: false, properties: {})
|
687
|
+
@_from_message = _from_message
|
667
688
|
super
|
668
689
|
self.properties = properties
|
669
690
|
end
|
@@ -706,7 +727,8 @@ module Schemas
|
|
706
727
|
attr_accessor :a_record_field
|
707
728
|
|
708
729
|
# @override
|
709
|
-
def initialize(a_record_field: nil)
|
730
|
+
def initialize(_from_message: false, a_record_field: nil)
|
731
|
+
@_from_message = _from_message
|
710
732
|
super
|
711
733
|
self.a_record_field = a_record_field
|
712
734
|
end
|
@@ -731,35 +753,56 @@ module Schemas
|
|
731
753
|
|
732
754
|
# Autogenerated Schema for Enum at com.my-namespace.AnEnum
|
733
755
|
class AnEnum < Deimos::SchemaClass::Enum
|
734
|
-
# @return ['sym1', 'sym2']
|
735
|
-
attr_accessor :an_enum
|
736
|
-
|
737
756
|
# @override
|
738
757
|
def symbols
|
739
758
|
%w(sym1 sym2)
|
740
759
|
end
|
760
|
+
|
761
|
+
|
762
|
+
def sym1?
|
763
|
+
@value == 'sym1'
|
764
|
+
end
|
765
|
+
|
766
|
+
def sym2?
|
767
|
+
@value == 'sym2'
|
768
|
+
end
|
769
|
+
|
741
770
|
end
|
742
771
|
|
743
772
|
# Autogenerated Schema for Enum at com.my-namespace.AnotherEnum
|
744
773
|
class AnotherEnum < Deimos::SchemaClass::Enum
|
745
|
-
# @return ['sym3', 'sym4']
|
746
|
-
attr_accessor :another_enum
|
747
|
-
|
748
774
|
# @override
|
749
775
|
def symbols
|
750
776
|
%w(sym3 sym4)
|
751
777
|
end
|
778
|
+
|
779
|
+
|
780
|
+
def sym3?
|
781
|
+
@value == 'sym3'
|
782
|
+
end
|
783
|
+
|
784
|
+
def sym4?
|
785
|
+
@value == 'sym4'
|
786
|
+
end
|
787
|
+
|
752
788
|
end
|
753
789
|
|
754
790
|
# Autogenerated Schema for Enum at com.my-namespace.YetAnotherEnum
|
755
791
|
class YetAnotherEnum < Deimos::SchemaClass::Enum
|
756
|
-
# @return ['sym5', 'sym6']
|
757
|
-
attr_accessor :yet_another_enum
|
758
|
-
|
759
792
|
# @override
|
760
793
|
def symbols
|
761
794
|
%w(sym5 sym6)
|
762
795
|
end
|
796
|
+
|
797
|
+
|
798
|
+
def sym5?
|
799
|
+
@value == 'sym5'
|
800
|
+
end
|
801
|
+
|
802
|
+
def sym6?
|
803
|
+
@value == 'sym6'
|
804
|
+
end
|
805
|
+
|
763
806
|
end
|
764
807
|
|
765
808
|
|
@@ -836,7 +879,7 @@ module Schemas
|
|
836
879
|
end
|
837
880
|
|
838
881
|
# @override
|
839
|
-
def initialize(test_id: nil,
|
882
|
+
def initialize(_from_message: false, test_id: nil,
|
840
883
|
test_float: nil,
|
841
884
|
test_string_array: ["test"],
|
842
885
|
test_int_array: [123],
|
@@ -849,6 +892,7 @@ module Schemas
|
|
849
892
|
some_enum_array: nil,
|
850
893
|
some_optional_enum: nil,
|
851
894
|
some_enum_with_default: "sym6")
|
895
|
+
@_from_message = _from_message
|
852
896
|
super
|
853
897
|
self.test_id = test_id
|
854
898
|
self.test_float = test_float
|
@@ -919,11 +963,12 @@ module Schemas
|
|
919
963
|
attr_accessor :timestamp
|
920
964
|
|
921
965
|
# @override
|
922
|
-
def initialize(test_id: nil,
|
966
|
+
def initialize(_from_message: false, test_id: nil,
|
923
967
|
updated_at: nil,
|
924
968
|
some_int: nil,
|
925
969
|
some_datetime_int: nil,
|
926
970
|
timestamp: nil)
|
971
|
+
@_from_message = _from_message
|
927
972
|
super
|
928
973
|
self.test_id = test_id
|
929
974
|
self.updated_at = updated_at
|
@@ -976,10 +1021,11 @@ module Schemas
|
|
976
1021
|
attr_accessor :timestamp
|
977
1022
|
|
978
1023
|
# @override
|
979
|
-
def initialize(test_id: nil,
|
1024
|
+
def initialize(_from_message: false, test_id: nil,
|
980
1025
|
some_int: nil,
|
981
1026
|
message_id: nil,
|
982
1027
|
timestamp: nil)
|
1028
|
+
@_from_message = _from_message
|
983
1029
|
super
|
984
1030
|
self.test_id = test_id
|
985
1031
|
self.some_int = some_int
|
@@ -1028,9 +1074,10 @@ module Schemas
|
|
1028
1074
|
attr_accessor :title
|
1029
1075
|
|
1030
1076
|
# @override
|
1031
|
-
def initialize(test_id: nil,
|
1077
|
+
def initialize(_from_message: false, test_id: nil,
|
1032
1078
|
some_int: nil,
|
1033
1079
|
title: nil)
|
1080
|
+
@_from_message = _from_message
|
1034
1081
|
super
|
1035
1082
|
self.test_id = test_id
|
1036
1083
|
self.some_int = some_int
|
@@ -1079,8 +1126,9 @@ module Schemas
|
|
1079
1126
|
attr_accessor :record1_id
|
1080
1127
|
|
1081
1128
|
# @override
|
1082
|
-
def initialize(record1_map: {},
|
1129
|
+
def initialize(_from_message: false, record1_map: {},
|
1083
1130
|
record1_id: 0)
|
1131
|
+
@_from_message = _from_message
|
1084
1132
|
super
|
1085
1133
|
self.record1_map = record1_map
|
1086
1134
|
self.record1_id = record1_id
|
@@ -1113,7 +1161,8 @@ module Schemas
|
|
1113
1161
|
attr_accessor :record2_id
|
1114
1162
|
|
1115
1163
|
# @override
|
1116
|
-
def initialize(record2_id: "")
|
1164
|
+
def initialize(_from_message: false, record2_id: "")
|
1165
|
+
@_from_message = _from_message
|
1117
1166
|
super
|
1118
1167
|
self.record2_id = record2_id
|
1119
1168
|
end
|
@@ -1144,7 +1193,8 @@ module Schemas
|
|
1144
1193
|
attr_accessor :record3_id
|
1145
1194
|
|
1146
1195
|
# @override
|
1147
|
-
def initialize(record3_id: 0.0)
|
1196
|
+
def initialize(_from_message: false, record3_id: 0.0)
|
1197
|
+
@_from_message = _from_message
|
1148
1198
|
super
|
1149
1199
|
self.record3_id = record3_id
|
1150
1200
|
end
|
@@ -1175,7 +1225,8 @@ module Schemas
|
|
1175
1225
|
attr_accessor :record4_id
|
1176
1226
|
|
1177
1227
|
# @override
|
1178
|
-
def initialize(record4_id: 0)
|
1228
|
+
def initialize(_from_message: false, record4_id: 0)
|
1229
|
+
@_from_message = _from_message
|
1179
1230
|
super
|
1180
1231
|
self.record4_id = record4_id
|
1181
1232
|
end
|
@@ -1231,9 +1282,10 @@ module Schemas
|
|
1231
1282
|
end
|
1232
1283
|
|
1233
1284
|
# @override
|
1234
|
-
def initialize(test_id: "",
|
1285
|
+
def initialize(_from_message: false, test_id: "",
|
1235
1286
|
test_long: nil,
|
1236
1287
|
test_union_type: nil)
|
1288
|
+
@_from_message = _from_message
|
1237
1289
|
super
|
1238
1290
|
self.test_id = test_id
|
1239
1291
|
self.test_long = test_long
|
@@ -1284,11 +1336,12 @@ module Schemas
|
|
1284
1336
|
attr_accessor :timestamp
|
1285
1337
|
|
1286
1338
|
# @override
|
1287
|
-
def initialize(id: nil,
|
1339
|
+
def initialize(_from_message: false, id: nil,
|
1288
1340
|
test_id: nil,
|
1289
1341
|
some_int: nil,
|
1290
1342
|
message_id: nil,
|
1291
1343
|
timestamp: nil)
|
1344
|
+
@_from_message = _from_message
|
1292
1345
|
super
|
1293
1346
|
self.id = id
|
1294
1347
|
self.test_id = test_id
|
@@ -1335,7 +1388,8 @@ module Schemas
|
|
1335
1388
|
attr_accessor :update_request_id
|
1336
1389
|
|
1337
1390
|
# @override
|
1338
|
-
def initialize(update_request_id: nil)
|
1391
|
+
def initialize(_from_message: false, update_request_id: nil)
|
1392
|
+
@_from_message = _from_message
|
1339
1393
|
super
|
1340
1394
|
self.update_request_id = update_request_id
|
1341
1395
|
end
|
@@ -1374,7 +1428,8 @@ module Schemas
|
|
1374
1428
|
attr_accessor :update_response_id
|
1375
1429
|
|
1376
1430
|
# @override
|
1377
|
-
def initialize(update_response_id: nil)
|
1431
|
+
def initialize(_from_message: false, update_response_id: nil)
|
1432
|
+
@_from_message = _from_message
|
1378
1433
|
super
|
1379
1434
|
self.update_response_id = update_response_id
|
1380
1435
|
end
|
@@ -1429,7 +1484,7 @@ module Schemas
|
|
1429
1484
|
attr_accessor :created_at
|
1430
1485
|
|
1431
1486
|
# @override
|
1432
|
-
def initialize(id: nil,
|
1487
|
+
def initialize(_from_message: false, id: nil,
|
1433
1488
|
wibble_id: nil,
|
1434
1489
|
name: nil,
|
1435
1490
|
floop: nil,
|
@@ -1438,6 +1493,7 @@ module Schemas
|
|
1438
1493
|
birthday_optional: nil,
|
1439
1494
|
updated_at: nil,
|
1440
1495
|
created_at: nil)
|
1496
|
+
@_from_message = _from_message
|
1441
1497
|
super
|
1442
1498
|
self.id = id
|
1443
1499
|
self.wibble_id = wibble_id
|
@@ -1500,11 +1556,12 @@ module Schemas
|
|
1500
1556
|
attr_accessor :created_at
|
1501
1557
|
|
1502
1558
|
# @override
|
1503
|
-
def initialize(id: nil,
|
1559
|
+
def initialize(_from_message: false, id: nil,
|
1504
1560
|
widget_id: nil,
|
1505
1561
|
name: nil,
|
1506
1562
|
updated_at: nil,
|
1507
1563
|
created_at: nil)
|
1564
|
+
@_from_message = _from_message
|
1508
1565
|
super
|
1509
1566
|
self.id = id
|
1510
1567
|
self.widget_id = widget_id
|
@@ -1559,11 +1616,12 @@ module Schemas
|
|
1559
1616
|
attr_accessor :created_at
|
1560
1617
|
|
1561
1618
|
# @override
|
1562
|
-
def initialize(id: nil,
|
1619
|
+
def initialize(_from_message: false, id: nil,
|
1563
1620
|
widget_id: nil,
|
1564
1621
|
model_id: nil,
|
1565
1622
|
updated_at: nil,
|
1566
1623
|
created_at: nil)
|
1624
|
+
@_from_message = _from_message
|
1567
1625
|
super
|
1568
1626
|
self.id = id
|
1569
1627
|
self.widget_id = widget_id
|