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
@@ -16,7 +16,8 @@ module Schemas; module Com; 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 Com; 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 Com; 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 Com; 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
|
{
|
@@ -180,10 +175,11 @@ module Schemas; module Com; module MyNamespace
|
|
180
175
|
attr_accessor :some_optional_int
|
181
176
|
|
182
177
|
# @override
|
183
|
-
def initialize(some_int: nil,
|
178
|
+
def initialize(_from_message: false, some_int: nil,
|
184
179
|
some_float: nil,
|
185
180
|
some_string: nil,
|
186
181
|
some_optional_int: nil)
|
182
|
+
@_from_message = _from_message
|
187
183
|
super
|
188
184
|
self.some_int = some_int
|
189
185
|
self.some_float = some_float
|
@@ -239,11 +235,12 @@ module Schemas; module Com; module MyNamespace
|
|
239
235
|
end
|
240
236
|
|
241
237
|
# @override
|
242
|
-
def initialize(test_id: nil,
|
238
|
+
def initialize(_from_message: false, test_id: nil,
|
243
239
|
test_float: nil,
|
244
240
|
test_array: nil,
|
245
241
|
some_nested_record: nil,
|
246
242
|
some_optional_record: nil)
|
243
|
+
@_from_message = _from_message
|
247
244
|
super
|
248
245
|
self.test_id = test_id
|
249
246
|
self.test_float = test_float
|
@@ -292,30 +289,19 @@ module Schemas; module Com; module MyNamespace
|
|
292
289
|
# Autogenerated Schema for Record at com.my-namespace.MySchema
|
293
290
|
class MySchema < Deimos::SchemaClass::Record
|
294
291
|
|
295
|
-
### Attribute Readers ###
|
296
|
-
# @return [MySchemaKey]
|
297
|
-
attr_reader :payload_key
|
298
|
-
|
299
292
|
### Attribute Accessors ###
|
300
293
|
# @return [String]
|
301
294
|
attr_accessor :test_id
|
302
295
|
# @return [Integer]
|
303
296
|
attr_accessor :some_int
|
304
297
|
|
305
|
-
### Attribute Writers ###
|
306
|
-
# @return [MySchemaKey]
|
307
|
-
def payload_key=(value)
|
308
|
-
@payload_key = MySchemaKey.initialize_from_value(value, from_message: self._from_message)
|
309
|
-
end
|
310
|
-
|
311
298
|
# @override
|
312
|
-
def initialize(test_id: nil,
|
313
|
-
some_int: nil
|
314
|
-
|
299
|
+
def initialize(_from_message: false, test_id: nil,
|
300
|
+
some_int: nil)
|
301
|
+
@_from_message = _from_message
|
315
302
|
super
|
316
303
|
self.test_id = test_id
|
317
304
|
self.some_int = some_int
|
318
|
-
self.payload_key = payload_key
|
319
305
|
end
|
320
306
|
|
321
307
|
# @override
|
@@ -328,19 +314,11 @@ module Schemas; module Com; module MyNamespace
|
|
328
314
|
'com.my-namespace'
|
329
315
|
end
|
330
316
|
|
331
|
-
def self.tombstone(key)
|
332
|
-
record = self.allocate
|
333
|
-
record.tombstone_key = MySchemaKey.initialize_from_value(key, from_message: self._from_message)
|
334
|
-
record.payload_key = key
|
335
|
-
record
|
336
|
-
end
|
337
|
-
|
338
317
|
# @override
|
339
318
|
def as_json(_opts={})
|
340
319
|
{
|
341
320
|
'test_id' => @test_id,
|
342
|
-
'some_int' => @some_int
|
343
|
-
'payload_key' => @payload_key&.as_json
|
321
|
+
'some_int' => @some_int
|
344
322
|
}
|
345
323
|
end
|
346
324
|
end
|
@@ -363,8 +341,9 @@ module Schemas; module Com; module MyNamespace
|
|
363
341
|
attr_accessor :part_two
|
364
342
|
|
365
343
|
# @override
|
366
|
-
def initialize(part_one: nil,
|
344
|
+
def initialize(_from_message: false, part_one: nil,
|
367
345
|
part_two: nil)
|
346
|
+
@_from_message = _from_message
|
368
347
|
super
|
369
348
|
self.part_one = part_one
|
370
349
|
self.part_two = part_two
|
@@ -405,7 +384,8 @@ module Schemas; module Com; module MyNamespace
|
|
405
384
|
attr_accessor :id
|
406
385
|
|
407
386
|
# @override
|
408
|
-
def initialize(id: nil)
|
387
|
+
def initialize(_from_message: false, id: nil)
|
388
|
+
@_from_message = _from_message
|
409
389
|
super
|
410
390
|
self.id = id
|
411
391
|
end
|
@@ -444,7 +424,8 @@ module Schemas; module Com; module MyNamespace
|
|
444
424
|
attr_accessor :test_id
|
445
425
|
|
446
426
|
# @override
|
447
|
-
def initialize(test_id: nil)
|
427
|
+
def initialize(_from_message: false, test_id: nil)
|
428
|
+
@_from_message = _from_message
|
448
429
|
super
|
449
430
|
self.test_id = test_id
|
450
431
|
end
|
@@ -485,8 +466,9 @@ module Schemas; module Com; module MyNamespace
|
|
485
466
|
attr_accessor :some_bool
|
486
467
|
|
487
468
|
# @override
|
488
|
-
def initialize(test_id: nil,
|
469
|
+
def initialize(_from_message: false, test_id: nil,
|
489
470
|
some_bool: nil)
|
471
|
+
@_from_message = _from_message
|
490
472
|
super
|
491
473
|
self.test_id = test_id
|
492
474
|
self.some_bool = some_bool
|
@@ -531,7 +513,8 @@ module Schemas; module Com; module MyNamespace
|
|
531
513
|
attr_accessor :property
|
532
514
|
|
533
515
|
# @override
|
534
|
-
def initialize(property: nil)
|
516
|
+
def initialize(_from_message: false, property: nil)
|
517
|
+
@_from_message = _from_message
|
535
518
|
super
|
536
519
|
self.property = property
|
537
520
|
end
|
@@ -568,7 +551,8 @@ module Schemas; module Com; module MyNamespace
|
|
568
551
|
end
|
569
552
|
|
570
553
|
# @override
|
571
|
-
def initialize(properties: {})
|
554
|
+
def initialize(_from_message: false, properties: {})
|
555
|
+
@_from_message = _from_message
|
572
556
|
super
|
573
557
|
self.properties = properties
|
574
558
|
end
|
@@ -611,7 +595,8 @@ module Schemas; module Com; module MyNamespace
|
|
611
595
|
attr_accessor :a_record_field
|
612
596
|
|
613
597
|
# @override
|
614
|
-
def initialize(a_record_field: nil)
|
598
|
+
def initialize(_from_message: false, a_record_field: nil)
|
599
|
+
@_from_message = _from_message
|
615
600
|
super
|
616
601
|
self.a_record_field = a_record_field
|
617
602
|
end
|
@@ -741,7 +726,7 @@ module Schemas; module Com; module MyNamespace
|
|
741
726
|
end
|
742
727
|
|
743
728
|
# @override
|
744
|
-
def initialize(test_id: nil,
|
729
|
+
def initialize(_from_message: false, test_id: nil,
|
745
730
|
test_float: nil,
|
746
731
|
test_string_array: ["test"],
|
747
732
|
test_int_array: [123],
|
@@ -754,6 +739,7 @@ module Schemas; module Com; module MyNamespace
|
|
754
739
|
some_enum_array: nil,
|
755
740
|
some_optional_enum: nil,
|
756
741
|
some_enum_with_default: "sym6")
|
742
|
+
@_from_message = _from_message
|
757
743
|
super
|
758
744
|
self.test_id = test_id
|
759
745
|
self.test_float = test_float
|
@@ -824,11 +810,12 @@ module Schemas; module Com; module MyNamespace
|
|
824
810
|
attr_accessor :timestamp
|
825
811
|
|
826
812
|
# @override
|
827
|
-
def initialize(test_id: nil,
|
813
|
+
def initialize(_from_message: false, test_id: nil,
|
828
814
|
updated_at: nil,
|
829
815
|
some_int: nil,
|
830
816
|
some_datetime_int: nil,
|
831
817
|
timestamp: nil)
|
818
|
+
@_from_message = _from_message
|
832
819
|
super
|
833
820
|
self.test_id = test_id
|
834
821
|
self.updated_at = updated_at
|
@@ -881,10 +868,11 @@ module Schemas; module Com; module MyNamespace
|
|
881
868
|
attr_accessor :timestamp
|
882
869
|
|
883
870
|
# @override
|
884
|
-
def initialize(test_id: nil,
|
871
|
+
def initialize(_from_message: false, test_id: nil,
|
885
872
|
some_int: nil,
|
886
873
|
message_id: nil,
|
887
874
|
timestamp: nil)
|
875
|
+
@_from_message = _from_message
|
888
876
|
super
|
889
877
|
self.test_id = test_id
|
890
878
|
self.some_int = some_int
|
@@ -933,9 +921,10 @@ module Schemas; module Com; module MyNamespace
|
|
933
921
|
attr_accessor :title
|
934
922
|
|
935
923
|
# @override
|
936
|
-
def initialize(test_id: nil,
|
924
|
+
def initialize(_from_message: false, test_id: nil,
|
937
925
|
some_int: nil,
|
938
926
|
title: nil)
|
927
|
+
@_from_message = _from_message
|
939
928
|
super
|
940
929
|
self.test_id = test_id
|
941
930
|
self.some_int = some_int
|
@@ -984,8 +973,9 @@ module Schemas; module Com; module MyNamespace
|
|
984
973
|
attr_accessor :record1_id
|
985
974
|
|
986
975
|
# @override
|
987
|
-
def initialize(record1_map: {},
|
976
|
+
def initialize(_from_message: false, record1_map: {},
|
988
977
|
record1_id: 0)
|
978
|
+
@_from_message = _from_message
|
989
979
|
super
|
990
980
|
self.record1_map = record1_map
|
991
981
|
self.record1_id = record1_id
|
@@ -1018,7 +1008,8 @@ module Schemas; module Com; module MyNamespace
|
|
1018
1008
|
attr_accessor :record2_id
|
1019
1009
|
|
1020
1010
|
# @override
|
1021
|
-
def initialize(record2_id: "")
|
1011
|
+
def initialize(_from_message: false, record2_id: "")
|
1012
|
+
@_from_message = _from_message
|
1022
1013
|
super
|
1023
1014
|
self.record2_id = record2_id
|
1024
1015
|
end
|
@@ -1049,7 +1040,8 @@ module Schemas; module Com; module MyNamespace
|
|
1049
1040
|
attr_accessor :record3_id
|
1050
1041
|
|
1051
1042
|
# @override
|
1052
|
-
def initialize(record3_id: 0.0)
|
1043
|
+
def initialize(_from_message: false, record3_id: 0.0)
|
1044
|
+
@_from_message = _from_message
|
1053
1045
|
super
|
1054
1046
|
self.record3_id = record3_id
|
1055
1047
|
end
|
@@ -1080,7 +1072,8 @@ module Schemas; module Com; module MyNamespace
|
|
1080
1072
|
attr_accessor :record4_id
|
1081
1073
|
|
1082
1074
|
# @override
|
1083
|
-
def initialize(record4_id: 0)
|
1075
|
+
def initialize(_from_message: false, record4_id: 0)
|
1076
|
+
@_from_message = _from_message
|
1084
1077
|
super
|
1085
1078
|
self.record4_id = record4_id
|
1086
1079
|
end
|
@@ -1136,9 +1129,10 @@ module Schemas; module Com; module MyNamespace
|
|
1136
1129
|
end
|
1137
1130
|
|
1138
1131
|
# @override
|
1139
|
-
def initialize(test_id: "",
|
1132
|
+
def initialize(_from_message: false, test_id: "",
|
1140
1133
|
test_long: nil,
|
1141
1134
|
test_union_type: nil)
|
1135
|
+
@_from_message = _from_message
|
1142
1136
|
super
|
1143
1137
|
self.test_id = test_id
|
1144
1138
|
self.test_long = test_long
|
@@ -1189,11 +1183,12 @@ module Schemas; module Com; module MyNamespace
|
|
1189
1183
|
attr_accessor :timestamp
|
1190
1184
|
|
1191
1185
|
# @override
|
1192
|
-
def initialize(id: nil,
|
1186
|
+
def initialize(_from_message: false, id: nil,
|
1193
1187
|
test_id: nil,
|
1194
1188
|
some_int: nil,
|
1195
1189
|
message_id: nil,
|
1196
1190
|
timestamp: nil)
|
1191
|
+
@_from_message = _from_message
|
1197
1192
|
super
|
1198
1193
|
self.id = id
|
1199
1194
|
self.test_id = test_id
|
@@ -1242,8 +1237,9 @@ module Schemas; module Com; module MyNamespace; module MySuborg
|
|
1242
1237
|
attr_accessor :some_int
|
1243
1238
|
|
1244
1239
|
# @override
|
1245
|
-
def initialize(test_id: nil,
|
1240
|
+
def initialize(_from_message: false, test_id: nil,
|
1246
1241
|
some_int: nil)
|
1242
|
+
@_from_message = _from_message
|
1247
1243
|
super
|
1248
1244
|
self.test_id = test_id
|
1249
1245
|
self.some_int = some_int
|
@@ -1284,7 +1280,8 @@ module Schemas; module Com; 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 Com; 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 Com; 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 Com; 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 Com; 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 Com; 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 Com; 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 Com; 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 Com; 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 Com; 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
|