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
@@ -16,7 +16,8 @@ module Schemas; module MyNamespace
|
|
16
16
|
attr_accessor :a_record_field
|
17
17
|
|
18
18
|
# @override
|
19
|
-
def initialize(a_record_field: nil)
|
19
|
+
def initialize(_from_message: false, a_record_field: nil)
|
20
|
+
@_from_message = _from_message
|
20
21
|
super
|
21
22
|
self.a_record_field = a_record_field
|
22
23
|
end
|
@@ -91,7 +92,7 @@ module Schemas; module MyNamespace
|
|
91
92
|
end
|
92
93
|
|
93
94
|
# @override
|
94
|
-
def initialize(a_string: nil,
|
95
|
+
def initialize(_from_message: false, a_string: nil,
|
95
96
|
a_int: nil,
|
96
97
|
a_long: nil,
|
97
98
|
a_float: nil,
|
@@ -103,6 +104,7 @@ module Schemas; module MyNamespace
|
|
103
104
|
timestamp: nil,
|
104
105
|
message_id: nil,
|
105
106
|
a_record: nil)
|
107
|
+
@_from_message = _from_message
|
106
108
|
super
|
107
109
|
self.a_string = a_string
|
108
110
|
self.a_int = a_int
|
@@ -128,13 +130,6 @@ module Schemas; module MyNamespace
|
|
128
130
|
'com.my-namespace'
|
129
131
|
end
|
130
132
|
|
131
|
-
def self.tombstone(key)
|
132
|
-
record = self.allocate
|
133
|
-
record.tombstone_key = key
|
134
|
-
record.a_string = key
|
135
|
-
record
|
136
|
-
end
|
137
|
-
|
138
133
|
# @override
|
139
134
|
def as_json(_opts={})
|
140
135
|
{
|
@@ -172,8 +167,9 @@ module Schemas; module MyNamespace
|
|
172
167
|
attr_accessor :some_int
|
173
168
|
|
174
169
|
# @override
|
175
|
-
def initialize(test_id: nil,
|
170
|
+
def initialize(_from_message: false, test_id: nil,
|
176
171
|
some_int: nil)
|
172
|
+
@_from_message = _from_message
|
177
173
|
super
|
178
174
|
self.test_id = test_id
|
179
175
|
self.some_int = some_int
|
@@ -224,10 +220,11 @@ module Schemas; module MyNamespace
|
|
224
220
|
attr_accessor :some_optional_int
|
225
221
|
|
226
222
|
# @override
|
227
|
-
def initialize(some_int: nil,
|
223
|
+
def initialize(_from_message: false, some_int: nil,
|
228
224
|
some_float: nil,
|
229
225
|
some_string: nil,
|
230
226
|
some_optional_int: nil)
|
227
|
+
@_from_message = _from_message
|
231
228
|
super
|
232
229
|
self.some_int = some_int
|
233
230
|
self.some_float = some_float
|
@@ -283,11 +280,12 @@ module Schemas; module MyNamespace
|
|
283
280
|
end
|
284
281
|
|
285
282
|
# @override
|
286
|
-
def initialize(test_id: nil,
|
283
|
+
def initialize(_from_message: false, test_id: nil,
|
287
284
|
test_float: nil,
|
288
285
|
test_array: nil,
|
289
286
|
some_nested_record: nil,
|
290
287
|
some_optional_record: nil)
|
288
|
+
@_from_message = _from_message
|
291
289
|
super
|
292
290
|
self.test_id = test_id
|
293
291
|
self.test_float = test_float
|
@@ -336,30 +334,19 @@ module Schemas; module MyNamespace
|
|
336
334
|
# Autogenerated Schema for Record at com.my-namespace.MySchema
|
337
335
|
class MySchema < Deimos::SchemaClass::Record
|
338
336
|
|
339
|
-
### Attribute Readers ###
|
340
|
-
# @return [MySchemaKey]
|
341
|
-
attr_reader :payload_key
|
342
|
-
|
343
337
|
### Attribute Accessors ###
|
344
338
|
# @return [String]
|
345
339
|
attr_accessor :test_id
|
346
340
|
# @return [Integer]
|
347
341
|
attr_accessor :some_int
|
348
342
|
|
349
|
-
### Attribute Writers ###
|
350
|
-
# @return [MySchemaKey]
|
351
|
-
def payload_key=(value)
|
352
|
-
@payload_key = MySchemaKey.initialize_from_value(value, from_message: self._from_message)
|
353
|
-
end
|
354
|
-
|
355
343
|
# @override
|
356
|
-
def initialize(test_id: nil,
|
357
|
-
some_int: nil
|
358
|
-
|
344
|
+
def initialize(_from_message: false, test_id: nil,
|
345
|
+
some_int: nil)
|
346
|
+
@_from_message = _from_message
|
359
347
|
super
|
360
348
|
self.test_id = test_id
|
361
349
|
self.some_int = some_int
|
362
|
-
self.payload_key = payload_key
|
363
350
|
end
|
364
351
|
|
365
352
|
# @override
|
@@ -372,19 +359,11 @@ module Schemas; module MyNamespace
|
|
372
359
|
'com.my-namespace'
|
373
360
|
end
|
374
361
|
|
375
|
-
def self.tombstone(key)
|
376
|
-
record = self.allocate
|
377
|
-
record.tombstone_key = MySchemaKey.initialize_from_value(key, from_message: self._from_message)
|
378
|
-
record.payload_key = key
|
379
|
-
record
|
380
|
-
end
|
381
|
-
|
382
362
|
# @override
|
383
363
|
def as_json(_opts={})
|
384
364
|
{
|
385
365
|
'test_id' => @test_id,
|
386
|
-
'some_int' => @some_int
|
387
|
-
'payload_key' => @payload_key&.as_json
|
366
|
+
'some_int' => @some_int
|
388
367
|
}
|
389
368
|
end
|
390
369
|
end
|
@@ -407,8 +386,9 @@ module Schemas; module MyNamespace
|
|
407
386
|
attr_accessor :part_two
|
408
387
|
|
409
388
|
# @override
|
410
|
-
def initialize(part_one: nil,
|
389
|
+
def initialize(_from_message: false, part_one: nil,
|
411
390
|
part_two: nil)
|
391
|
+
@_from_message = _from_message
|
412
392
|
super
|
413
393
|
self.part_one = part_one
|
414
394
|
self.part_two = part_two
|
@@ -449,7 +429,8 @@ module Schemas; module MyNamespace
|
|
449
429
|
attr_accessor :id
|
450
430
|
|
451
431
|
# @override
|
452
|
-
def initialize(id: nil)
|
432
|
+
def initialize(_from_message: false, id: nil)
|
433
|
+
@_from_message = _from_message
|
453
434
|
super
|
454
435
|
self.id = id
|
455
436
|
end
|
@@ -488,7 +469,8 @@ module Schemas; module MyNamespace
|
|
488
469
|
attr_accessor :test_id
|
489
470
|
|
490
471
|
# @override
|
491
|
-
def initialize(test_id: nil)
|
472
|
+
def initialize(_from_message: false, test_id: nil)
|
473
|
+
@_from_message = _from_message
|
492
474
|
super
|
493
475
|
self.test_id = test_id
|
494
476
|
end
|
@@ -529,8 +511,9 @@ module Schemas; module MyNamespace
|
|
529
511
|
attr_accessor :some_bool
|
530
512
|
|
531
513
|
# @override
|
532
|
-
def initialize(test_id: nil,
|
514
|
+
def initialize(_from_message: false, test_id: nil,
|
533
515
|
some_bool: nil)
|
516
|
+
@_from_message = _from_message
|
534
517
|
super
|
535
518
|
self.test_id = test_id
|
536
519
|
self.some_bool = some_bool
|
@@ -575,7 +558,8 @@ module Schemas; module MyNamespace
|
|
575
558
|
attr_accessor :property
|
576
559
|
|
577
560
|
# @override
|
578
|
-
def initialize(property: nil)
|
561
|
+
def initialize(_from_message: false, property: nil)
|
562
|
+
@_from_message = _from_message
|
579
563
|
super
|
580
564
|
self.property = property
|
581
565
|
end
|
@@ -612,7 +596,8 @@ module Schemas; module MyNamespace
|
|
612
596
|
end
|
613
597
|
|
614
598
|
# @override
|
615
|
-
def initialize(properties: {})
|
599
|
+
def initialize(_from_message: false, properties: {})
|
600
|
+
@_from_message = _from_message
|
616
601
|
super
|
617
602
|
self.properties = properties
|
618
603
|
end
|
@@ -655,7 +640,8 @@ module Schemas; module MyNamespace
|
|
655
640
|
attr_accessor :a_record_field
|
656
641
|
|
657
642
|
# @override
|
658
|
-
def initialize(a_record_field: nil)
|
643
|
+
def initialize(_from_message: false, a_record_field: nil)
|
644
|
+
@_from_message = _from_message
|
659
645
|
super
|
660
646
|
self.a_record_field = a_record_field
|
661
647
|
end
|
@@ -785,7 +771,7 @@ module Schemas; module MyNamespace
|
|
785
771
|
end
|
786
772
|
|
787
773
|
# @override
|
788
|
-
def initialize(test_id: nil,
|
774
|
+
def initialize(_from_message: false, test_id: nil,
|
789
775
|
test_float: nil,
|
790
776
|
test_string_array: ["test"],
|
791
777
|
test_int_array: [123],
|
@@ -798,6 +784,7 @@ module Schemas; module MyNamespace
|
|
798
784
|
some_enum_array: nil,
|
799
785
|
some_optional_enum: nil,
|
800
786
|
some_enum_with_default: "sym6")
|
787
|
+
@_from_message = _from_message
|
801
788
|
super
|
802
789
|
self.test_id = test_id
|
803
790
|
self.test_float = test_float
|
@@ -868,11 +855,12 @@ module Schemas; module MyNamespace
|
|
868
855
|
attr_accessor :timestamp
|
869
856
|
|
870
857
|
# @override
|
871
|
-
def initialize(test_id: nil,
|
858
|
+
def initialize(_from_message: false, test_id: nil,
|
872
859
|
updated_at: nil,
|
873
860
|
some_int: nil,
|
874
861
|
some_datetime_int: nil,
|
875
862
|
timestamp: nil)
|
863
|
+
@_from_message = _from_message
|
876
864
|
super
|
877
865
|
self.test_id = test_id
|
878
866
|
self.updated_at = updated_at
|
@@ -925,10 +913,11 @@ module Schemas; module MyNamespace
|
|
925
913
|
attr_accessor :timestamp
|
926
914
|
|
927
915
|
# @override
|
928
|
-
def initialize(test_id: nil,
|
916
|
+
def initialize(_from_message: false, test_id: nil,
|
929
917
|
some_int: nil,
|
930
918
|
message_id: nil,
|
931
919
|
timestamp: nil)
|
920
|
+
@_from_message = _from_message
|
932
921
|
super
|
933
922
|
self.test_id = test_id
|
934
923
|
self.some_int = some_int
|
@@ -977,9 +966,10 @@ module Schemas; module MyNamespace
|
|
977
966
|
attr_accessor :title
|
978
967
|
|
979
968
|
# @override
|
980
|
-
def initialize(test_id: nil,
|
969
|
+
def initialize(_from_message: false, test_id: nil,
|
981
970
|
some_int: nil,
|
982
971
|
title: nil)
|
972
|
+
@_from_message = _from_message
|
983
973
|
super
|
984
974
|
self.test_id = test_id
|
985
975
|
self.some_int = some_int
|
@@ -1028,8 +1018,9 @@ module Schemas; module MyNamespace
|
|
1028
1018
|
attr_accessor :record1_id
|
1029
1019
|
|
1030
1020
|
# @override
|
1031
|
-
def initialize(record1_map: {},
|
1021
|
+
def initialize(_from_message: false, record1_map: {},
|
1032
1022
|
record1_id: 0)
|
1023
|
+
@_from_message = _from_message
|
1033
1024
|
super
|
1034
1025
|
self.record1_map = record1_map
|
1035
1026
|
self.record1_id = record1_id
|
@@ -1062,7 +1053,8 @@ module Schemas; module MyNamespace
|
|
1062
1053
|
attr_accessor :record2_id
|
1063
1054
|
|
1064
1055
|
# @override
|
1065
|
-
def initialize(record2_id: "")
|
1056
|
+
def initialize(_from_message: false, record2_id: "")
|
1057
|
+
@_from_message = _from_message
|
1066
1058
|
super
|
1067
1059
|
self.record2_id = record2_id
|
1068
1060
|
end
|
@@ -1093,7 +1085,8 @@ module Schemas; module MyNamespace
|
|
1093
1085
|
attr_accessor :record3_id
|
1094
1086
|
|
1095
1087
|
# @override
|
1096
|
-
def initialize(record3_id: 0.0)
|
1088
|
+
def initialize(_from_message: false, record3_id: 0.0)
|
1089
|
+
@_from_message = _from_message
|
1097
1090
|
super
|
1098
1091
|
self.record3_id = record3_id
|
1099
1092
|
end
|
@@ -1124,7 +1117,8 @@ module Schemas; module MyNamespace
|
|
1124
1117
|
attr_accessor :record4_id
|
1125
1118
|
|
1126
1119
|
# @override
|
1127
|
-
def initialize(record4_id: 0)
|
1120
|
+
def initialize(_from_message: false, record4_id: 0)
|
1121
|
+
@_from_message = _from_message
|
1128
1122
|
super
|
1129
1123
|
self.record4_id = record4_id
|
1130
1124
|
end
|
@@ -1180,9 +1174,10 @@ module Schemas; module MyNamespace
|
|
1180
1174
|
end
|
1181
1175
|
|
1182
1176
|
# @override
|
1183
|
-
def initialize(test_id: "",
|
1177
|
+
def initialize(_from_message: false, test_id: "",
|
1184
1178
|
test_long: nil,
|
1185
1179
|
test_union_type: nil)
|
1180
|
+
@_from_message = _from_message
|
1186
1181
|
super
|
1187
1182
|
self.test_id = test_id
|
1188
1183
|
self.test_long = test_long
|
@@ -1233,11 +1228,12 @@ module Schemas; module MyNamespace
|
|
1233
1228
|
attr_accessor :timestamp
|
1234
1229
|
|
1235
1230
|
# @override
|
1236
|
-
def initialize(id: nil,
|
1231
|
+
def initialize(_from_message: false, id: nil,
|
1237
1232
|
test_id: nil,
|
1238
1233
|
some_int: nil,
|
1239
1234
|
message_id: nil,
|
1240
1235
|
timestamp: nil)
|
1236
|
+
@_from_message = _from_message
|
1241
1237
|
super
|
1242
1238
|
self.id = id
|
1243
1239
|
self.test_id = test_id
|
@@ -1284,7 +1280,8 @@ module Schemas; module MyNamespace; module Request
|
|
1284
1280
|
attr_accessor :request_id
|
1285
1281
|
|
1286
1282
|
# @override
|
1287
|
-
def initialize(request_id: nil)
|
1283
|
+
def initialize(_from_message: false, request_id: nil)
|
1284
|
+
@_from_message = _from_message
|
1288
1285
|
super
|
1289
1286
|
self.request_id = request_id
|
1290
1287
|
end
|
@@ -1323,7 +1320,8 @@ module Schemas; module MyNamespace; module Request
|
|
1323
1320
|
attr_accessor :request_id
|
1324
1321
|
|
1325
1322
|
# @override
|
1326
|
-
def initialize(request_id: nil)
|
1323
|
+
def initialize(_from_message: false, request_id: nil)
|
1324
|
+
@_from_message = _from_message
|
1327
1325
|
super
|
1328
1326
|
self.request_id = request_id
|
1329
1327
|
end
|
@@ -1362,7 +1360,8 @@ module Schemas; module MyNamespace; module Request
|
|
1362
1360
|
attr_accessor :update_request_id
|
1363
1361
|
|
1364
1362
|
# @override
|
1365
|
-
def initialize(update_request_id: nil)
|
1363
|
+
def initialize(_from_message: false, update_request_id: nil)
|
1364
|
+
@_from_message = _from_message
|
1366
1365
|
super
|
1367
1366
|
self.update_request_id = update_request_id
|
1368
1367
|
end
|
@@ -1401,7 +1400,8 @@ module Schemas; module MyNamespace; module Response
|
|
1401
1400
|
attr_accessor :response_id
|
1402
1401
|
|
1403
1402
|
# @override
|
1404
|
-
def initialize(response_id: nil)
|
1403
|
+
def initialize(_from_message: false, response_id: nil)
|
1404
|
+
@_from_message = _from_message
|
1405
1405
|
super
|
1406
1406
|
self.response_id = response_id
|
1407
1407
|
end
|
@@ -1440,7 +1440,8 @@ module Schemas; module MyNamespace; module Response
|
|
1440
1440
|
attr_accessor :response_id
|
1441
1441
|
|
1442
1442
|
# @override
|
1443
|
-
def initialize(response_id: nil)
|
1443
|
+
def initialize(_from_message: false, response_id: nil)
|
1444
|
+
@_from_message = _from_message
|
1444
1445
|
super
|
1445
1446
|
self.response_id = response_id
|
1446
1447
|
end
|
@@ -1479,7 +1480,8 @@ module Schemas; module MyNamespace; module Response
|
|
1479
1480
|
attr_accessor :update_response_id
|
1480
1481
|
|
1481
1482
|
# @override
|
1482
|
-
def initialize(update_response_id: nil)
|
1483
|
+
def initialize(_from_message: false, update_response_id: nil)
|
1484
|
+
@_from_message = _from_message
|
1483
1485
|
super
|
1484
1486
|
self.update_response_id = update_response_id
|
1485
1487
|
end
|
@@ -1534,7 +1536,7 @@ module Schemas; module MyNamespace
|
|
1534
1536
|
attr_accessor :created_at
|
1535
1537
|
|
1536
1538
|
# @override
|
1537
|
-
def initialize(id: nil,
|
1539
|
+
def initialize(_from_message: false, id: nil,
|
1538
1540
|
wibble_id: nil,
|
1539
1541
|
name: nil,
|
1540
1542
|
floop: nil,
|
@@ -1543,6 +1545,7 @@ module Schemas; module MyNamespace
|
|
1543
1545
|
birthday_optional: nil,
|
1544
1546
|
updated_at: nil,
|
1545
1547
|
created_at: nil)
|
1548
|
+
@_from_message = _from_message
|
1546
1549
|
super
|
1547
1550
|
self.id = id
|
1548
1551
|
self.wibble_id = wibble_id
|
@@ -1605,11 +1608,12 @@ module Schemas; module MyNamespace
|
|
1605
1608
|
attr_accessor :created_at
|
1606
1609
|
|
1607
1610
|
# @override
|
1608
|
-
def initialize(id: nil,
|
1611
|
+
def initialize(_from_message: false, id: nil,
|
1609
1612
|
widget_id: nil,
|
1610
1613
|
name: nil,
|
1611
1614
|
updated_at: nil,
|
1612
1615
|
created_at: nil)
|
1616
|
+
@_from_message = _from_message
|
1613
1617
|
super
|
1614
1618
|
self.id = id
|
1615
1619
|
self.widget_id = widget_id
|
@@ -1664,11 +1668,12 @@ module Schemas; module MyNamespace
|
|
1664
1668
|
attr_accessor :created_at
|
1665
1669
|
|
1666
1670
|
# @override
|
1667
|
-
def initialize(id: nil,
|
1671
|
+
def initialize(_from_message: false, id: nil,
|
1668
1672
|
widget_id: nil,
|
1669
1673
|
model_id: nil,
|
1670
1674
|
updated_at: nil,
|
1671
1675
|
created_at: nil)
|
1676
|
+
@_from_message = _from_message
|
1672
1677
|
super
|
1673
1678
|
self.id = id
|
1674
1679
|
self.widget_id = widget_id
|