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
|
@@ -200,13 +217,6 @@ module Schemas
|
|
200
217
|
'com.my-namespace'
|
201
218
|
end
|
202
219
|
|
203
|
-
def self.tombstone(key)
|
204
|
-
record = self.allocate
|
205
|
-
record.tombstone_key = key
|
206
|
-
record.a_string = key
|
207
|
-
record
|
208
|
-
end
|
209
|
-
|
210
220
|
# @override
|
211
221
|
def as_json(_opts={})
|
212
222
|
{
|
@@ -242,7 +252,8 @@ module Schemas
|
|
242
252
|
attr_accessor :response_id
|
243
253
|
|
244
254
|
# @override
|
245
|
-
def initialize(response_id: nil)
|
255
|
+
def initialize(_from_message: false, response_id: nil)
|
256
|
+
@_from_message = _from_message
|
246
257
|
super
|
247
258
|
self.response_id = response_id
|
248
259
|
end
|
@@ -283,8 +294,9 @@ module Schemas
|
|
283
294
|
attr_accessor :some_int
|
284
295
|
|
285
296
|
# @override
|
286
|
-
def initialize(test_id: nil,
|
297
|
+
def initialize(_from_message: false, test_id: nil,
|
287
298
|
some_int: nil)
|
299
|
+
@_from_message = _from_message
|
288
300
|
super
|
289
301
|
self.test_id = test_id
|
290
302
|
self.some_int = some_int
|
@@ -331,10 +343,11 @@ module Schemas
|
|
331
343
|
attr_accessor :some_optional_int
|
332
344
|
|
333
345
|
# @override
|
334
|
-
def initialize(some_int: nil,
|
346
|
+
def initialize(_from_message: false, some_int: nil,
|
335
347
|
some_float: nil,
|
336
348
|
some_string: nil,
|
337
349
|
some_optional_int: nil)
|
350
|
+
@_from_message = _from_message
|
338
351
|
super
|
339
352
|
self.some_int = some_int
|
340
353
|
self.some_float = some_float
|
@@ -400,11 +413,12 @@ module Schemas
|
|
400
413
|
end
|
401
414
|
|
402
415
|
# @override
|
403
|
-
def initialize(test_id: nil,
|
416
|
+
def initialize(_from_message: false, test_id: nil,
|
404
417
|
test_float: nil,
|
405
418
|
test_array: nil,
|
406
419
|
some_nested_record: nil,
|
407
420
|
some_optional_record: nil)
|
421
|
+
@_from_message = _from_message
|
408
422
|
super
|
409
423
|
self.test_id = test_id
|
410
424
|
self.test_float = test_float
|
@@ -423,6 +437,13 @@ module Schemas
|
|
423
437
|
'com.my-namespace'
|
424
438
|
end
|
425
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
|
+
|
426
447
|
# @override
|
427
448
|
def as_json(_opts={})
|
428
449
|
{
|
@@ -453,8 +474,9 @@ module Schemas
|
|
453
474
|
attr_accessor :some_int
|
454
475
|
|
455
476
|
# @override
|
456
|
-
def initialize(test_id: nil,
|
477
|
+
def initialize(_from_message: false, test_id: nil,
|
457
478
|
some_int: nil)
|
479
|
+
@_from_message = _from_message
|
458
480
|
super
|
459
481
|
self.test_id = test_id
|
460
482
|
self.some_int = some_int
|
@@ -497,8 +519,9 @@ module Schemas
|
|
497
519
|
attr_accessor :part_two
|
498
520
|
|
499
521
|
# @override
|
500
|
-
def initialize(part_one: nil,
|
522
|
+
def initialize(_from_message: false, part_one: nil,
|
501
523
|
part_two: nil)
|
524
|
+
@_from_message = _from_message
|
502
525
|
super
|
503
526
|
self.part_one = part_one
|
504
527
|
self.part_two = part_two
|
@@ -539,7 +562,8 @@ module Schemas
|
|
539
562
|
attr_accessor :id
|
540
563
|
|
541
564
|
# @override
|
542
|
-
def initialize(id: nil)
|
565
|
+
def initialize(_from_message: false, id: nil)
|
566
|
+
@_from_message = _from_message
|
543
567
|
super
|
544
568
|
self.id = id
|
545
569
|
end
|
@@ -578,7 +602,8 @@ module Schemas
|
|
578
602
|
attr_accessor :test_id
|
579
603
|
|
580
604
|
# @override
|
581
|
-
def initialize(test_id: nil)
|
605
|
+
def initialize(_from_message: false, test_id: nil)
|
606
|
+
@_from_message = _from_message
|
582
607
|
super
|
583
608
|
self.test_id = test_id
|
584
609
|
end
|
@@ -619,8 +644,9 @@ module Schemas
|
|
619
644
|
attr_accessor :some_bool
|
620
645
|
|
621
646
|
# @override
|
622
|
-
def initialize(test_id: nil,
|
647
|
+
def initialize(_from_message: false, test_id: nil,
|
623
648
|
some_bool: nil)
|
649
|
+
@_from_message = _from_message
|
624
650
|
super
|
625
651
|
self.test_id = test_id
|
626
652
|
self.some_bool = some_bool
|
@@ -669,7 +695,8 @@ module Schemas
|
|
669
695
|
end
|
670
696
|
|
671
697
|
# @override
|
672
|
-
def initialize(properties: {})
|
698
|
+
def initialize(_from_message: false, properties: {})
|
699
|
+
@_from_message = _from_message
|
673
700
|
super
|
674
701
|
self.properties = properties
|
675
702
|
end
|
@@ -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
|
|