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
|
@@ -453,30 +467,19 @@ module Schemas
|
|
453
467
|
# Autogenerated Schema for Record at com.my-namespace.MySchema
|
454
468
|
class MySchema < Deimos::SchemaClass::Record
|
455
469
|
|
456
|
-
### Attribute Readers ###
|
457
|
-
# @return [MySchemaKey]
|
458
|
-
attr_reader :payload_key
|
459
|
-
|
460
470
|
### Attribute Accessors ###
|
461
471
|
# @return [String]
|
462
472
|
attr_accessor :test_id
|
463
473
|
# @return [Integer]
|
464
474
|
attr_accessor :some_int
|
465
475
|
|
466
|
-
### Attribute Writers ###
|
467
|
-
# @return [MySchemaKey]
|
468
|
-
def payload_key=(value)
|
469
|
-
@payload_key = MySchemaKey.initialize_from_value(value, from_message: self._from_message)
|
470
|
-
end
|
471
|
-
|
472
476
|
# @override
|
473
|
-
def initialize(test_id: nil,
|
474
|
-
some_int: nil
|
475
|
-
|
477
|
+
def initialize(_from_message: false, test_id: nil,
|
478
|
+
some_int: nil)
|
479
|
+
@_from_message = _from_message
|
476
480
|
super
|
477
481
|
self.test_id = test_id
|
478
482
|
self.some_int = some_int
|
479
|
-
self.payload_key = payload_key
|
480
483
|
end
|
481
484
|
|
482
485
|
# @override
|
@@ -489,19 +492,11 @@ module Schemas
|
|
489
492
|
'com.my-namespace'
|
490
493
|
end
|
491
494
|
|
492
|
-
def self.tombstone(key)
|
493
|
-
record = self.allocate
|
494
|
-
record.tombstone_key = MySchemaKey.initialize_from_value(key, from_message: self._from_message)
|
495
|
-
record.payload_key = key
|
496
|
-
record
|
497
|
-
end
|
498
|
-
|
499
495
|
# @override
|
500
496
|
def as_json(_opts={})
|
501
497
|
{
|
502
498
|
'test_id' => @test_id,
|
503
|
-
'some_int' => @some_int
|
504
|
-
'payload_key' => @payload_key&.as_json
|
499
|
+
'some_int' => @some_int
|
505
500
|
}
|
506
501
|
end
|
507
502
|
end
|
@@ -524,8 +519,9 @@ module Schemas
|
|
524
519
|
attr_accessor :part_two
|
525
520
|
|
526
521
|
# @override
|
527
|
-
def initialize(part_one: nil,
|
522
|
+
def initialize(_from_message: false, part_one: nil,
|
528
523
|
part_two: nil)
|
524
|
+
@_from_message = _from_message
|
529
525
|
super
|
530
526
|
self.part_one = part_one
|
531
527
|
self.part_two = part_two
|
@@ -566,7 +562,8 @@ module Schemas
|
|
566
562
|
attr_accessor :id
|
567
563
|
|
568
564
|
# @override
|
569
|
-
def initialize(id: nil)
|
565
|
+
def initialize(_from_message: false, id: nil)
|
566
|
+
@_from_message = _from_message
|
570
567
|
super
|
571
568
|
self.id = id
|
572
569
|
end
|
@@ -605,7 +602,8 @@ module Schemas
|
|
605
602
|
attr_accessor :test_id
|
606
603
|
|
607
604
|
# @override
|
608
|
-
def initialize(test_id: nil)
|
605
|
+
def initialize(_from_message: false, test_id: nil)
|
606
|
+
@_from_message = _from_message
|
609
607
|
super
|
610
608
|
self.test_id = test_id
|
611
609
|
end
|
@@ -646,8 +644,9 @@ module Schemas
|
|
646
644
|
attr_accessor :some_bool
|
647
645
|
|
648
646
|
# @override
|
649
|
-
def initialize(test_id: nil,
|
647
|
+
def initialize(_from_message: false, test_id: nil,
|
650
648
|
some_bool: nil)
|
649
|
+
@_from_message = _from_message
|
651
650
|
super
|
652
651
|
self.test_id = test_id
|
653
652
|
self.some_bool = some_bool
|
@@ -696,7 +695,8 @@ module Schemas
|
|
696
695
|
end
|
697
696
|
|
698
697
|
# @override
|
699
|
-
def initialize(properties: {})
|
698
|
+
def initialize(_from_message: false, properties: {})
|
699
|
+
@_from_message = _from_message
|
700
700
|
super
|
701
701
|
self.properties = properties
|
702
702
|
end
|
@@ -803,7 +803,7 @@ module Schemas
|
|
803
803
|
end
|
804
804
|
|
805
805
|
# @override
|
806
|
-
def initialize(test_id: nil,
|
806
|
+
def initialize(_from_message: false, test_id: nil,
|
807
807
|
test_float: nil,
|
808
808
|
test_string_array: ["test"],
|
809
809
|
test_int_array: [123],
|
@@ -816,6 +816,7 @@ module Schemas
|
|
816
816
|
some_enum_array: nil,
|
817
817
|
some_optional_enum: nil,
|
818
818
|
some_enum_with_default: "sym6")
|
819
|
+
@_from_message = _from_message
|
819
820
|
super
|
820
821
|
self.test_id = test_id
|
821
822
|
self.test_float = test_float
|
@@ -886,11 +887,12 @@ module Schemas
|
|
886
887
|
attr_accessor :timestamp
|
887
888
|
|
888
889
|
# @override
|
889
|
-
def initialize(test_id: nil,
|
890
|
+
def initialize(_from_message: false, test_id: nil,
|
890
891
|
updated_at: nil,
|
891
892
|
some_int: nil,
|
892
893
|
some_datetime_int: nil,
|
893
894
|
timestamp: nil)
|
895
|
+
@_from_message = _from_message
|
894
896
|
super
|
895
897
|
self.test_id = test_id
|
896
898
|
self.updated_at = updated_at
|
@@ -943,10 +945,11 @@ module Schemas
|
|
943
945
|
attr_accessor :timestamp
|
944
946
|
|
945
947
|
# @override
|
946
|
-
def initialize(test_id: nil,
|
948
|
+
def initialize(_from_message: false, test_id: nil,
|
947
949
|
some_int: nil,
|
948
950
|
message_id: nil,
|
949
951
|
timestamp: nil)
|
952
|
+
@_from_message = _from_message
|
950
953
|
super
|
951
954
|
self.test_id = test_id
|
952
955
|
self.some_int = some_int
|
@@ -995,9 +998,10 @@ module Schemas
|
|
995
998
|
attr_accessor :title
|
996
999
|
|
997
1000
|
# @override
|
998
|
-
def initialize(test_id: nil,
|
1001
|
+
def initialize(_from_message: false, test_id: nil,
|
999
1002
|
some_int: nil,
|
1000
1003
|
title: nil)
|
1004
|
+
@_from_message = _from_message
|
1001
1005
|
super
|
1002
1006
|
self.test_id = test_id
|
1003
1007
|
self.some_int = some_int
|
@@ -1067,9 +1071,10 @@ module Schemas
|
|
1067
1071
|
end
|
1068
1072
|
|
1069
1073
|
# @override
|
1070
|
-
def initialize(test_id: "",
|
1074
|
+
def initialize(_from_message: false, test_id: "",
|
1071
1075
|
test_long: nil,
|
1072
1076
|
test_union_type: nil)
|
1077
|
+
@_from_message = _from_message
|
1073
1078
|
super
|
1074
1079
|
self.test_id = test_id
|
1075
1080
|
self.test_long = test_long
|
@@ -1120,11 +1125,12 @@ module Schemas
|
|
1120
1125
|
attr_accessor :timestamp
|
1121
1126
|
|
1122
1127
|
# @override
|
1123
|
-
def initialize(id: nil,
|
1128
|
+
def initialize(_from_message: false, id: nil,
|
1124
1129
|
test_id: nil,
|
1125
1130
|
some_int: nil,
|
1126
1131
|
message_id: nil,
|
1127
1132
|
timestamp: nil)
|
1133
|
+
@_from_message = _from_message
|
1128
1134
|
super
|
1129
1135
|
self.id = id
|
1130
1136
|
self.test_id = test_id
|
@@ -1171,7 +1177,8 @@ module Schemas
|
|
1171
1177
|
attr_accessor :property
|
1172
1178
|
|
1173
1179
|
# @override
|
1174
|
-
def initialize(property: nil)
|
1180
|
+
def initialize(_from_message: false, property: nil)
|
1181
|
+
@_from_message = _from_message
|
1175
1182
|
super
|
1176
1183
|
self.property = property
|
1177
1184
|
end
|
@@ -1212,8 +1219,9 @@ module Schemas
|
|
1212
1219
|
attr_accessor :record1_id
|
1213
1220
|
|
1214
1221
|
# @override
|
1215
|
-
def initialize(record1_map: {},
|
1222
|
+
def initialize(_from_message: false, record1_map: {},
|
1216
1223
|
record1_id: 0)
|
1224
|
+
@_from_message = _from_message
|
1217
1225
|
super
|
1218
1226
|
self.record1_map = record1_map
|
1219
1227
|
self.record1_id = record1_id
|
@@ -1254,7 +1262,8 @@ module Schemas
|
|
1254
1262
|
attr_accessor :record2_id
|
1255
1263
|
|
1256
1264
|
# @override
|
1257
|
-
def initialize(record2_id: "")
|
1265
|
+
def initialize(_from_message: false, record2_id: "")
|
1266
|
+
@_from_message = _from_message
|
1258
1267
|
super
|
1259
1268
|
self.record2_id = record2_id
|
1260
1269
|
end
|
@@ -1293,7 +1302,8 @@ module Schemas
|
|
1293
1302
|
attr_accessor :record3_id
|
1294
1303
|
|
1295
1304
|
# @override
|
1296
|
-
def initialize(record3_id: 0.0)
|
1305
|
+
def initialize(_from_message: false, record3_id: 0.0)
|
1306
|
+
@_from_message = _from_message
|
1297
1307
|
super
|
1298
1308
|
self.record3_id = record3_id
|
1299
1309
|
end
|
@@ -1332,7 +1342,8 @@ module Schemas
|
|
1332
1342
|
attr_accessor :record4_id
|
1333
1343
|
|
1334
1344
|
# @override
|
1335
|
-
def initialize(record4_id: 0)
|
1345
|
+
def initialize(_from_message: false, record4_id: 0)
|
1346
|
+
@_from_message = _from_message
|
1336
1347
|
super
|
1337
1348
|
self.record4_id = record4_id
|
1338
1349
|
end
|
@@ -1371,7 +1382,8 @@ module Schemas
|
|
1371
1382
|
attr_accessor :update_request_id
|
1372
1383
|
|
1373
1384
|
# @override
|
1374
|
-
def initialize(update_request_id: nil)
|
1385
|
+
def initialize(_from_message: false, update_request_id: nil)
|
1386
|
+
@_from_message = _from_message
|
1375
1387
|
super
|
1376
1388
|
self.update_request_id = update_request_id
|
1377
1389
|
end
|
@@ -1410,7 +1422,8 @@ module Schemas
|
|
1410
1422
|
attr_accessor :update_response_id
|
1411
1423
|
|
1412
1424
|
# @override
|
1413
|
-
def initialize(update_response_id: nil)
|
1425
|
+
def initialize(_from_message: false, update_response_id: nil)
|
1426
|
+
@_from_message = _from_message
|
1414
1427
|
super
|
1415
1428
|
self.update_response_id = update_response_id
|
1416
1429
|
end
|
@@ -1465,7 +1478,7 @@ module Schemas
|
|
1465
1478
|
attr_accessor :created_at
|
1466
1479
|
|
1467
1480
|
# @override
|
1468
|
-
def initialize(id: nil,
|
1481
|
+
def initialize(_from_message: false, id: nil,
|
1469
1482
|
wibble_id: nil,
|
1470
1483
|
name: nil,
|
1471
1484
|
floop: nil,
|
@@ -1474,6 +1487,7 @@ module Schemas
|
|
1474
1487
|
birthday_optional: nil,
|
1475
1488
|
updated_at: nil,
|
1476
1489
|
created_at: nil)
|
1490
|
+
@_from_message = _from_message
|
1477
1491
|
super
|
1478
1492
|
self.id = id
|
1479
1493
|
self.wibble_id = wibble_id
|
@@ -1536,11 +1550,12 @@ module Schemas
|
|
1536
1550
|
attr_accessor :created_at
|
1537
1551
|
|
1538
1552
|
# @override
|
1539
|
-
def initialize(id: nil,
|
1553
|
+
def initialize(_from_message: false, id: nil,
|
1540
1554
|
widget_id: nil,
|
1541
1555
|
name: nil,
|
1542
1556
|
updated_at: nil,
|
1543
1557
|
created_at: nil)
|
1558
|
+
@_from_message = _from_message
|
1544
1559
|
super
|
1545
1560
|
self.id = id
|
1546
1561
|
self.widget_id = widget_id
|
@@ -1595,11 +1610,12 @@ module Schemas
|
|
1595
1610
|
attr_accessor :created_at
|
1596
1611
|
|
1597
1612
|
# @override
|
1598
|
-
def initialize(id: nil,
|
1613
|
+
def initialize(_from_message: false, id: nil,
|
1599
1614
|
widget_id: nil,
|
1600
1615
|
model_id: nil,
|
1601
1616
|
updated_at: nil,
|
1602
1617
|
created_at: nil)
|
1618
|
+
@_from_message = _from_message
|
1603
1619
|
super
|
1604
1620
|
self.id = id
|
1605
1621
|
self.widget_id = widget_id
|
@@ -1640,13 +1656,20 @@ module Schemas
|
|
1640
1656
|
### Primary Schema Class ###
|
1641
1657
|
# Autogenerated Schema for Enum at com.my-namespace.YetAnotherEnum
|
1642
1658
|
class YetAnotherEnum < Deimos::SchemaClass::Enum
|
1643
|
-
# @return ['sym5', 'sym6']
|
1644
|
-
attr_accessor :yet_another_enum
|
1645
|
-
|
1646
1659
|
# @override
|
1647
1660
|
def symbols
|
1648
1661
|
%w(sym5 sym6)
|
1649
1662
|
end
|
1663
|
+
|
1664
|
+
|
1665
|
+
def sym5?
|
1666
|
+
@value == 'sym5'
|
1667
|
+
end
|
1668
|
+
|
1669
|
+
def sym6?
|
1670
|
+
@value == 'sym6'
|
1671
|
+
end
|
1672
|
+
|
1650
1673
|
end
|
1651
1674
|
end
|
1652
1675
|
|