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 :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
|
@@ -80,13 +82,20 @@ module Schemas
|
|
80
82
|
|
81
83
|
# Autogenerated Schema for Enum at com.my-namespace.AnEnum
|
82
84
|
class AnEnum < Deimos::SchemaClass::Enum
|
83
|
-
# @return ['sym1', 'sym2']
|
84
|
-
attr_accessor :an_enum
|
85
|
-
|
86
85
|
# @override
|
87
86
|
def symbols
|
88
87
|
%w(sym1 sym2)
|
89
88
|
end
|
89
|
+
|
90
|
+
|
91
|
+
def sym1?
|
92
|
+
@value == 'sym1'
|
93
|
+
end
|
94
|
+
|
95
|
+
def sym2?
|
96
|
+
@value == 'sym2'
|
97
|
+
end
|
98
|
+
|
90
99
|
end
|
91
100
|
|
92
101
|
|
@@ -130,7 +139,7 @@ module Schemas
|
|
130
139
|
end
|
131
140
|
|
132
141
|
# @override
|
133
|
-
def initialize(a_string: nil,
|
142
|
+
def initialize(_from_message: false, a_string: nil,
|
134
143
|
a_int: nil,
|
135
144
|
a_long: nil,
|
136
145
|
a_float: nil,
|
@@ -142,6 +151,7 @@ module Schemas
|
|
142
151
|
timestamp: nil,
|
143
152
|
message_id: nil,
|
144
153
|
a_record: nil)
|
154
|
+
@_from_message = _from_message
|
145
155
|
super
|
146
156
|
self.a_string = a_string
|
147
157
|
self.a_int = a_int
|
@@ -202,7 +212,8 @@ module Schemas
|
|
202
212
|
attr_accessor :response_id
|
203
213
|
|
204
214
|
# @override
|
205
|
-
def initialize(response_id: nil)
|
215
|
+
def initialize(_from_message: false, response_id: nil)
|
216
|
+
@_from_message = _from_message
|
206
217
|
super
|
207
218
|
self.response_id = response_id
|
208
219
|
end
|
@@ -243,8 +254,9 @@ module Schemas
|
|
243
254
|
attr_accessor :some_int
|
244
255
|
|
245
256
|
# @override
|
246
|
-
def initialize(test_id: nil,
|
257
|
+
def initialize(_from_message: false, test_id: nil,
|
247
258
|
some_int: nil)
|
259
|
+
@_from_message = _from_message
|
248
260
|
super
|
249
261
|
self.test_id = test_id
|
250
262
|
self.some_int = some_int
|
@@ -295,10 +307,11 @@ module Schemas
|
|
295
307
|
attr_accessor :some_optional_int
|
296
308
|
|
297
309
|
# @override
|
298
|
-
def initialize(some_int: nil,
|
310
|
+
def initialize(_from_message: false, some_int: nil,
|
299
311
|
some_float: nil,
|
300
312
|
some_string: nil,
|
301
313
|
some_optional_int: nil)
|
314
|
+
@_from_message = _from_message
|
302
315
|
super
|
303
316
|
self.some_int = some_int
|
304
317
|
self.some_float = some_float
|
@@ -354,11 +367,12 @@ module Schemas
|
|
354
367
|
end
|
355
368
|
|
356
369
|
# @override
|
357
|
-
def initialize(test_id: nil,
|
370
|
+
def initialize(_from_message: false, test_id: nil,
|
358
371
|
test_float: nil,
|
359
372
|
test_array: nil,
|
360
373
|
some_nested_record: nil,
|
361
374
|
some_optional_record: nil)
|
375
|
+
@_from_message = _from_message
|
362
376
|
super
|
363
377
|
self.test_id = test_id
|
364
378
|
self.test_float = test_float
|
@@ -377,6 +391,13 @@ module Schemas
|
|
377
391
|
'com.my-namespace'
|
378
392
|
end
|
379
393
|
|
394
|
+
def self.tombstone(key)
|
395
|
+
record = self.allocate
|
396
|
+
record.tombstone_key = key
|
397
|
+
record.test_id = key
|
398
|
+
record
|
399
|
+
end
|
400
|
+
|
380
401
|
# @override
|
381
402
|
def as_json(_opts={})
|
382
403
|
{
|
@@ -407,8 +428,9 @@ module Schemas
|
|
407
428
|
attr_accessor :some_int
|
408
429
|
|
409
430
|
# @override
|
410
|
-
def initialize(test_id: nil,
|
431
|
+
def initialize(_from_message: false, test_id: nil,
|
411
432
|
some_int: nil)
|
433
|
+
@_from_message = _from_message
|
412
434
|
super
|
413
435
|
self.test_id = test_id
|
414
436
|
self.some_int = some_int
|
@@ -451,8 +473,9 @@ module Schemas
|
|
451
473
|
attr_accessor :part_two
|
452
474
|
|
453
475
|
# @override
|
454
|
-
def initialize(part_one: nil,
|
476
|
+
def initialize(_from_message: false, part_one: nil,
|
455
477
|
part_two: nil)
|
478
|
+
@_from_message = _from_message
|
456
479
|
super
|
457
480
|
self.part_one = part_one
|
458
481
|
self.part_two = part_two
|
@@ -493,7 +516,8 @@ module Schemas
|
|
493
516
|
attr_accessor :id
|
494
517
|
|
495
518
|
# @override
|
496
|
-
def initialize(id: nil)
|
519
|
+
def initialize(_from_message: false, id: nil)
|
520
|
+
@_from_message = _from_message
|
497
521
|
super
|
498
522
|
self.id = id
|
499
523
|
end
|
@@ -532,7 +556,8 @@ module Schemas
|
|
532
556
|
attr_accessor :test_id
|
533
557
|
|
534
558
|
# @override
|
535
|
-
def initialize(test_id: nil)
|
559
|
+
def initialize(_from_message: false, test_id: nil)
|
560
|
+
@_from_message = _from_message
|
536
561
|
super
|
537
562
|
self.test_id = test_id
|
538
563
|
end
|
@@ -573,8 +598,9 @@ module Schemas
|
|
573
598
|
attr_accessor :some_bool
|
574
599
|
|
575
600
|
# @override
|
576
|
-
def initialize(test_id: nil,
|
601
|
+
def initialize(_from_message: false, test_id: nil,
|
577
602
|
some_bool: nil)
|
603
|
+
@_from_message = _from_message
|
578
604
|
super
|
579
605
|
self.test_id = test_id
|
580
606
|
self.some_bool = some_bool
|
@@ -619,7 +645,8 @@ module Schemas
|
|
619
645
|
attr_accessor :property
|
620
646
|
|
621
647
|
# @override
|
622
|
-
def initialize(property: nil)
|
648
|
+
def initialize(_from_message: false, property: nil)
|
649
|
+
@_from_message = _from_message
|
623
650
|
super
|
624
651
|
self.property = property
|
625
652
|
end
|
@@ -656,7 +683,8 @@ module Schemas
|
|
656
683
|
end
|
657
684
|
|
658
685
|
# @override
|
659
|
-
def initialize(properties: {})
|
686
|
+
def initialize(_from_message: false, properties: {})
|
687
|
+
@_from_message = _from_message
|
660
688
|
super
|
661
689
|
self.properties = properties
|
662
690
|
end
|
@@ -699,7 +727,8 @@ module Schemas
|
|
699
727
|
attr_accessor :a_record_field
|
700
728
|
|
701
729
|
# @override
|
702
|
-
def initialize(a_record_field: nil)
|
730
|
+
def initialize(_from_message: false, a_record_field: nil)
|
731
|
+
@_from_message = _from_message
|
703
732
|
super
|
704
733
|
self.a_record_field = a_record_field
|
705
734
|
end
|
@@ -724,35 +753,56 @@ module Schemas
|
|
724
753
|
|
725
754
|
# Autogenerated Schema for Enum at com.my-namespace.AnEnum
|
726
755
|
class AnEnum < Deimos::SchemaClass::Enum
|
727
|
-
# @return ['sym1', 'sym2']
|
728
|
-
attr_accessor :an_enum
|
729
|
-
|
730
756
|
# @override
|
731
757
|
def symbols
|
732
758
|
%w(sym1 sym2)
|
733
759
|
end
|
760
|
+
|
761
|
+
|
762
|
+
def sym1?
|
763
|
+
@value == 'sym1'
|
764
|
+
end
|
765
|
+
|
766
|
+
def sym2?
|
767
|
+
@value == 'sym2'
|
768
|
+
end
|
769
|
+
|
734
770
|
end
|
735
771
|
|
736
772
|
# Autogenerated Schema for Enum at com.my-namespace.AnotherEnum
|
737
773
|
class AnotherEnum < Deimos::SchemaClass::Enum
|
738
|
-
# @return ['sym3', 'sym4']
|
739
|
-
attr_accessor :another_enum
|
740
|
-
|
741
774
|
# @override
|
742
775
|
def symbols
|
743
776
|
%w(sym3 sym4)
|
744
777
|
end
|
778
|
+
|
779
|
+
|
780
|
+
def sym3?
|
781
|
+
@value == 'sym3'
|
782
|
+
end
|
783
|
+
|
784
|
+
def sym4?
|
785
|
+
@value == 'sym4'
|
786
|
+
end
|
787
|
+
|
745
788
|
end
|
746
789
|
|
747
790
|
# Autogenerated Schema for Enum at com.my-namespace.YetAnotherEnum
|
748
791
|
class YetAnotherEnum < Deimos::SchemaClass::Enum
|
749
|
-
# @return ['sym5', 'sym6']
|
750
|
-
attr_accessor :yet_another_enum
|
751
|
-
|
752
792
|
# @override
|
753
793
|
def symbols
|
754
794
|
%w(sym5 sym6)
|
755
795
|
end
|
796
|
+
|
797
|
+
|
798
|
+
def sym5?
|
799
|
+
@value == 'sym5'
|
800
|
+
end
|
801
|
+
|
802
|
+
def sym6?
|
803
|
+
@value == 'sym6'
|
804
|
+
end
|
805
|
+
|
756
806
|
end
|
757
807
|
|
758
808
|
|
@@ -829,7 +879,7 @@ module Schemas
|
|
829
879
|
end
|
830
880
|
|
831
881
|
# @override
|
832
|
-
def initialize(test_id: nil,
|
882
|
+
def initialize(_from_message: false, test_id: nil,
|
833
883
|
test_float: nil,
|
834
884
|
test_string_array: ["test"],
|
835
885
|
test_int_array: [123],
|
@@ -842,6 +892,7 @@ module Schemas
|
|
842
892
|
some_enum_array: nil,
|
843
893
|
some_optional_enum: nil,
|
844
894
|
some_enum_with_default: "sym6")
|
895
|
+
@_from_message = _from_message
|
845
896
|
super
|
846
897
|
self.test_id = test_id
|
847
898
|
self.test_float = test_float
|
@@ -868,13 +919,6 @@ module Schemas
|
|
868
919
|
'com.my-namespace'
|
869
920
|
end
|
870
921
|
|
871
|
-
def self.tombstone(key)
|
872
|
-
record = self.allocate
|
873
|
-
record.tombstone_key = key
|
874
|
-
record.a_string = key
|
875
|
-
record
|
876
|
-
end
|
877
|
-
|
878
922
|
# @override
|
879
923
|
def as_json(_opts={})
|
880
924
|
{
|
@@ -919,11 +963,12 @@ module Schemas
|
|
919
963
|
attr_accessor :timestamp
|
920
964
|
|
921
965
|
# @override
|
922
|
-
def initialize(test_id: nil,
|
966
|
+
def initialize(_from_message: false, test_id: nil,
|
923
967
|
updated_at: nil,
|
924
968
|
some_int: nil,
|
925
969
|
some_datetime_int: nil,
|
926
970
|
timestamp: nil)
|
971
|
+
@_from_message = _from_message
|
927
972
|
super
|
928
973
|
self.test_id = test_id
|
929
974
|
self.updated_at = updated_at
|
@@ -976,10 +1021,11 @@ module Schemas
|
|
976
1021
|
attr_accessor :timestamp
|
977
1022
|
|
978
1023
|
# @override
|
979
|
-
def initialize(test_id: nil,
|
1024
|
+
def initialize(_from_message: false, test_id: nil,
|
980
1025
|
some_int: nil,
|
981
1026
|
message_id: nil,
|
982
1027
|
timestamp: nil)
|
1028
|
+
@_from_message = _from_message
|
983
1029
|
super
|
984
1030
|
self.test_id = test_id
|
985
1031
|
self.some_int = some_int
|
@@ -1028,9 +1074,10 @@ module Schemas
|
|
1028
1074
|
attr_accessor :title
|
1029
1075
|
|
1030
1076
|
# @override
|
1031
|
-
def initialize(test_id: nil,
|
1077
|
+
def initialize(_from_message: false, test_id: nil,
|
1032
1078
|
some_int: nil,
|
1033
1079
|
title: nil)
|
1080
|
+
@_from_message = _from_message
|
1034
1081
|
super
|
1035
1082
|
self.test_id = test_id
|
1036
1083
|
self.some_int = some_int
|
@@ -1079,8 +1126,9 @@ module Schemas
|
|
1079
1126
|
attr_accessor :record1_id
|
1080
1127
|
|
1081
1128
|
# @override
|
1082
|
-
def initialize(record1_map: {},
|
1129
|
+
def initialize(_from_message: false, record1_map: {},
|
1083
1130
|
record1_id: 0)
|
1131
|
+
@_from_message = _from_message
|
1084
1132
|
super
|
1085
1133
|
self.record1_map = record1_map
|
1086
1134
|
self.record1_id = record1_id
|
@@ -1113,7 +1161,8 @@ module Schemas
|
|
1113
1161
|
attr_accessor :record2_id
|
1114
1162
|
|
1115
1163
|
# @override
|
1116
|
-
def initialize(record2_id: "")
|
1164
|
+
def initialize(_from_message: false, record2_id: "")
|
1165
|
+
@_from_message = _from_message
|
1117
1166
|
super
|
1118
1167
|
self.record2_id = record2_id
|
1119
1168
|
end
|
@@ -1144,7 +1193,8 @@ module Schemas
|
|
1144
1193
|
attr_accessor :record3_id
|
1145
1194
|
|
1146
1195
|
# @override
|
1147
|
-
def initialize(record3_id: 0.0)
|
1196
|
+
def initialize(_from_message: false, record3_id: 0.0)
|
1197
|
+
@_from_message = _from_message
|
1148
1198
|
super
|
1149
1199
|
self.record3_id = record3_id
|
1150
1200
|
end
|
@@ -1175,7 +1225,8 @@ module Schemas
|
|
1175
1225
|
attr_accessor :record4_id
|
1176
1226
|
|
1177
1227
|
# @override
|
1178
|
-
def initialize(record4_id: 0)
|
1228
|
+
def initialize(_from_message: false, record4_id: 0)
|
1229
|
+
@_from_message = _from_message
|
1179
1230
|
super
|
1180
1231
|
self.record4_id = record4_id
|
1181
1232
|
end
|
@@ -1231,9 +1282,10 @@ module Schemas
|
|
1231
1282
|
end
|
1232
1283
|
|
1233
1284
|
# @override
|
1234
|
-
def initialize(test_id: "",
|
1285
|
+
def initialize(_from_message: false, test_id: "",
|
1235
1286
|
test_long: nil,
|
1236
1287
|
test_union_type: nil)
|
1288
|
+
@_from_message = _from_message
|
1237
1289
|
super
|
1238
1290
|
self.test_id = test_id
|
1239
1291
|
self.test_long = test_long
|
@@ -1284,11 +1336,12 @@ module Schemas
|
|
1284
1336
|
attr_accessor :timestamp
|
1285
1337
|
|
1286
1338
|
# @override
|
1287
|
-
def initialize(id: nil,
|
1339
|
+
def initialize(_from_message: false, id: nil,
|
1288
1340
|
test_id: nil,
|
1289
1341
|
some_int: nil,
|
1290
1342
|
message_id: nil,
|
1291
1343
|
timestamp: nil)
|
1344
|
+
@_from_message = _from_message
|
1292
1345
|
super
|
1293
1346
|
self.id = id
|
1294
1347
|
self.test_id = test_id
|
@@ -1335,7 +1388,8 @@ module Schemas
|
|
1335
1388
|
attr_accessor :update_request_id
|
1336
1389
|
|
1337
1390
|
# @override
|
1338
|
-
def initialize(update_request_id: nil)
|
1391
|
+
def initialize(_from_message: false, update_request_id: nil)
|
1392
|
+
@_from_message = _from_message
|
1339
1393
|
super
|
1340
1394
|
self.update_request_id = update_request_id
|
1341
1395
|
end
|
@@ -1374,7 +1428,8 @@ module Schemas
|
|
1374
1428
|
attr_accessor :update_response_id
|
1375
1429
|
|
1376
1430
|
# @override
|
1377
|
-
def initialize(update_response_id: nil)
|
1431
|
+
def initialize(_from_message: false, update_response_id: nil)
|
1432
|
+
@_from_message = _from_message
|
1378
1433
|
super
|
1379
1434
|
self.update_response_id = update_response_id
|
1380
1435
|
end
|
@@ -1429,7 +1484,7 @@ module Schemas
|
|
1429
1484
|
attr_accessor :created_at
|
1430
1485
|
|
1431
1486
|
# @override
|
1432
|
-
def initialize(id: nil,
|
1487
|
+
def initialize(_from_message: false, id: nil,
|
1433
1488
|
wibble_id: nil,
|
1434
1489
|
name: nil,
|
1435
1490
|
floop: nil,
|
@@ -1438,6 +1493,7 @@ module Schemas
|
|
1438
1493
|
birthday_optional: nil,
|
1439
1494
|
updated_at: nil,
|
1440
1495
|
created_at: nil)
|
1496
|
+
@_from_message = _from_message
|
1441
1497
|
super
|
1442
1498
|
self.id = id
|
1443
1499
|
self.wibble_id = wibble_id
|
@@ -1500,11 +1556,12 @@ module Schemas
|
|
1500
1556
|
attr_accessor :created_at
|
1501
1557
|
|
1502
1558
|
# @override
|
1503
|
-
def initialize(id: nil,
|
1559
|
+
def initialize(_from_message: false, id: nil,
|
1504
1560
|
widget_id: nil,
|
1505
1561
|
name: nil,
|
1506
1562
|
updated_at: nil,
|
1507
1563
|
created_at: nil)
|
1564
|
+
@_from_message = _from_message
|
1508
1565
|
super
|
1509
1566
|
self.id = id
|
1510
1567
|
self.widget_id = widget_id
|
@@ -1559,11 +1616,12 @@ module Schemas
|
|
1559
1616
|
attr_accessor :created_at
|
1560
1617
|
|
1561
1618
|
# @override
|
1562
|
-
def initialize(id: nil,
|
1619
|
+
def initialize(_from_message: false, id: nil,
|
1563
1620
|
widget_id: nil,
|
1564
1621
|
model_id: nil,
|
1565
1622
|
updated_at: nil,
|
1566
1623
|
created_at: nil)
|
1624
|
+
@_from_message = _from_message
|
1567
1625
|
super
|
1568
1626
|
self.id = id
|
1569
1627
|
self.widget_id = widget_id
|