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 :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
|
@@ -89,7 +90,8 @@ module Schemas
|
|
89
90
|
attr_accessor :response_id
|
90
91
|
|
91
92
|
# @override
|
92
|
-
def initialize(response_id: nil)
|
93
|
+
def initialize(_from_message: false, response_id: nil)
|
94
|
+
@_from_message = _from_message
|
93
95
|
super
|
94
96
|
self.response_id = response_id
|
95
97
|
end
|
@@ -163,7 +165,7 @@ module Schemas
|
|
163
165
|
end
|
164
166
|
|
165
167
|
# @override
|
166
|
-
def initialize(a_string: nil,
|
168
|
+
def initialize(_from_message: false, a_string: nil,
|
167
169
|
a_int: nil,
|
168
170
|
a_long: nil,
|
169
171
|
a_float: nil,
|
@@ -175,6 +177,7 @@ module Schemas
|
|
175
177
|
timestamp: nil,
|
176
178
|
message_id: nil,
|
177
179
|
a_record: nil)
|
180
|
+
@_from_message = _from_message
|
178
181
|
super
|
179
182
|
self.a_string = a_string
|
180
183
|
self.a_int = a_int
|
@@ -235,7 +238,8 @@ module Schemas
|
|
235
238
|
attr_accessor :response_id
|
236
239
|
|
237
240
|
# @override
|
238
|
-
def initialize(response_id: nil)
|
241
|
+
def initialize(_from_message: false, response_id: nil)
|
242
|
+
@_from_message = _from_message
|
239
243
|
super
|
240
244
|
self.response_id = response_id
|
241
245
|
end
|
@@ -276,8 +280,9 @@ module Schemas
|
|
276
280
|
attr_accessor :some_int
|
277
281
|
|
278
282
|
# @override
|
279
|
-
def initialize(test_id: nil,
|
283
|
+
def initialize(_from_message: false, test_id: nil,
|
280
284
|
some_int: nil)
|
285
|
+
@_from_message = _from_message
|
281
286
|
super
|
282
287
|
self.test_id = test_id
|
283
288
|
self.some_int = some_int
|
@@ -324,10 +329,11 @@ module Schemas
|
|
324
329
|
attr_accessor :some_optional_int
|
325
330
|
|
326
331
|
# @override
|
327
|
-
def initialize(some_int: nil,
|
332
|
+
def initialize(_from_message: false, some_int: nil,
|
328
333
|
some_float: nil,
|
329
334
|
some_string: nil,
|
330
335
|
some_optional_int: nil)
|
336
|
+
@_from_message = _from_message
|
331
337
|
super
|
332
338
|
self.some_int = some_int
|
333
339
|
self.some_float = some_float
|
@@ -393,11 +399,12 @@ module Schemas
|
|
393
399
|
end
|
394
400
|
|
395
401
|
# @override
|
396
|
-
def initialize(test_id: nil,
|
402
|
+
def initialize(_from_message: false, test_id: nil,
|
397
403
|
test_float: nil,
|
398
404
|
test_array: nil,
|
399
405
|
some_nested_record: nil,
|
400
406
|
some_optional_record: nil)
|
407
|
+
@_from_message = _from_message
|
401
408
|
super
|
402
409
|
self.test_id = test_id
|
403
410
|
self.test_float = test_float
|
@@ -416,6 +423,13 @@ module Schemas
|
|
416
423
|
'com.my-namespace'
|
417
424
|
end
|
418
425
|
|
426
|
+
def self.tombstone(key)
|
427
|
+
record = self.allocate
|
428
|
+
record.tombstone_key = key
|
429
|
+
record.test_id = key
|
430
|
+
record
|
431
|
+
end
|
432
|
+
|
419
433
|
# @override
|
420
434
|
def as_json(_opts={})
|
421
435
|
{
|
@@ -439,30 +453,19 @@ module Schemas
|
|
439
453
|
# Autogenerated Schema for Record at com.my-namespace.MySchema
|
440
454
|
class MySchema < Deimos::SchemaClass::Record
|
441
455
|
|
442
|
-
### Attribute Readers ###
|
443
|
-
# @return [MySchemaKey]
|
444
|
-
attr_reader :payload_key
|
445
|
-
|
446
456
|
### Attribute Accessors ###
|
447
457
|
# @return [String]
|
448
458
|
attr_accessor :test_id
|
449
459
|
# @return [Integer]
|
450
460
|
attr_accessor :some_int
|
451
461
|
|
452
|
-
### Attribute Writers ###
|
453
|
-
# @return [MySchemaKey]
|
454
|
-
def payload_key=(value)
|
455
|
-
@payload_key = MySchemaKey.initialize_from_value(value, from_message: self._from_message)
|
456
|
-
end
|
457
|
-
|
458
462
|
# @override
|
459
|
-
def initialize(test_id: nil,
|
460
|
-
some_int: nil
|
461
|
-
|
463
|
+
def initialize(_from_message: false, test_id: nil,
|
464
|
+
some_int: nil)
|
465
|
+
@_from_message = _from_message
|
462
466
|
super
|
463
467
|
self.test_id = test_id
|
464
468
|
self.some_int = some_int
|
465
|
-
self.payload_key = payload_key
|
466
469
|
end
|
467
470
|
|
468
471
|
# @override
|
@@ -475,19 +478,11 @@ module Schemas
|
|
475
478
|
'com.my-namespace'
|
476
479
|
end
|
477
480
|
|
478
|
-
def self.tombstone(key)
|
479
|
-
record = self.allocate
|
480
|
-
record.tombstone_key = MySchemaKey.initialize_from_value(key, from_message: self._from_message)
|
481
|
-
record.payload_key = key
|
482
|
-
record
|
483
|
-
end
|
484
|
-
|
485
481
|
# @override
|
486
482
|
def as_json(_opts={})
|
487
483
|
{
|
488
484
|
'test_id' => @test_id,
|
489
|
-
'some_int' => @some_int
|
490
|
-
'payload_key' => @payload_key&.as_json
|
485
|
+
'some_int' => @some_int
|
491
486
|
}
|
492
487
|
end
|
493
488
|
end
|
@@ -510,8 +505,9 @@ module Schemas
|
|
510
505
|
attr_accessor :part_two
|
511
506
|
|
512
507
|
# @override
|
513
|
-
def initialize(part_one: nil,
|
508
|
+
def initialize(_from_message: false, part_one: nil,
|
514
509
|
part_two: nil)
|
510
|
+
@_from_message = _from_message
|
515
511
|
super
|
516
512
|
self.part_one = part_one
|
517
513
|
self.part_two = part_two
|
@@ -552,7 +548,8 @@ module Schemas
|
|
552
548
|
attr_accessor :id
|
553
549
|
|
554
550
|
# @override
|
555
|
-
def initialize(id: nil)
|
551
|
+
def initialize(_from_message: false, id: nil)
|
552
|
+
@_from_message = _from_message
|
556
553
|
super
|
557
554
|
self.id = id
|
558
555
|
end
|
@@ -591,7 +588,8 @@ module Schemas
|
|
591
588
|
attr_accessor :test_id
|
592
589
|
|
593
590
|
# @override
|
594
|
-
def initialize(test_id: nil)
|
591
|
+
def initialize(_from_message: false, test_id: nil)
|
592
|
+
@_from_message = _from_message
|
595
593
|
super
|
596
594
|
self.test_id = test_id
|
597
595
|
end
|
@@ -632,8 +630,9 @@ module Schemas
|
|
632
630
|
attr_accessor :some_bool
|
633
631
|
|
634
632
|
# @override
|
635
|
-
def initialize(test_id: nil,
|
633
|
+
def initialize(_from_message: false, test_id: nil,
|
636
634
|
some_bool: nil)
|
635
|
+
@_from_message = _from_message
|
637
636
|
super
|
638
637
|
self.test_id = test_id
|
639
638
|
self.some_bool = some_bool
|
@@ -682,7 +681,8 @@ module Schemas
|
|
682
681
|
end
|
683
682
|
|
684
683
|
# @override
|
685
|
-
def initialize(properties: {})
|
684
|
+
def initialize(_from_message: false, properties: {})
|
685
|
+
@_from_message = _from_message
|
686
686
|
super
|
687
687
|
self.properties = properties
|
688
688
|
end
|
@@ -789,7 +789,7 @@ module Schemas
|
|
789
789
|
end
|
790
790
|
|
791
791
|
# @override
|
792
|
-
def initialize(test_id: nil,
|
792
|
+
def initialize(_from_message: false, test_id: nil,
|
793
793
|
test_float: nil,
|
794
794
|
test_string_array: ["test"],
|
795
795
|
test_int_array: [123],
|
@@ -802,6 +802,7 @@ module Schemas
|
|
802
802
|
some_enum_array: nil,
|
803
803
|
some_optional_enum: nil,
|
804
804
|
some_enum_with_default: "sym6")
|
805
|
+
@_from_message = _from_message
|
805
806
|
super
|
806
807
|
self.test_id = test_id
|
807
808
|
self.test_float = test_float
|
@@ -872,11 +873,12 @@ module Schemas
|
|
872
873
|
attr_accessor :timestamp
|
873
874
|
|
874
875
|
# @override
|
875
|
-
def initialize(test_id: nil,
|
876
|
+
def initialize(_from_message: false, test_id: nil,
|
876
877
|
updated_at: nil,
|
877
878
|
some_int: nil,
|
878
879
|
some_datetime_int: nil,
|
879
880
|
timestamp: nil)
|
881
|
+
@_from_message = _from_message
|
880
882
|
super
|
881
883
|
self.test_id = test_id
|
882
884
|
self.updated_at = updated_at
|
@@ -929,10 +931,11 @@ module Schemas
|
|
929
931
|
attr_accessor :timestamp
|
930
932
|
|
931
933
|
# @override
|
932
|
-
def initialize(test_id: nil,
|
934
|
+
def initialize(_from_message: false, test_id: nil,
|
933
935
|
some_int: nil,
|
934
936
|
message_id: nil,
|
935
937
|
timestamp: nil)
|
938
|
+
@_from_message = _from_message
|
936
939
|
super
|
937
940
|
self.test_id = test_id
|
938
941
|
self.some_int = some_int
|
@@ -981,9 +984,10 @@ module Schemas
|
|
981
984
|
attr_accessor :title
|
982
985
|
|
983
986
|
# @override
|
984
|
-
def initialize(test_id: nil,
|
987
|
+
def initialize(_from_message: false, test_id: nil,
|
985
988
|
some_int: nil,
|
986
989
|
title: nil)
|
990
|
+
@_from_message = _from_message
|
987
991
|
super
|
988
992
|
self.test_id = test_id
|
989
993
|
self.some_int = some_int
|
@@ -1053,9 +1057,10 @@ module Schemas
|
|
1053
1057
|
end
|
1054
1058
|
|
1055
1059
|
# @override
|
1056
|
-
def initialize(test_id: "",
|
1060
|
+
def initialize(_from_message: false, test_id: "",
|
1057
1061
|
test_long: nil,
|
1058
1062
|
test_union_type: nil)
|
1063
|
+
@_from_message = _from_message
|
1059
1064
|
super
|
1060
1065
|
self.test_id = test_id
|
1061
1066
|
self.test_long = test_long
|
@@ -1106,11 +1111,12 @@ module Schemas
|
|
1106
1111
|
attr_accessor :timestamp
|
1107
1112
|
|
1108
1113
|
# @override
|
1109
|
-
def initialize(id: nil,
|
1114
|
+
def initialize(_from_message: false, id: nil,
|
1110
1115
|
test_id: nil,
|
1111
1116
|
some_int: nil,
|
1112
1117
|
message_id: nil,
|
1113
1118
|
timestamp: nil)
|
1119
|
+
@_from_message = _from_message
|
1114
1120
|
super
|
1115
1121
|
self.id = id
|
1116
1122
|
self.test_id = test_id
|
@@ -1157,7 +1163,8 @@ module Schemas
|
|
1157
1163
|
attr_accessor :property
|
1158
1164
|
|
1159
1165
|
# @override
|
1160
|
-
def initialize(property: nil)
|
1166
|
+
def initialize(_from_message: false, property: nil)
|
1167
|
+
@_from_message = _from_message
|
1161
1168
|
super
|
1162
1169
|
self.property = property
|
1163
1170
|
end
|
@@ -1198,8 +1205,9 @@ module Schemas
|
|
1198
1205
|
attr_accessor :record1_id
|
1199
1206
|
|
1200
1207
|
# @override
|
1201
|
-
def initialize(record1_map: {},
|
1208
|
+
def initialize(_from_message: false, record1_map: {},
|
1202
1209
|
record1_id: 0)
|
1210
|
+
@_from_message = _from_message
|
1203
1211
|
super
|
1204
1212
|
self.record1_map = record1_map
|
1205
1213
|
self.record1_id = record1_id
|
@@ -1240,7 +1248,8 @@ module Schemas
|
|
1240
1248
|
attr_accessor :record2_id
|
1241
1249
|
|
1242
1250
|
# @override
|
1243
|
-
def initialize(record2_id: "")
|
1251
|
+
def initialize(_from_message: false, record2_id: "")
|
1252
|
+
@_from_message = _from_message
|
1244
1253
|
super
|
1245
1254
|
self.record2_id = record2_id
|
1246
1255
|
end
|
@@ -1279,7 +1288,8 @@ module Schemas
|
|
1279
1288
|
attr_accessor :record3_id
|
1280
1289
|
|
1281
1290
|
# @override
|
1282
|
-
def initialize(record3_id: 0.0)
|
1291
|
+
def initialize(_from_message: false, record3_id: 0.0)
|
1292
|
+
@_from_message = _from_message
|
1283
1293
|
super
|
1284
1294
|
self.record3_id = record3_id
|
1285
1295
|
end
|
@@ -1318,7 +1328,8 @@ module Schemas
|
|
1318
1328
|
attr_accessor :record4_id
|
1319
1329
|
|
1320
1330
|
# @override
|
1321
|
-
def initialize(record4_id: 0)
|
1331
|
+
def initialize(_from_message: false, record4_id: 0)
|
1332
|
+
@_from_message = _from_message
|
1322
1333
|
super
|
1323
1334
|
self.record4_id = record4_id
|
1324
1335
|
end
|
@@ -1357,7 +1368,8 @@ module Schemas
|
|
1357
1368
|
attr_accessor :update_request_id
|
1358
1369
|
|
1359
1370
|
# @override
|
1360
|
-
def initialize(update_request_id: nil)
|
1371
|
+
def initialize(_from_message: false, update_request_id: nil)
|
1372
|
+
@_from_message = _from_message
|
1361
1373
|
super
|
1362
1374
|
self.update_request_id = update_request_id
|
1363
1375
|
end
|
@@ -1396,7 +1408,8 @@ module Schemas
|
|
1396
1408
|
attr_accessor :update_response_id
|
1397
1409
|
|
1398
1410
|
# @override
|
1399
|
-
def initialize(update_response_id: nil)
|
1411
|
+
def initialize(_from_message: false, update_response_id: nil)
|
1412
|
+
@_from_message = _from_message
|
1400
1413
|
super
|
1401
1414
|
self.update_response_id = update_response_id
|
1402
1415
|
end
|
@@ -1451,7 +1464,7 @@ module Schemas
|
|
1451
1464
|
attr_accessor :created_at
|
1452
1465
|
|
1453
1466
|
# @override
|
1454
|
-
def initialize(id: nil,
|
1467
|
+
def initialize(_from_message: false, id: nil,
|
1455
1468
|
wibble_id: nil,
|
1456
1469
|
name: nil,
|
1457
1470
|
floop: nil,
|
@@ -1460,6 +1473,7 @@ module Schemas
|
|
1460
1473
|
birthday_optional: nil,
|
1461
1474
|
updated_at: nil,
|
1462
1475
|
created_at: nil)
|
1476
|
+
@_from_message = _from_message
|
1463
1477
|
super
|
1464
1478
|
self.id = id
|
1465
1479
|
self.wibble_id = wibble_id
|
@@ -1522,11 +1536,12 @@ module Schemas
|
|
1522
1536
|
attr_accessor :created_at
|
1523
1537
|
|
1524
1538
|
# @override
|
1525
|
-
def initialize(id: nil,
|
1539
|
+
def initialize(_from_message: false, id: nil,
|
1526
1540
|
widget_id: nil,
|
1527
1541
|
name: nil,
|
1528
1542
|
updated_at: nil,
|
1529
1543
|
created_at: nil)
|
1544
|
+
@_from_message = _from_message
|
1530
1545
|
super
|
1531
1546
|
self.id = id
|
1532
1547
|
self.widget_id = widget_id
|
@@ -1581,11 +1596,12 @@ module Schemas
|
|
1581
1596
|
attr_accessor :created_at
|
1582
1597
|
|
1583
1598
|
# @override
|
1584
|
-
def initialize(id: nil,
|
1599
|
+
def initialize(_from_message: false, id: nil,
|
1585
1600
|
widget_id: nil,
|
1586
1601
|
model_id: nil,
|
1587
1602
|
updated_at: nil,
|
1588
1603
|
created_at: nil)
|
1604
|
+
@_from_message = _from_message
|
1589
1605
|
super
|
1590
1606
|
self.id = id
|
1591
1607
|
self.widget_id = widget_id
|