deimos-ruby 2.1.2 → 2.1.3
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 +5 -0
- data/karafka.rb +71 -1
- data/lib/deimos/schema_backends/avro_schema_coercer.rb +2 -0
- data/lib/deimos/version.rb +1 -1
- 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 +65 -36
- data/spec/snapshots/consumers.snap +67 -37
- data/spec/snapshots/consumers_and_producers-no-nest.snap +60 -58
- data/spec/snapshots/consumers_and_producers.snap +62 -59
- data/spec/snapshots/consumers_circular-no-nest.snap +65 -36
- data/spec/snapshots/consumers_circular.snap +67 -37
- data/spec/snapshots/consumers_complex_types-no-nest.snap +65 -36
- data/spec/snapshots/consumers_complex_types.snap +67 -37
- data/spec/snapshots/consumers_nested-no-nest.snap +58 -29
- data/spec/snapshots/consumers_nested.snap +60 -30
- data/spec/snapshots/namespace_folders.snap +66 -61
- data/spec/snapshots/namespace_map.snap +66 -61
- data/spec/snapshots/producers_with_key-no-nest.snap +67 -51
- data/spec/snapshots/producers_with_key.snap +69 -52
- 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
|
@@ -130,7 +132,7 @@ module Schemas
|
|
130
132
|
end
|
131
133
|
|
132
134
|
# @override
|
133
|
-
def initialize(a_string: nil,
|
135
|
+
def initialize(_from_message: false, a_string: nil,
|
134
136
|
a_int: nil,
|
135
137
|
a_long: nil,
|
136
138
|
a_float: nil,
|
@@ -142,6 +144,7 @@ module Schemas
|
|
142
144
|
timestamp: nil,
|
143
145
|
message_id: nil,
|
144
146
|
a_record: nil)
|
147
|
+
@_from_message = _from_message
|
145
148
|
super
|
146
149
|
self.a_string = a_string
|
147
150
|
self.a_int = a_int
|
@@ -202,7 +205,8 @@ module Schemas
|
|
202
205
|
attr_accessor :response_id
|
203
206
|
|
204
207
|
# @override
|
205
|
-
def initialize(response_id: nil)
|
208
|
+
def initialize(_from_message: false, response_id: nil)
|
209
|
+
@_from_message = _from_message
|
206
210
|
super
|
207
211
|
self.response_id = response_id
|
208
212
|
end
|
@@ -243,8 +247,9 @@ module Schemas
|
|
243
247
|
attr_accessor :some_int
|
244
248
|
|
245
249
|
# @override
|
246
|
-
def initialize(test_id: nil,
|
250
|
+
def initialize(_from_message: false, test_id: nil,
|
247
251
|
some_int: nil)
|
252
|
+
@_from_message = _from_message
|
248
253
|
super
|
249
254
|
self.test_id = test_id
|
250
255
|
self.some_int = some_int
|
@@ -295,10 +300,11 @@ module Schemas
|
|
295
300
|
attr_accessor :some_optional_int
|
296
301
|
|
297
302
|
# @override
|
298
|
-
def initialize(some_int: nil,
|
303
|
+
def initialize(_from_message: false, some_int: nil,
|
299
304
|
some_float: nil,
|
300
305
|
some_string: nil,
|
301
306
|
some_optional_int: nil)
|
307
|
+
@_from_message = _from_message
|
302
308
|
super
|
303
309
|
self.some_int = some_int
|
304
310
|
self.some_float = some_float
|
@@ -354,11 +360,12 @@ module Schemas
|
|
354
360
|
end
|
355
361
|
|
356
362
|
# @override
|
357
|
-
def initialize(test_id: nil,
|
363
|
+
def initialize(_from_message: false, test_id: nil,
|
358
364
|
test_float: nil,
|
359
365
|
test_array: nil,
|
360
366
|
some_nested_record: nil,
|
361
367
|
some_optional_record: nil)
|
368
|
+
@_from_message = _from_message
|
362
369
|
super
|
363
370
|
self.test_id = test_id
|
364
371
|
self.test_float = test_float
|
@@ -377,6 +384,13 @@ module Schemas
|
|
377
384
|
'com.my-namespace'
|
378
385
|
end
|
379
386
|
|
387
|
+
def self.tombstone(key)
|
388
|
+
record = self.allocate
|
389
|
+
record.tombstone_key = key
|
390
|
+
record.test_id = key
|
391
|
+
record
|
392
|
+
end
|
393
|
+
|
380
394
|
# @override
|
381
395
|
def as_json(_opts={})
|
382
396
|
{
|
@@ -407,8 +421,9 @@ module Schemas
|
|
407
421
|
attr_accessor :some_int
|
408
422
|
|
409
423
|
# @override
|
410
|
-
def initialize(test_id: nil,
|
424
|
+
def initialize(_from_message: false, test_id: nil,
|
411
425
|
some_int: nil)
|
426
|
+
@_from_message = _from_message
|
412
427
|
super
|
413
428
|
self.test_id = test_id
|
414
429
|
self.some_int = some_int
|
@@ -451,8 +466,9 @@ module Schemas
|
|
451
466
|
attr_accessor :part_two
|
452
467
|
|
453
468
|
# @override
|
454
|
-
def initialize(part_one: nil,
|
469
|
+
def initialize(_from_message: false, part_one: nil,
|
455
470
|
part_two: nil)
|
471
|
+
@_from_message = _from_message
|
456
472
|
super
|
457
473
|
self.part_one = part_one
|
458
474
|
self.part_two = part_two
|
@@ -493,7 +509,8 @@ module Schemas
|
|
493
509
|
attr_accessor :id
|
494
510
|
|
495
511
|
# @override
|
496
|
-
def initialize(id: nil)
|
512
|
+
def initialize(_from_message: false, id: nil)
|
513
|
+
@_from_message = _from_message
|
497
514
|
super
|
498
515
|
self.id = id
|
499
516
|
end
|
@@ -532,7 +549,8 @@ module Schemas
|
|
532
549
|
attr_accessor :test_id
|
533
550
|
|
534
551
|
# @override
|
535
|
-
def initialize(test_id: nil)
|
552
|
+
def initialize(_from_message: false, test_id: nil)
|
553
|
+
@_from_message = _from_message
|
536
554
|
super
|
537
555
|
self.test_id = test_id
|
538
556
|
end
|
@@ -573,8 +591,9 @@ module Schemas
|
|
573
591
|
attr_accessor :some_bool
|
574
592
|
|
575
593
|
# @override
|
576
|
-
def initialize(test_id: nil,
|
594
|
+
def initialize(_from_message: false, test_id: nil,
|
577
595
|
some_bool: nil)
|
596
|
+
@_from_message = _from_message
|
578
597
|
super
|
579
598
|
self.test_id = test_id
|
580
599
|
self.some_bool = some_bool
|
@@ -619,7 +638,8 @@ module Schemas
|
|
619
638
|
attr_accessor :property
|
620
639
|
|
621
640
|
# @override
|
622
|
-
def initialize(property: nil)
|
641
|
+
def initialize(_from_message: false, property: nil)
|
642
|
+
@_from_message = _from_message
|
623
643
|
super
|
624
644
|
self.property = property
|
625
645
|
end
|
@@ -656,7 +676,8 @@ module Schemas
|
|
656
676
|
end
|
657
677
|
|
658
678
|
# @override
|
659
|
-
def initialize(properties: {})
|
679
|
+
def initialize(_from_message: false, properties: {})
|
680
|
+
@_from_message = _from_message
|
660
681
|
super
|
661
682
|
self.properties = properties
|
662
683
|
end
|
@@ -671,13 +692,6 @@ module Schemas
|
|
671
692
|
'com.my-namespace'
|
672
693
|
end
|
673
694
|
|
674
|
-
def self.tombstone(key)
|
675
|
-
record = self.allocate
|
676
|
-
record.tombstone_key = key
|
677
|
-
record.a_string = key
|
678
|
-
record
|
679
|
-
end
|
680
|
-
|
681
695
|
# @override
|
682
696
|
def as_json(_opts={})
|
683
697
|
{
|
@@ -706,7 +720,8 @@ module Schemas
|
|
706
720
|
attr_accessor :a_record_field
|
707
721
|
|
708
722
|
# @override
|
709
|
-
def initialize(a_record_field: nil)
|
723
|
+
def initialize(_from_message: false, a_record_field: nil)
|
724
|
+
@_from_message = _from_message
|
710
725
|
super
|
711
726
|
self.a_record_field = a_record_field
|
712
727
|
end
|
@@ -836,7 +851,7 @@ module Schemas
|
|
836
851
|
end
|
837
852
|
|
838
853
|
# @override
|
839
|
-
def initialize(test_id: nil,
|
854
|
+
def initialize(_from_message: false, test_id: nil,
|
840
855
|
test_float: nil,
|
841
856
|
test_string_array: ["test"],
|
842
857
|
test_int_array: [123],
|
@@ -849,6 +864,7 @@ module Schemas
|
|
849
864
|
some_enum_array: nil,
|
850
865
|
some_optional_enum: nil,
|
851
866
|
some_enum_with_default: "sym6")
|
867
|
+
@_from_message = _from_message
|
852
868
|
super
|
853
869
|
self.test_id = test_id
|
854
870
|
self.test_float = test_float
|
@@ -919,11 +935,12 @@ module Schemas
|
|
919
935
|
attr_accessor :timestamp
|
920
936
|
|
921
937
|
# @override
|
922
|
-
def initialize(test_id: nil,
|
938
|
+
def initialize(_from_message: false, test_id: nil,
|
923
939
|
updated_at: nil,
|
924
940
|
some_int: nil,
|
925
941
|
some_datetime_int: nil,
|
926
942
|
timestamp: nil)
|
943
|
+
@_from_message = _from_message
|
927
944
|
super
|
928
945
|
self.test_id = test_id
|
929
946
|
self.updated_at = updated_at
|
@@ -976,10 +993,11 @@ module Schemas
|
|
976
993
|
attr_accessor :timestamp
|
977
994
|
|
978
995
|
# @override
|
979
|
-
def initialize(test_id: nil,
|
996
|
+
def initialize(_from_message: false, test_id: nil,
|
980
997
|
some_int: nil,
|
981
998
|
message_id: nil,
|
982
999
|
timestamp: nil)
|
1000
|
+
@_from_message = _from_message
|
983
1001
|
super
|
984
1002
|
self.test_id = test_id
|
985
1003
|
self.some_int = some_int
|
@@ -1028,9 +1046,10 @@ module Schemas
|
|
1028
1046
|
attr_accessor :title
|
1029
1047
|
|
1030
1048
|
# @override
|
1031
|
-
def initialize(test_id: nil,
|
1049
|
+
def initialize(_from_message: false, test_id: nil,
|
1032
1050
|
some_int: nil,
|
1033
1051
|
title: nil)
|
1052
|
+
@_from_message = _from_message
|
1034
1053
|
super
|
1035
1054
|
self.test_id = test_id
|
1036
1055
|
self.some_int = some_int
|
@@ -1079,8 +1098,9 @@ module Schemas
|
|
1079
1098
|
attr_accessor :record1_id
|
1080
1099
|
|
1081
1100
|
# @override
|
1082
|
-
def initialize(record1_map: {},
|
1101
|
+
def initialize(_from_message: false, record1_map: {},
|
1083
1102
|
record1_id: 0)
|
1103
|
+
@_from_message = _from_message
|
1084
1104
|
super
|
1085
1105
|
self.record1_map = record1_map
|
1086
1106
|
self.record1_id = record1_id
|
@@ -1113,7 +1133,8 @@ module Schemas
|
|
1113
1133
|
attr_accessor :record2_id
|
1114
1134
|
|
1115
1135
|
# @override
|
1116
|
-
def initialize(record2_id: "")
|
1136
|
+
def initialize(_from_message: false, record2_id: "")
|
1137
|
+
@_from_message = _from_message
|
1117
1138
|
super
|
1118
1139
|
self.record2_id = record2_id
|
1119
1140
|
end
|
@@ -1144,7 +1165,8 @@ module Schemas
|
|
1144
1165
|
attr_accessor :record3_id
|
1145
1166
|
|
1146
1167
|
# @override
|
1147
|
-
def initialize(record3_id: 0.0)
|
1168
|
+
def initialize(_from_message: false, record3_id: 0.0)
|
1169
|
+
@_from_message = _from_message
|
1148
1170
|
super
|
1149
1171
|
self.record3_id = record3_id
|
1150
1172
|
end
|
@@ -1175,7 +1197,8 @@ module Schemas
|
|
1175
1197
|
attr_accessor :record4_id
|
1176
1198
|
|
1177
1199
|
# @override
|
1178
|
-
def initialize(record4_id: 0)
|
1200
|
+
def initialize(_from_message: false, record4_id: 0)
|
1201
|
+
@_from_message = _from_message
|
1179
1202
|
super
|
1180
1203
|
self.record4_id = record4_id
|
1181
1204
|
end
|
@@ -1231,9 +1254,10 @@ module Schemas
|
|
1231
1254
|
end
|
1232
1255
|
|
1233
1256
|
# @override
|
1234
|
-
def initialize(test_id: "",
|
1257
|
+
def initialize(_from_message: false, test_id: "",
|
1235
1258
|
test_long: nil,
|
1236
1259
|
test_union_type: nil)
|
1260
|
+
@_from_message = _from_message
|
1237
1261
|
super
|
1238
1262
|
self.test_id = test_id
|
1239
1263
|
self.test_long = test_long
|
@@ -1284,11 +1308,12 @@ module Schemas
|
|
1284
1308
|
attr_accessor :timestamp
|
1285
1309
|
|
1286
1310
|
# @override
|
1287
|
-
def initialize(id: nil,
|
1311
|
+
def initialize(_from_message: false, id: nil,
|
1288
1312
|
test_id: nil,
|
1289
1313
|
some_int: nil,
|
1290
1314
|
message_id: nil,
|
1291
1315
|
timestamp: nil)
|
1316
|
+
@_from_message = _from_message
|
1292
1317
|
super
|
1293
1318
|
self.id = id
|
1294
1319
|
self.test_id = test_id
|
@@ -1335,7 +1360,8 @@ module Schemas
|
|
1335
1360
|
attr_accessor :update_request_id
|
1336
1361
|
|
1337
1362
|
# @override
|
1338
|
-
def initialize(update_request_id: nil)
|
1363
|
+
def initialize(_from_message: false, update_request_id: nil)
|
1364
|
+
@_from_message = _from_message
|
1339
1365
|
super
|
1340
1366
|
self.update_request_id = update_request_id
|
1341
1367
|
end
|
@@ -1374,7 +1400,8 @@ module Schemas
|
|
1374
1400
|
attr_accessor :update_response_id
|
1375
1401
|
|
1376
1402
|
# @override
|
1377
|
-
def initialize(update_response_id: nil)
|
1403
|
+
def initialize(_from_message: false, update_response_id: nil)
|
1404
|
+
@_from_message = _from_message
|
1378
1405
|
super
|
1379
1406
|
self.update_response_id = update_response_id
|
1380
1407
|
end
|
@@ -1429,7 +1456,7 @@ module Schemas
|
|
1429
1456
|
attr_accessor :created_at
|
1430
1457
|
|
1431
1458
|
# @override
|
1432
|
-
def initialize(id: nil,
|
1459
|
+
def initialize(_from_message: false, id: nil,
|
1433
1460
|
wibble_id: nil,
|
1434
1461
|
name: nil,
|
1435
1462
|
floop: nil,
|
@@ -1438,6 +1465,7 @@ module Schemas
|
|
1438
1465
|
birthday_optional: nil,
|
1439
1466
|
updated_at: nil,
|
1440
1467
|
created_at: nil)
|
1468
|
+
@_from_message = _from_message
|
1441
1469
|
super
|
1442
1470
|
self.id = id
|
1443
1471
|
self.wibble_id = wibble_id
|
@@ -1500,11 +1528,12 @@ module Schemas
|
|
1500
1528
|
attr_accessor :created_at
|
1501
1529
|
|
1502
1530
|
# @override
|
1503
|
-
def initialize(id: nil,
|
1531
|
+
def initialize(_from_message: false, id: nil,
|
1504
1532
|
widget_id: nil,
|
1505
1533
|
name: nil,
|
1506
1534
|
updated_at: nil,
|
1507
1535
|
created_at: nil)
|
1536
|
+
@_from_message = _from_message
|
1508
1537
|
super
|
1509
1538
|
self.id = id
|
1510
1539
|
self.widget_id = widget_id
|
@@ -1559,11 +1588,12 @@ module Schemas
|
|
1559
1588
|
attr_accessor :created_at
|
1560
1589
|
|
1561
1590
|
# @override
|
1562
|
-
def initialize(id: nil,
|
1591
|
+
def initialize(_from_message: false, id: nil,
|
1563
1592
|
widget_id: nil,
|
1564
1593
|
model_id: nil,
|
1565
1594
|
updated_at: nil,
|
1566
1595
|
created_at: nil)
|
1596
|
+
@_from_message = _from_message
|
1567
1597
|
super
|
1568
1598
|
self.id = id
|
1569
1599
|
self.widget_id = widget_id
|