deimos-ruby 2.1.2.pre.beta1 → 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 +6 -1
- data/README.md +1 -1
- 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/consumer_spec.rb +25 -4
- data/spec/schemas/my_namespace/generated.rb +6 -4
- data/spec/schemas/my_namespace/my_long_namespace_schema.rb +2 -1
- data/spec/schemas/my_namespace/my_nested_schema.rb +6 -4
- data/spec/schemas/my_namespace/my_schema.rb +4 -3
- data/spec/schemas/my_namespace/my_schema_compound_key.rb +2 -1
- data/spec/schemas/my_namespace/my_schema_id_key.rb +2 -1
- data/spec/schemas/my_namespace/my_schema_key.rb +2 -1
- data/spec/schemas/my_namespace/my_schema_with_boolean.rb +2 -1
- data/spec/schemas/my_namespace/my_schema_with_circular_reference.rb +5 -3
- data/spec/schemas/my_namespace/my_schema_with_complex_type.rb +11 -9
- data/spec/schemas/my_namespace/my_schema_with_date_time.rb +2 -1
- data/spec/schemas/my_namespace/my_schema_with_id.rb +2 -1
- data/spec/schemas/my_namespace/my_schema_with_title.rb +47 -0
- data/spec/schemas/my_namespace/my_schema_with_union_type.rb +12 -7
- data/spec/schemas/my_namespace/my_schema_with_unique_id.rb +2 -1
- data/spec/schemas/my_namespace/my_updated_schema.rb +2 -1
- data/spec/schemas/my_namespace/request/create_topic.rb +2 -1
- data/spec/schemas/my_namespace/request/index.rb +2 -1
- data/spec/schemas/my_namespace/request/update_request.rb +2 -1
- data/spec/schemas/my_namespace/response/create_topic.rb +2 -1
- data/spec/schemas/my_namespace/response/index.rb +2 -1
- data/spec/schemas/my_namespace/response/update_response.rb +2 -1
- data/spec/schemas/my_namespace/wibble.rb +2 -1
- data/spec/schemas/my_namespace/widget.rb +2 -1
- data/spec/schemas/my_namespace/widget_the_second.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 +6 -4
@@ -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
|
{
|
@@ -446,8 +460,9 @@ module Schemas
|
|
446
460
|
attr_accessor :some_int
|
447
461
|
|
448
462
|
# @override
|
449
|
-
def initialize(test_id: nil,
|
463
|
+
def initialize(_from_message: false, test_id: nil,
|
450
464
|
some_int: nil)
|
465
|
+
@_from_message = _from_message
|
451
466
|
super
|
452
467
|
self.test_id = test_id
|
453
468
|
self.some_int = some_int
|
@@ -490,8 +505,9 @@ module Schemas
|
|
490
505
|
attr_accessor :part_two
|
491
506
|
|
492
507
|
# @override
|
493
|
-
def initialize(part_one: nil,
|
508
|
+
def initialize(_from_message: false, part_one: nil,
|
494
509
|
part_two: nil)
|
510
|
+
@_from_message = _from_message
|
495
511
|
super
|
496
512
|
self.part_one = part_one
|
497
513
|
self.part_two = part_two
|
@@ -532,7 +548,8 @@ module Schemas
|
|
532
548
|
attr_accessor :id
|
533
549
|
|
534
550
|
# @override
|
535
|
-
def initialize(id: nil)
|
551
|
+
def initialize(_from_message: false, id: nil)
|
552
|
+
@_from_message = _from_message
|
536
553
|
super
|
537
554
|
self.id = id
|
538
555
|
end
|
@@ -571,7 +588,8 @@ module Schemas
|
|
571
588
|
attr_accessor :test_id
|
572
589
|
|
573
590
|
# @override
|
574
|
-
def initialize(test_id: nil)
|
591
|
+
def initialize(_from_message: false, test_id: nil)
|
592
|
+
@_from_message = _from_message
|
575
593
|
super
|
576
594
|
self.test_id = test_id
|
577
595
|
end
|
@@ -612,8 +630,9 @@ module Schemas
|
|
612
630
|
attr_accessor :some_bool
|
613
631
|
|
614
632
|
# @override
|
615
|
-
def initialize(test_id: nil,
|
633
|
+
def initialize(_from_message: false, test_id: nil,
|
616
634
|
some_bool: nil)
|
635
|
+
@_from_message = _from_message
|
617
636
|
super
|
618
637
|
self.test_id = test_id
|
619
638
|
self.some_bool = some_bool
|
@@ -662,7 +681,8 @@ module Schemas
|
|
662
681
|
end
|
663
682
|
|
664
683
|
# @override
|
665
|
-
def initialize(properties: {})
|
684
|
+
def initialize(_from_message: false, properties: {})
|
685
|
+
@_from_message = _from_message
|
666
686
|
super
|
667
687
|
self.properties = properties
|
668
688
|
end
|
@@ -677,13 +697,6 @@ module Schemas
|
|
677
697
|
'com.my-namespace'
|
678
698
|
end
|
679
699
|
|
680
|
-
def self.tombstone(key)
|
681
|
-
record = self.allocate
|
682
|
-
record.tombstone_key = key
|
683
|
-
record.a_string = key
|
684
|
-
record
|
685
|
-
end
|
686
|
-
|
687
700
|
# @override
|
688
701
|
def as_json(_opts={})
|
689
702
|
{
|
@@ -776,7 +789,7 @@ module Schemas
|
|
776
789
|
end
|
777
790
|
|
778
791
|
# @override
|
779
|
-
def initialize(test_id: nil,
|
792
|
+
def initialize(_from_message: false, test_id: nil,
|
780
793
|
test_float: nil,
|
781
794
|
test_string_array: ["test"],
|
782
795
|
test_int_array: [123],
|
@@ -789,6 +802,7 @@ module Schemas
|
|
789
802
|
some_enum_array: nil,
|
790
803
|
some_optional_enum: nil,
|
791
804
|
some_enum_with_default: "sym6")
|
805
|
+
@_from_message = _from_message
|
792
806
|
super
|
793
807
|
self.test_id = test_id
|
794
808
|
self.test_float = test_float
|
@@ -859,11 +873,12 @@ module Schemas
|
|
859
873
|
attr_accessor :timestamp
|
860
874
|
|
861
875
|
# @override
|
862
|
-
def initialize(test_id: nil,
|
876
|
+
def initialize(_from_message: false, test_id: nil,
|
863
877
|
updated_at: nil,
|
864
878
|
some_int: nil,
|
865
879
|
some_datetime_int: nil,
|
866
880
|
timestamp: nil)
|
881
|
+
@_from_message = _from_message
|
867
882
|
super
|
868
883
|
self.test_id = test_id
|
869
884
|
self.updated_at = updated_at
|
@@ -916,10 +931,11 @@ module Schemas
|
|
916
931
|
attr_accessor :timestamp
|
917
932
|
|
918
933
|
# @override
|
919
|
-
def initialize(test_id: nil,
|
934
|
+
def initialize(_from_message: false, test_id: nil,
|
920
935
|
some_int: nil,
|
921
936
|
message_id: nil,
|
922
937
|
timestamp: nil)
|
938
|
+
@_from_message = _from_message
|
923
939
|
super
|
924
940
|
self.test_id = test_id
|
925
941
|
self.some_int = some_int
|
@@ -968,9 +984,10 @@ module Schemas
|
|
968
984
|
attr_accessor :title
|
969
985
|
|
970
986
|
# @override
|
971
|
-
def initialize(test_id: nil,
|
987
|
+
def initialize(_from_message: false, test_id: nil,
|
972
988
|
some_int: nil,
|
973
989
|
title: nil)
|
990
|
+
@_from_message = _from_message
|
974
991
|
super
|
975
992
|
self.test_id = test_id
|
976
993
|
self.some_int = some_int
|
@@ -1040,9 +1057,10 @@ module Schemas
|
|
1040
1057
|
end
|
1041
1058
|
|
1042
1059
|
# @override
|
1043
|
-
def initialize(test_id: "",
|
1060
|
+
def initialize(_from_message: false, test_id: "",
|
1044
1061
|
test_long: nil,
|
1045
1062
|
test_union_type: nil)
|
1063
|
+
@_from_message = _from_message
|
1046
1064
|
super
|
1047
1065
|
self.test_id = test_id
|
1048
1066
|
self.test_long = test_long
|
@@ -1093,11 +1111,12 @@ module Schemas
|
|
1093
1111
|
attr_accessor :timestamp
|
1094
1112
|
|
1095
1113
|
# @override
|
1096
|
-
def initialize(id: nil,
|
1114
|
+
def initialize(_from_message: false, id: nil,
|
1097
1115
|
test_id: nil,
|
1098
1116
|
some_int: nil,
|
1099
1117
|
message_id: nil,
|
1100
1118
|
timestamp: nil)
|
1119
|
+
@_from_message = _from_message
|
1101
1120
|
super
|
1102
1121
|
self.id = id
|
1103
1122
|
self.test_id = test_id
|
@@ -1144,7 +1163,8 @@ module Schemas
|
|
1144
1163
|
attr_accessor :property
|
1145
1164
|
|
1146
1165
|
# @override
|
1147
|
-
def initialize(property: nil)
|
1166
|
+
def initialize(_from_message: false, property: nil)
|
1167
|
+
@_from_message = _from_message
|
1148
1168
|
super
|
1149
1169
|
self.property = property
|
1150
1170
|
end
|
@@ -1185,8 +1205,9 @@ module Schemas
|
|
1185
1205
|
attr_accessor :record1_id
|
1186
1206
|
|
1187
1207
|
# @override
|
1188
|
-
def initialize(record1_map: {},
|
1208
|
+
def initialize(_from_message: false, record1_map: {},
|
1189
1209
|
record1_id: 0)
|
1210
|
+
@_from_message = _from_message
|
1190
1211
|
super
|
1191
1212
|
self.record1_map = record1_map
|
1192
1213
|
self.record1_id = record1_id
|
@@ -1227,7 +1248,8 @@ module Schemas
|
|
1227
1248
|
attr_accessor :record2_id
|
1228
1249
|
|
1229
1250
|
# @override
|
1230
|
-
def initialize(record2_id: "")
|
1251
|
+
def initialize(_from_message: false, record2_id: "")
|
1252
|
+
@_from_message = _from_message
|
1231
1253
|
super
|
1232
1254
|
self.record2_id = record2_id
|
1233
1255
|
end
|
@@ -1266,7 +1288,8 @@ module Schemas
|
|
1266
1288
|
attr_accessor :record3_id
|
1267
1289
|
|
1268
1290
|
# @override
|
1269
|
-
def initialize(record3_id: 0.0)
|
1291
|
+
def initialize(_from_message: false, record3_id: 0.0)
|
1292
|
+
@_from_message = _from_message
|
1270
1293
|
super
|
1271
1294
|
self.record3_id = record3_id
|
1272
1295
|
end
|
@@ -1305,7 +1328,8 @@ module Schemas
|
|
1305
1328
|
attr_accessor :record4_id
|
1306
1329
|
|
1307
1330
|
# @override
|
1308
|
-
def initialize(record4_id: 0)
|
1331
|
+
def initialize(_from_message: false, record4_id: 0)
|
1332
|
+
@_from_message = _from_message
|
1309
1333
|
super
|
1310
1334
|
self.record4_id = record4_id
|
1311
1335
|
end
|
@@ -1344,7 +1368,8 @@ module Schemas
|
|
1344
1368
|
attr_accessor :update_request_id
|
1345
1369
|
|
1346
1370
|
# @override
|
1347
|
-
def initialize(update_request_id: nil)
|
1371
|
+
def initialize(_from_message: false, update_request_id: nil)
|
1372
|
+
@_from_message = _from_message
|
1348
1373
|
super
|
1349
1374
|
self.update_request_id = update_request_id
|
1350
1375
|
end
|
@@ -1383,7 +1408,8 @@ module Schemas
|
|
1383
1408
|
attr_accessor :update_response_id
|
1384
1409
|
|
1385
1410
|
# @override
|
1386
|
-
def initialize(update_response_id: nil)
|
1411
|
+
def initialize(_from_message: false, update_response_id: nil)
|
1412
|
+
@_from_message = _from_message
|
1387
1413
|
super
|
1388
1414
|
self.update_response_id = update_response_id
|
1389
1415
|
end
|
@@ -1438,7 +1464,7 @@ module Schemas
|
|
1438
1464
|
attr_accessor :created_at
|
1439
1465
|
|
1440
1466
|
# @override
|
1441
|
-
def initialize(id: nil,
|
1467
|
+
def initialize(_from_message: false, id: nil,
|
1442
1468
|
wibble_id: nil,
|
1443
1469
|
name: nil,
|
1444
1470
|
floop: nil,
|
@@ -1447,6 +1473,7 @@ module Schemas
|
|
1447
1473
|
birthday_optional: nil,
|
1448
1474
|
updated_at: nil,
|
1449
1475
|
created_at: nil)
|
1476
|
+
@_from_message = _from_message
|
1450
1477
|
super
|
1451
1478
|
self.id = id
|
1452
1479
|
self.wibble_id = wibble_id
|
@@ -1509,11 +1536,12 @@ module Schemas
|
|
1509
1536
|
attr_accessor :created_at
|
1510
1537
|
|
1511
1538
|
# @override
|
1512
|
-
def initialize(id: nil,
|
1539
|
+
def initialize(_from_message: false, id: nil,
|
1513
1540
|
widget_id: nil,
|
1514
1541
|
name: nil,
|
1515
1542
|
updated_at: nil,
|
1516
1543
|
created_at: nil)
|
1544
|
+
@_from_message = _from_message
|
1517
1545
|
super
|
1518
1546
|
self.id = id
|
1519
1547
|
self.widget_id = widget_id
|
@@ -1568,11 +1596,12 @@ module Schemas
|
|
1568
1596
|
attr_accessor :created_at
|
1569
1597
|
|
1570
1598
|
# @override
|
1571
|
-
def initialize(id: nil,
|
1599
|
+
def initialize(_from_message: false, id: nil,
|
1572
1600
|
widget_id: nil,
|
1573
1601
|
model_id: nil,
|
1574
1602
|
updated_at: nil,
|
1575
1603
|
created_at: nil)
|
1604
|
+
@_from_message = _from_message
|
1576
1605
|
super
|
1577
1606
|
self.id = id
|
1578
1607
|
self.widget_id = widget_id
|