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
|
{
|
@@ -400,30 +421,19 @@ module Schemas
|
|
400
421
|
# Autogenerated Schema for Record at com.my-namespace.MySchema
|
401
422
|
class MySchema < Deimos::SchemaClass::Record
|
402
423
|
|
403
|
-
### Attribute Readers ###
|
404
|
-
# @return [MySchemaKey]
|
405
|
-
attr_reader :payload_key
|
406
|
-
|
407
424
|
### Attribute Accessors ###
|
408
425
|
# @return [String]
|
409
426
|
attr_accessor :test_id
|
410
427
|
# @return [Integer]
|
411
428
|
attr_accessor :some_int
|
412
429
|
|
413
|
-
### Attribute Writers ###
|
414
|
-
# @return [MySchemaKey]
|
415
|
-
def payload_key=(value)
|
416
|
-
@payload_key = MySchemaKey.initialize_from_value(value, from_message: self._from_message)
|
417
|
-
end
|
418
|
-
|
419
430
|
# @override
|
420
|
-
def initialize(test_id: nil,
|
421
|
-
some_int: nil
|
422
|
-
|
431
|
+
def initialize(_from_message: false, test_id: nil,
|
432
|
+
some_int: nil)
|
433
|
+
@_from_message = _from_message
|
423
434
|
super
|
424
435
|
self.test_id = test_id
|
425
436
|
self.some_int = some_int
|
426
|
-
self.payload_key = payload_key
|
427
437
|
end
|
428
438
|
|
429
439
|
# @override
|
@@ -436,19 +446,11 @@ module Schemas
|
|
436
446
|
'com.my-namespace'
|
437
447
|
end
|
438
448
|
|
439
|
-
def self.tombstone(key)
|
440
|
-
record = self.allocate
|
441
|
-
record.tombstone_key = MySchemaKey.initialize_from_value(key, from_message: self._from_message)
|
442
|
-
record.payload_key = key
|
443
|
-
record
|
444
|
-
end
|
445
|
-
|
446
449
|
# @override
|
447
450
|
def as_json(_opts={})
|
448
451
|
{
|
449
452
|
'test_id' => @test_id,
|
450
|
-
'some_int' => @some_int
|
451
|
-
'payload_key' => @payload_key&.as_json
|
453
|
+
'some_int' => @some_int
|
452
454
|
}
|
453
455
|
end
|
454
456
|
end
|
@@ -471,8 +473,9 @@ module Schemas
|
|
471
473
|
attr_accessor :part_two
|
472
474
|
|
473
475
|
# @override
|
474
|
-
def initialize(part_one: nil,
|
476
|
+
def initialize(_from_message: false, part_one: nil,
|
475
477
|
part_two: nil)
|
478
|
+
@_from_message = _from_message
|
476
479
|
super
|
477
480
|
self.part_one = part_one
|
478
481
|
self.part_two = part_two
|
@@ -513,7 +516,8 @@ module Schemas
|
|
513
516
|
attr_accessor :id
|
514
517
|
|
515
518
|
# @override
|
516
|
-
def initialize(id: nil)
|
519
|
+
def initialize(_from_message: false, id: nil)
|
520
|
+
@_from_message = _from_message
|
517
521
|
super
|
518
522
|
self.id = id
|
519
523
|
end
|
@@ -552,7 +556,8 @@ module Schemas
|
|
552
556
|
attr_accessor :test_id
|
553
557
|
|
554
558
|
# @override
|
555
|
-
def initialize(test_id: nil)
|
559
|
+
def initialize(_from_message: false, test_id: nil)
|
560
|
+
@_from_message = _from_message
|
556
561
|
super
|
557
562
|
self.test_id = test_id
|
558
563
|
end
|
@@ -593,8 +598,9 @@ module Schemas
|
|
593
598
|
attr_accessor :some_bool
|
594
599
|
|
595
600
|
# @override
|
596
|
-
def initialize(test_id: nil,
|
601
|
+
def initialize(_from_message: false, test_id: nil,
|
597
602
|
some_bool: nil)
|
603
|
+
@_from_message = _from_message
|
598
604
|
super
|
599
605
|
self.test_id = test_id
|
600
606
|
self.some_bool = some_bool
|
@@ -639,7 +645,8 @@ module Schemas
|
|
639
645
|
attr_accessor :property
|
640
646
|
|
641
647
|
# @override
|
642
|
-
def initialize(property: nil)
|
648
|
+
def initialize(_from_message: false, property: nil)
|
649
|
+
@_from_message = _from_message
|
643
650
|
super
|
644
651
|
self.property = property
|
645
652
|
end
|
@@ -676,7 +683,8 @@ module Schemas
|
|
676
683
|
end
|
677
684
|
|
678
685
|
# @override
|
679
|
-
def initialize(properties: {})
|
686
|
+
def initialize(_from_message: false, properties: {})
|
687
|
+
@_from_message = _from_message
|
680
688
|
super
|
681
689
|
self.properties = properties
|
682
690
|
end
|
@@ -719,7 +727,8 @@ module Schemas
|
|
719
727
|
attr_accessor :a_record_field
|
720
728
|
|
721
729
|
# @override
|
722
|
-
def initialize(a_record_field: nil)
|
730
|
+
def initialize(_from_message: false, a_record_field: nil)
|
731
|
+
@_from_message = _from_message
|
723
732
|
super
|
724
733
|
self.a_record_field = a_record_field
|
725
734
|
end
|
@@ -744,35 +753,56 @@ module Schemas
|
|
744
753
|
|
745
754
|
# Autogenerated Schema for Enum at com.my-namespace.AnEnum
|
746
755
|
class AnEnum < Deimos::SchemaClass::Enum
|
747
|
-
# @return ['sym1', 'sym2']
|
748
|
-
attr_accessor :an_enum
|
749
|
-
|
750
756
|
# @override
|
751
757
|
def symbols
|
752
758
|
%w(sym1 sym2)
|
753
759
|
end
|
760
|
+
|
761
|
+
|
762
|
+
def sym1?
|
763
|
+
@value == 'sym1'
|
764
|
+
end
|
765
|
+
|
766
|
+
def sym2?
|
767
|
+
@value == 'sym2'
|
768
|
+
end
|
769
|
+
|
754
770
|
end
|
755
771
|
|
756
772
|
# Autogenerated Schema for Enum at com.my-namespace.AnotherEnum
|
757
773
|
class AnotherEnum < Deimos::SchemaClass::Enum
|
758
|
-
# @return ['sym3', 'sym4']
|
759
|
-
attr_accessor :another_enum
|
760
|
-
|
761
774
|
# @override
|
762
775
|
def symbols
|
763
776
|
%w(sym3 sym4)
|
764
777
|
end
|
778
|
+
|
779
|
+
|
780
|
+
def sym3?
|
781
|
+
@value == 'sym3'
|
782
|
+
end
|
783
|
+
|
784
|
+
def sym4?
|
785
|
+
@value == 'sym4'
|
786
|
+
end
|
787
|
+
|
765
788
|
end
|
766
789
|
|
767
790
|
# Autogenerated Schema for Enum at com.my-namespace.YetAnotherEnum
|
768
791
|
class YetAnotherEnum < Deimos::SchemaClass::Enum
|
769
|
-
# @return ['sym5', 'sym6']
|
770
|
-
attr_accessor :yet_another_enum
|
771
|
-
|
772
792
|
# @override
|
773
793
|
def symbols
|
774
794
|
%w(sym5 sym6)
|
775
795
|
end
|
796
|
+
|
797
|
+
|
798
|
+
def sym5?
|
799
|
+
@value == 'sym5'
|
800
|
+
end
|
801
|
+
|
802
|
+
def sym6?
|
803
|
+
@value == 'sym6'
|
804
|
+
end
|
805
|
+
|
776
806
|
end
|
777
807
|
|
778
808
|
|
@@ -849,7 +879,7 @@ module Schemas
|
|
849
879
|
end
|
850
880
|
|
851
881
|
# @override
|
852
|
-
def initialize(test_id: nil,
|
882
|
+
def initialize(_from_message: false, test_id: nil,
|
853
883
|
test_float: nil,
|
854
884
|
test_string_array: ["test"],
|
855
885
|
test_int_array: [123],
|
@@ -862,6 +892,7 @@ module Schemas
|
|
862
892
|
some_enum_array: nil,
|
863
893
|
some_optional_enum: nil,
|
864
894
|
some_enum_with_default: "sym6")
|
895
|
+
@_from_message = _from_message
|
865
896
|
super
|
866
897
|
self.test_id = test_id
|
867
898
|
self.test_float = test_float
|
@@ -932,11 +963,12 @@ module Schemas
|
|
932
963
|
attr_accessor :timestamp
|
933
964
|
|
934
965
|
# @override
|
935
|
-
def initialize(test_id: nil,
|
966
|
+
def initialize(_from_message: false, test_id: nil,
|
936
967
|
updated_at: nil,
|
937
968
|
some_int: nil,
|
938
969
|
some_datetime_int: nil,
|
939
970
|
timestamp: nil)
|
971
|
+
@_from_message = _from_message
|
940
972
|
super
|
941
973
|
self.test_id = test_id
|
942
974
|
self.updated_at = updated_at
|
@@ -989,10 +1021,11 @@ module Schemas
|
|
989
1021
|
attr_accessor :timestamp
|
990
1022
|
|
991
1023
|
# @override
|
992
|
-
def initialize(test_id: nil,
|
1024
|
+
def initialize(_from_message: false, test_id: nil,
|
993
1025
|
some_int: nil,
|
994
1026
|
message_id: nil,
|
995
1027
|
timestamp: nil)
|
1028
|
+
@_from_message = _from_message
|
996
1029
|
super
|
997
1030
|
self.test_id = test_id
|
998
1031
|
self.some_int = some_int
|
@@ -1041,9 +1074,10 @@ module Schemas
|
|
1041
1074
|
attr_accessor :title
|
1042
1075
|
|
1043
1076
|
# @override
|
1044
|
-
def initialize(test_id: nil,
|
1077
|
+
def initialize(_from_message: false, test_id: nil,
|
1045
1078
|
some_int: nil,
|
1046
1079
|
title: nil)
|
1080
|
+
@_from_message = _from_message
|
1047
1081
|
super
|
1048
1082
|
self.test_id = test_id
|
1049
1083
|
self.some_int = some_int
|
@@ -1092,8 +1126,9 @@ module Schemas
|
|
1092
1126
|
attr_accessor :record1_id
|
1093
1127
|
|
1094
1128
|
# @override
|
1095
|
-
def initialize(record1_map: {},
|
1129
|
+
def initialize(_from_message: false, record1_map: {},
|
1096
1130
|
record1_id: 0)
|
1131
|
+
@_from_message = _from_message
|
1097
1132
|
super
|
1098
1133
|
self.record1_map = record1_map
|
1099
1134
|
self.record1_id = record1_id
|
@@ -1126,7 +1161,8 @@ module Schemas
|
|
1126
1161
|
attr_accessor :record2_id
|
1127
1162
|
|
1128
1163
|
# @override
|
1129
|
-
def initialize(record2_id: "")
|
1164
|
+
def initialize(_from_message: false, record2_id: "")
|
1165
|
+
@_from_message = _from_message
|
1130
1166
|
super
|
1131
1167
|
self.record2_id = record2_id
|
1132
1168
|
end
|
@@ -1157,7 +1193,8 @@ module Schemas
|
|
1157
1193
|
attr_accessor :record3_id
|
1158
1194
|
|
1159
1195
|
# @override
|
1160
|
-
def initialize(record3_id: 0.0)
|
1196
|
+
def initialize(_from_message: false, record3_id: 0.0)
|
1197
|
+
@_from_message = _from_message
|
1161
1198
|
super
|
1162
1199
|
self.record3_id = record3_id
|
1163
1200
|
end
|
@@ -1188,7 +1225,8 @@ module Schemas
|
|
1188
1225
|
attr_accessor :record4_id
|
1189
1226
|
|
1190
1227
|
# @override
|
1191
|
-
def initialize(record4_id: 0)
|
1228
|
+
def initialize(_from_message: false, record4_id: 0)
|
1229
|
+
@_from_message = _from_message
|
1192
1230
|
super
|
1193
1231
|
self.record4_id = record4_id
|
1194
1232
|
end
|
@@ -1244,9 +1282,10 @@ module Schemas
|
|
1244
1282
|
end
|
1245
1283
|
|
1246
1284
|
# @override
|
1247
|
-
def initialize(test_id: "",
|
1285
|
+
def initialize(_from_message: false, test_id: "",
|
1248
1286
|
test_long: nil,
|
1249
1287
|
test_union_type: nil)
|
1288
|
+
@_from_message = _from_message
|
1250
1289
|
super
|
1251
1290
|
self.test_id = test_id
|
1252
1291
|
self.test_long = test_long
|
@@ -1297,11 +1336,12 @@ module Schemas
|
|
1297
1336
|
attr_accessor :timestamp
|
1298
1337
|
|
1299
1338
|
# @override
|
1300
|
-
def initialize(id: nil,
|
1339
|
+
def initialize(_from_message: false, id: nil,
|
1301
1340
|
test_id: nil,
|
1302
1341
|
some_int: nil,
|
1303
1342
|
message_id: nil,
|
1304
1343
|
timestamp: nil)
|
1344
|
+
@_from_message = _from_message
|
1305
1345
|
super
|
1306
1346
|
self.id = id
|
1307
1347
|
self.test_id = test_id
|
@@ -1348,7 +1388,8 @@ module Schemas
|
|
1348
1388
|
attr_accessor :update_request_id
|
1349
1389
|
|
1350
1390
|
# @override
|
1351
|
-
def initialize(update_request_id: nil)
|
1391
|
+
def initialize(_from_message: false, update_request_id: nil)
|
1392
|
+
@_from_message = _from_message
|
1352
1393
|
super
|
1353
1394
|
self.update_request_id = update_request_id
|
1354
1395
|
end
|
@@ -1387,7 +1428,8 @@ module Schemas
|
|
1387
1428
|
attr_accessor :update_response_id
|
1388
1429
|
|
1389
1430
|
# @override
|
1390
|
-
def initialize(update_response_id: nil)
|
1431
|
+
def initialize(_from_message: false, update_response_id: nil)
|
1432
|
+
@_from_message = _from_message
|
1391
1433
|
super
|
1392
1434
|
self.update_response_id = update_response_id
|
1393
1435
|
end
|
@@ -1442,7 +1484,7 @@ module Schemas
|
|
1442
1484
|
attr_accessor :created_at
|
1443
1485
|
|
1444
1486
|
# @override
|
1445
|
-
def initialize(id: nil,
|
1487
|
+
def initialize(_from_message: false, id: nil,
|
1446
1488
|
wibble_id: nil,
|
1447
1489
|
name: nil,
|
1448
1490
|
floop: nil,
|
@@ -1451,6 +1493,7 @@ module Schemas
|
|
1451
1493
|
birthday_optional: nil,
|
1452
1494
|
updated_at: nil,
|
1453
1495
|
created_at: nil)
|
1496
|
+
@_from_message = _from_message
|
1454
1497
|
super
|
1455
1498
|
self.id = id
|
1456
1499
|
self.wibble_id = wibble_id
|
@@ -1513,11 +1556,12 @@ module Schemas
|
|
1513
1556
|
attr_accessor :created_at
|
1514
1557
|
|
1515
1558
|
# @override
|
1516
|
-
def initialize(id: nil,
|
1559
|
+
def initialize(_from_message: false, id: nil,
|
1517
1560
|
widget_id: nil,
|
1518
1561
|
name: nil,
|
1519
1562
|
updated_at: nil,
|
1520
1563
|
created_at: nil)
|
1564
|
+
@_from_message = _from_message
|
1521
1565
|
super
|
1522
1566
|
self.id = id
|
1523
1567
|
self.widget_id = widget_id
|
@@ -1572,11 +1616,12 @@ module Schemas
|
|
1572
1616
|
attr_accessor :created_at
|
1573
1617
|
|
1574
1618
|
# @override
|
1575
|
-
def initialize(id: nil,
|
1619
|
+
def initialize(_from_message: false, id: nil,
|
1576
1620
|
widget_id: nil,
|
1577
1621
|
model_id: nil,
|
1578
1622
|
updated_at: nil,
|
1579
1623
|
created_at: nil)
|
1624
|
+
@_from_message = _from_message
|
1580
1625
|
super
|
1581
1626
|
self.id = id
|
1582
1627
|
self.widget_id = widget_id
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: deimos-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.
|
4
|
+
version: 2.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Orner
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-07-
|
11
|
+
date: 2025-07-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: avro_turf
|