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 :a_record_field
|
13
13
|
|
14
14
|
# @override
|
15
|
-
def initialize(a_record_field: nil)
|
15
|
+
def initialize(_from_message: false, a_record_field: nil)
|
16
|
+
@_from_message = _from_message
|
16
17
|
super
|
17
18
|
self.a_record_field = a_record_field
|
18
19
|
end
|
@@ -45,13 +46,20 @@ module Schemas
|
|
45
46
|
### Primary Schema Class ###
|
46
47
|
# Autogenerated Schema for Enum at com.my-namespace.AnEnum
|
47
48
|
class AnEnum < Deimos::SchemaClass::Enum
|
48
|
-
# @return ['sym1', 'sym2']
|
49
|
-
attr_accessor :an_enum
|
50
|
-
|
51
49
|
# @override
|
52
50
|
def symbols
|
53
51
|
%w(sym1 sym2)
|
54
52
|
end
|
53
|
+
|
54
|
+
|
55
|
+
def sym1?
|
56
|
+
@value == 'sym1'
|
57
|
+
end
|
58
|
+
|
59
|
+
def sym2?
|
60
|
+
@value == 'sym2'
|
61
|
+
end
|
62
|
+
|
55
63
|
end
|
56
64
|
end
|
57
65
|
|
@@ -64,13 +72,20 @@ module Schemas
|
|
64
72
|
### Primary Schema Class ###
|
65
73
|
# Autogenerated Schema for Enum at com.my-namespace.AnotherEnum
|
66
74
|
class AnotherEnum < Deimos::SchemaClass::Enum
|
67
|
-
# @return ['sym3', 'sym4']
|
68
|
-
attr_accessor :another_enum
|
69
|
-
|
70
75
|
# @override
|
71
76
|
def symbols
|
72
77
|
%w(sym3 sym4)
|
73
78
|
end
|
79
|
+
|
80
|
+
|
81
|
+
def sym3?
|
82
|
+
@value == 'sym3'
|
83
|
+
end
|
84
|
+
|
85
|
+
def sym4?
|
86
|
+
@value == 'sym4'
|
87
|
+
end
|
88
|
+
|
74
89
|
end
|
75
90
|
end
|
76
91
|
|
@@ -89,7 +104,8 @@ module Schemas
|
|
89
104
|
attr_accessor :response_id
|
90
105
|
|
91
106
|
# @override
|
92
|
-
def initialize(response_id: nil)
|
107
|
+
def initialize(_from_message: false, response_id: nil)
|
108
|
+
@_from_message = _from_message
|
93
109
|
super
|
94
110
|
self.response_id = response_id
|
95
111
|
end
|
@@ -163,7 +179,7 @@ module Schemas
|
|
163
179
|
end
|
164
180
|
|
165
181
|
# @override
|
166
|
-
def initialize(a_string: nil,
|
182
|
+
def initialize(_from_message: false, a_string: nil,
|
167
183
|
a_int: nil,
|
168
184
|
a_long: nil,
|
169
185
|
a_float: nil,
|
@@ -175,6 +191,7 @@ module Schemas
|
|
175
191
|
timestamp: nil,
|
176
192
|
message_id: nil,
|
177
193
|
a_record: nil)
|
194
|
+
@_from_message = _from_message
|
178
195
|
super
|
179
196
|
self.a_string = a_string
|
180
197
|
self.a_int = a_int
|
@@ -235,7 +252,8 @@ module Schemas
|
|
235
252
|
attr_accessor :response_id
|
236
253
|
|
237
254
|
# @override
|
238
|
-
def initialize(response_id: nil)
|
255
|
+
def initialize(_from_message: false, response_id: nil)
|
256
|
+
@_from_message = _from_message
|
239
257
|
super
|
240
258
|
self.response_id = response_id
|
241
259
|
end
|
@@ -276,8 +294,9 @@ module Schemas
|
|
276
294
|
attr_accessor :some_int
|
277
295
|
|
278
296
|
# @override
|
279
|
-
def initialize(test_id: nil,
|
297
|
+
def initialize(_from_message: false, test_id: nil,
|
280
298
|
some_int: nil)
|
299
|
+
@_from_message = _from_message
|
281
300
|
super
|
282
301
|
self.test_id = test_id
|
283
302
|
self.some_int = some_int
|
@@ -324,10 +343,11 @@ module Schemas
|
|
324
343
|
attr_accessor :some_optional_int
|
325
344
|
|
326
345
|
# @override
|
327
|
-
def initialize(some_int: nil,
|
346
|
+
def initialize(_from_message: false, some_int: nil,
|
328
347
|
some_float: nil,
|
329
348
|
some_string: nil,
|
330
349
|
some_optional_int: nil)
|
350
|
+
@_from_message = _from_message
|
331
351
|
super
|
332
352
|
self.some_int = some_int
|
333
353
|
self.some_float = some_float
|
@@ -393,11 +413,12 @@ module Schemas
|
|
393
413
|
end
|
394
414
|
|
395
415
|
# @override
|
396
|
-
def initialize(test_id: nil,
|
416
|
+
def initialize(_from_message: false, test_id: nil,
|
397
417
|
test_float: nil,
|
398
418
|
test_array: nil,
|
399
419
|
some_nested_record: nil,
|
400
420
|
some_optional_record: nil)
|
421
|
+
@_from_message = _from_message
|
401
422
|
super
|
402
423
|
self.test_id = test_id
|
403
424
|
self.test_float = test_float
|
@@ -416,6 +437,13 @@ module Schemas
|
|
416
437
|
'com.my-namespace'
|
417
438
|
end
|
418
439
|
|
440
|
+
def self.tombstone(key)
|
441
|
+
record = self.allocate
|
442
|
+
record.tombstone_key = key
|
443
|
+
record.test_id = key
|
444
|
+
record
|
445
|
+
end
|
446
|
+
|
419
447
|
# @override
|
420
448
|
def as_json(_opts={})
|
421
449
|
{
|
@@ -446,8 +474,9 @@ module Schemas
|
|
446
474
|
attr_accessor :some_int
|
447
475
|
|
448
476
|
# @override
|
449
|
-
def initialize(test_id: nil,
|
477
|
+
def initialize(_from_message: false, test_id: nil,
|
450
478
|
some_int: nil)
|
479
|
+
@_from_message = _from_message
|
451
480
|
super
|
452
481
|
self.test_id = test_id
|
453
482
|
self.some_int = some_int
|
@@ -490,8 +519,9 @@ module Schemas
|
|
490
519
|
attr_accessor :part_two
|
491
520
|
|
492
521
|
# @override
|
493
|
-
def initialize(part_one: nil,
|
522
|
+
def initialize(_from_message: false, part_one: nil,
|
494
523
|
part_two: nil)
|
524
|
+
@_from_message = _from_message
|
495
525
|
super
|
496
526
|
self.part_one = part_one
|
497
527
|
self.part_two = part_two
|
@@ -532,7 +562,8 @@ module Schemas
|
|
532
562
|
attr_accessor :id
|
533
563
|
|
534
564
|
# @override
|
535
|
-
def initialize(id: nil)
|
565
|
+
def initialize(_from_message: false, id: nil)
|
566
|
+
@_from_message = _from_message
|
536
567
|
super
|
537
568
|
self.id = id
|
538
569
|
end
|
@@ -571,7 +602,8 @@ module Schemas
|
|
571
602
|
attr_accessor :test_id
|
572
603
|
|
573
604
|
# @override
|
574
|
-
def initialize(test_id: nil)
|
605
|
+
def initialize(_from_message: false, test_id: nil)
|
606
|
+
@_from_message = _from_message
|
575
607
|
super
|
576
608
|
self.test_id = test_id
|
577
609
|
end
|
@@ -612,8 +644,9 @@ module Schemas
|
|
612
644
|
attr_accessor :some_bool
|
613
645
|
|
614
646
|
# @override
|
615
|
-
def initialize(test_id: nil,
|
647
|
+
def initialize(_from_message: false, test_id: nil,
|
616
648
|
some_bool: nil)
|
649
|
+
@_from_message = _from_message
|
617
650
|
super
|
618
651
|
self.test_id = test_id
|
619
652
|
self.some_bool = some_bool
|
@@ -662,7 +695,8 @@ module Schemas
|
|
662
695
|
end
|
663
696
|
|
664
697
|
# @override
|
665
|
-
def initialize(properties: {})
|
698
|
+
def initialize(_from_message: false, properties: {})
|
699
|
+
@_from_message = _from_message
|
666
700
|
super
|
667
701
|
self.properties = properties
|
668
702
|
end
|
@@ -677,13 +711,6 @@ module Schemas
|
|
677
711
|
'com.my-namespace'
|
678
712
|
end
|
679
713
|
|
680
|
-
def self.tombstone(key)
|
681
|
-
record = self.allocate
|
682
|
-
record.tombstone_key = key
|
683
|
-
record.a_string = key
|
684
|
-
record
|
685
|
-
end
|
686
|
-
|
687
714
|
# @override
|
688
715
|
def as_json(_opts={})
|
689
716
|
{
|
@@ -776,7 +803,7 @@ module Schemas
|
|
776
803
|
end
|
777
804
|
|
778
805
|
# @override
|
779
|
-
def initialize(test_id: nil,
|
806
|
+
def initialize(_from_message: false, test_id: nil,
|
780
807
|
test_float: nil,
|
781
808
|
test_string_array: ["test"],
|
782
809
|
test_int_array: [123],
|
@@ -789,6 +816,7 @@ module Schemas
|
|
789
816
|
some_enum_array: nil,
|
790
817
|
some_optional_enum: nil,
|
791
818
|
some_enum_with_default: "sym6")
|
819
|
+
@_from_message = _from_message
|
792
820
|
super
|
793
821
|
self.test_id = test_id
|
794
822
|
self.test_float = test_float
|
@@ -859,11 +887,12 @@ module Schemas
|
|
859
887
|
attr_accessor :timestamp
|
860
888
|
|
861
889
|
# @override
|
862
|
-
def initialize(test_id: nil,
|
890
|
+
def initialize(_from_message: false, test_id: nil,
|
863
891
|
updated_at: nil,
|
864
892
|
some_int: nil,
|
865
893
|
some_datetime_int: nil,
|
866
894
|
timestamp: nil)
|
895
|
+
@_from_message = _from_message
|
867
896
|
super
|
868
897
|
self.test_id = test_id
|
869
898
|
self.updated_at = updated_at
|
@@ -916,10 +945,11 @@ module Schemas
|
|
916
945
|
attr_accessor :timestamp
|
917
946
|
|
918
947
|
# @override
|
919
|
-
def initialize(test_id: nil,
|
948
|
+
def initialize(_from_message: false, test_id: nil,
|
920
949
|
some_int: nil,
|
921
950
|
message_id: nil,
|
922
951
|
timestamp: nil)
|
952
|
+
@_from_message = _from_message
|
923
953
|
super
|
924
954
|
self.test_id = test_id
|
925
955
|
self.some_int = some_int
|
@@ -968,9 +998,10 @@ module Schemas
|
|
968
998
|
attr_accessor :title
|
969
999
|
|
970
1000
|
# @override
|
971
|
-
def initialize(test_id: nil,
|
1001
|
+
def initialize(_from_message: false, test_id: nil,
|
972
1002
|
some_int: nil,
|
973
1003
|
title: nil)
|
1004
|
+
@_from_message = _from_message
|
974
1005
|
super
|
975
1006
|
self.test_id = test_id
|
976
1007
|
self.some_int = some_int
|
@@ -1040,9 +1071,10 @@ module Schemas
|
|
1040
1071
|
end
|
1041
1072
|
|
1042
1073
|
# @override
|
1043
|
-
def initialize(test_id: "",
|
1074
|
+
def initialize(_from_message: false, test_id: "",
|
1044
1075
|
test_long: nil,
|
1045
1076
|
test_union_type: nil)
|
1077
|
+
@_from_message = _from_message
|
1046
1078
|
super
|
1047
1079
|
self.test_id = test_id
|
1048
1080
|
self.test_long = test_long
|
@@ -1093,11 +1125,12 @@ module Schemas
|
|
1093
1125
|
attr_accessor :timestamp
|
1094
1126
|
|
1095
1127
|
# @override
|
1096
|
-
def initialize(id: nil,
|
1128
|
+
def initialize(_from_message: false, id: nil,
|
1097
1129
|
test_id: nil,
|
1098
1130
|
some_int: nil,
|
1099
1131
|
message_id: nil,
|
1100
1132
|
timestamp: nil)
|
1133
|
+
@_from_message = _from_message
|
1101
1134
|
super
|
1102
1135
|
self.id = id
|
1103
1136
|
self.test_id = test_id
|
@@ -1144,7 +1177,8 @@ module Schemas
|
|
1144
1177
|
attr_accessor :property
|
1145
1178
|
|
1146
1179
|
# @override
|
1147
|
-
def initialize(property: nil)
|
1180
|
+
def initialize(_from_message: false, property: nil)
|
1181
|
+
@_from_message = _from_message
|
1148
1182
|
super
|
1149
1183
|
self.property = property
|
1150
1184
|
end
|
@@ -1185,8 +1219,9 @@ module Schemas
|
|
1185
1219
|
attr_accessor :record1_id
|
1186
1220
|
|
1187
1221
|
# @override
|
1188
|
-
def initialize(record1_map: {},
|
1222
|
+
def initialize(_from_message: false, record1_map: {},
|
1189
1223
|
record1_id: 0)
|
1224
|
+
@_from_message = _from_message
|
1190
1225
|
super
|
1191
1226
|
self.record1_map = record1_map
|
1192
1227
|
self.record1_id = record1_id
|
@@ -1227,7 +1262,8 @@ module Schemas
|
|
1227
1262
|
attr_accessor :record2_id
|
1228
1263
|
|
1229
1264
|
# @override
|
1230
|
-
def initialize(record2_id: "")
|
1265
|
+
def initialize(_from_message: false, record2_id: "")
|
1266
|
+
@_from_message = _from_message
|
1231
1267
|
super
|
1232
1268
|
self.record2_id = record2_id
|
1233
1269
|
end
|
@@ -1266,7 +1302,8 @@ module Schemas
|
|
1266
1302
|
attr_accessor :record3_id
|
1267
1303
|
|
1268
1304
|
# @override
|
1269
|
-
def initialize(record3_id: 0.0)
|
1305
|
+
def initialize(_from_message: false, record3_id: 0.0)
|
1306
|
+
@_from_message = _from_message
|
1270
1307
|
super
|
1271
1308
|
self.record3_id = record3_id
|
1272
1309
|
end
|
@@ -1305,7 +1342,8 @@ module Schemas
|
|
1305
1342
|
attr_accessor :record4_id
|
1306
1343
|
|
1307
1344
|
# @override
|
1308
|
-
def initialize(record4_id: 0)
|
1345
|
+
def initialize(_from_message: false, record4_id: 0)
|
1346
|
+
@_from_message = _from_message
|
1309
1347
|
super
|
1310
1348
|
self.record4_id = record4_id
|
1311
1349
|
end
|
@@ -1344,7 +1382,8 @@ module Schemas
|
|
1344
1382
|
attr_accessor :update_request_id
|
1345
1383
|
|
1346
1384
|
# @override
|
1347
|
-
def initialize(update_request_id: nil)
|
1385
|
+
def initialize(_from_message: false, update_request_id: nil)
|
1386
|
+
@_from_message = _from_message
|
1348
1387
|
super
|
1349
1388
|
self.update_request_id = update_request_id
|
1350
1389
|
end
|
@@ -1383,7 +1422,8 @@ module Schemas
|
|
1383
1422
|
attr_accessor :update_response_id
|
1384
1423
|
|
1385
1424
|
# @override
|
1386
|
-
def initialize(update_response_id: nil)
|
1425
|
+
def initialize(_from_message: false, update_response_id: nil)
|
1426
|
+
@_from_message = _from_message
|
1387
1427
|
super
|
1388
1428
|
self.update_response_id = update_response_id
|
1389
1429
|
end
|
@@ -1438,7 +1478,7 @@ module Schemas
|
|
1438
1478
|
attr_accessor :created_at
|
1439
1479
|
|
1440
1480
|
# @override
|
1441
|
-
def initialize(id: nil,
|
1481
|
+
def initialize(_from_message: false, id: nil,
|
1442
1482
|
wibble_id: nil,
|
1443
1483
|
name: nil,
|
1444
1484
|
floop: nil,
|
@@ -1447,6 +1487,7 @@ module Schemas
|
|
1447
1487
|
birthday_optional: nil,
|
1448
1488
|
updated_at: nil,
|
1449
1489
|
created_at: nil)
|
1490
|
+
@_from_message = _from_message
|
1450
1491
|
super
|
1451
1492
|
self.id = id
|
1452
1493
|
self.wibble_id = wibble_id
|
@@ -1509,11 +1550,12 @@ module Schemas
|
|
1509
1550
|
attr_accessor :created_at
|
1510
1551
|
|
1511
1552
|
# @override
|
1512
|
-
def initialize(id: nil,
|
1553
|
+
def initialize(_from_message: false, id: nil,
|
1513
1554
|
widget_id: nil,
|
1514
1555
|
name: nil,
|
1515
1556
|
updated_at: nil,
|
1516
1557
|
created_at: nil)
|
1558
|
+
@_from_message = _from_message
|
1517
1559
|
super
|
1518
1560
|
self.id = id
|
1519
1561
|
self.widget_id = widget_id
|
@@ -1568,11 +1610,12 @@ module Schemas
|
|
1568
1610
|
attr_accessor :created_at
|
1569
1611
|
|
1570
1612
|
# @override
|
1571
|
-
def initialize(id: nil,
|
1613
|
+
def initialize(_from_message: false, id: nil,
|
1572
1614
|
widget_id: nil,
|
1573
1615
|
model_id: nil,
|
1574
1616
|
updated_at: nil,
|
1575
1617
|
created_at: nil)
|
1618
|
+
@_from_message = _from_message
|
1576
1619
|
super
|
1577
1620
|
self.id = id
|
1578
1621
|
self.widget_id = widget_id
|
@@ -1613,13 +1656,20 @@ module Schemas
|
|
1613
1656
|
### Primary Schema Class ###
|
1614
1657
|
# Autogenerated Schema for Enum at com.my-namespace.YetAnotherEnum
|
1615
1658
|
class YetAnotherEnum < Deimos::SchemaClass::Enum
|
1616
|
-
# @return ['sym5', 'sym6']
|
1617
|
-
attr_accessor :yet_another_enum
|
1618
|
-
|
1619
1659
|
# @override
|
1620
1660
|
def symbols
|
1621
1661
|
%w(sym5 sym6)
|
1622
1662
|
end
|
1663
|
+
|
1664
|
+
|
1665
|
+
def sym5?
|
1666
|
+
@value == 'sym5'
|
1667
|
+
end
|
1668
|
+
|
1669
|
+
def sym6?
|
1670
|
+
@value == 'sym6'
|
1671
|
+
end
|
1672
|
+
|
1623
1673
|
end
|
1624
1674
|
end
|
1625
1675
|
|