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.
Files changed (49) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +6 -1
  3. data/README.md +1 -1
  4. data/karafka.rb +71 -1
  5. data/lib/deimos/schema_backends/avro_schema_coercer.rb +2 -0
  6. data/lib/deimos/version.rb +1 -1
  7. data/lib/generators/deimos/schema_class_generator.rb +10 -14
  8. data/regenerate_test_schema_classes.rb +0 -66
  9. data/spec/consumer_spec.rb +25 -4
  10. data/spec/schemas/my_namespace/generated.rb +6 -4
  11. data/spec/schemas/my_namespace/my_long_namespace_schema.rb +2 -1
  12. data/spec/schemas/my_namespace/my_nested_schema.rb +6 -4
  13. data/spec/schemas/my_namespace/my_schema.rb +4 -3
  14. data/spec/schemas/my_namespace/my_schema_compound_key.rb +2 -1
  15. data/spec/schemas/my_namespace/my_schema_id_key.rb +2 -1
  16. data/spec/schemas/my_namespace/my_schema_key.rb +2 -1
  17. data/spec/schemas/my_namespace/my_schema_with_boolean.rb +2 -1
  18. data/spec/schemas/my_namespace/my_schema_with_circular_reference.rb +5 -3
  19. data/spec/schemas/my_namespace/my_schema_with_complex_type.rb +11 -9
  20. data/spec/schemas/my_namespace/my_schema_with_date_time.rb +2 -1
  21. data/spec/schemas/my_namespace/my_schema_with_id.rb +2 -1
  22. data/spec/schemas/my_namespace/my_schema_with_title.rb +47 -0
  23. data/spec/schemas/my_namespace/my_schema_with_union_type.rb +12 -7
  24. data/spec/schemas/my_namespace/my_schema_with_unique_id.rb +2 -1
  25. data/spec/schemas/my_namespace/my_updated_schema.rb +2 -1
  26. data/spec/schemas/my_namespace/request/create_topic.rb +2 -1
  27. data/spec/schemas/my_namespace/request/index.rb +2 -1
  28. data/spec/schemas/my_namespace/request/update_request.rb +2 -1
  29. data/spec/schemas/my_namespace/response/create_topic.rb +2 -1
  30. data/spec/schemas/my_namespace/response/index.rb +2 -1
  31. data/spec/schemas/my_namespace/response/update_response.rb +2 -1
  32. data/spec/schemas/my_namespace/wibble.rb +2 -1
  33. data/spec/schemas/my_namespace/widget.rb +2 -1
  34. data/spec/schemas/my_namespace/widget_the_second.rb +2 -1
  35. data/spec/snapshots/consumers-no-nest.snap +65 -36
  36. data/spec/snapshots/consumers.snap +67 -37
  37. data/spec/snapshots/consumers_and_producers-no-nest.snap +60 -58
  38. data/spec/snapshots/consumers_and_producers.snap +62 -59
  39. data/spec/snapshots/consumers_circular-no-nest.snap +65 -36
  40. data/spec/snapshots/consumers_circular.snap +67 -37
  41. data/spec/snapshots/consumers_complex_types-no-nest.snap +65 -36
  42. data/spec/snapshots/consumers_complex_types.snap +67 -37
  43. data/spec/snapshots/consumers_nested-no-nest.snap +58 -29
  44. data/spec/snapshots/consumers_nested.snap +60 -30
  45. data/spec/snapshots/namespace_folders.snap +66 -61
  46. data/spec/snapshots/namespace_map.snap +66 -61
  47. data/spec/snapshots/producers_with_key-no-nest.snap +67 -51
  48. data/spec/snapshots/producers_with_key.snap +69 -52
  49. metadata +6 -4
@@ -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
@@ -130,7 +132,7 @@ module Schemas
130
132
  end
131
133
 
132
134
  # @override
133
- def initialize(a_string: nil,
135
+ def initialize(_from_message: false, a_string: nil,
134
136
  a_int: nil,
135
137
  a_long: nil,
136
138
  a_float: nil,
@@ -142,6 +144,7 @@ module Schemas
142
144
  timestamp: nil,
143
145
  message_id: nil,
144
146
  a_record: nil)
147
+ @_from_message = _from_message
145
148
  super
146
149
  self.a_string = a_string
147
150
  self.a_int = a_int
@@ -202,7 +205,8 @@ module Schemas
202
205
  attr_accessor :response_id
203
206
 
204
207
  # @override
205
- def initialize(response_id: nil)
208
+ def initialize(_from_message: false, response_id: nil)
209
+ @_from_message = _from_message
206
210
  super
207
211
  self.response_id = response_id
208
212
  end
@@ -243,8 +247,9 @@ module Schemas
243
247
  attr_accessor :some_int
244
248
 
245
249
  # @override
246
- def initialize(test_id: nil,
250
+ def initialize(_from_message: false, test_id: nil,
247
251
  some_int: nil)
252
+ @_from_message = _from_message
248
253
  super
249
254
  self.test_id = test_id
250
255
  self.some_int = some_int
@@ -295,10 +300,11 @@ module Schemas
295
300
  attr_accessor :some_optional_int
296
301
 
297
302
  # @override
298
- def initialize(some_int: nil,
303
+ def initialize(_from_message: false, some_int: nil,
299
304
  some_float: nil,
300
305
  some_string: nil,
301
306
  some_optional_int: nil)
307
+ @_from_message = _from_message
302
308
  super
303
309
  self.some_int = some_int
304
310
  self.some_float = some_float
@@ -354,11 +360,12 @@ module Schemas
354
360
  end
355
361
 
356
362
  # @override
357
- def initialize(test_id: nil,
363
+ def initialize(_from_message: false, test_id: nil,
358
364
  test_float: nil,
359
365
  test_array: nil,
360
366
  some_nested_record: nil,
361
367
  some_optional_record: nil)
368
+ @_from_message = _from_message
362
369
  super
363
370
  self.test_id = test_id
364
371
  self.test_float = test_float
@@ -414,8 +421,9 @@ module Schemas
414
421
  attr_accessor :some_int
415
422
 
416
423
  # @override
417
- def initialize(test_id: nil,
424
+ def initialize(_from_message: false, test_id: nil,
418
425
  some_int: nil)
426
+ @_from_message = _from_message
419
427
  super
420
428
  self.test_id = test_id
421
429
  self.some_int = some_int
@@ -458,8 +466,9 @@ module Schemas
458
466
  attr_accessor :part_two
459
467
 
460
468
  # @override
461
- def initialize(part_one: nil,
469
+ def initialize(_from_message: false, part_one: nil,
462
470
  part_two: nil)
471
+ @_from_message = _from_message
463
472
  super
464
473
  self.part_one = part_one
465
474
  self.part_two = part_two
@@ -500,7 +509,8 @@ module Schemas
500
509
  attr_accessor :id
501
510
 
502
511
  # @override
503
- def initialize(id: nil)
512
+ def initialize(_from_message: false, id: nil)
513
+ @_from_message = _from_message
504
514
  super
505
515
  self.id = id
506
516
  end
@@ -539,7 +549,8 @@ module Schemas
539
549
  attr_accessor :test_id
540
550
 
541
551
  # @override
542
- def initialize(test_id: nil)
552
+ def initialize(_from_message: false, test_id: nil)
553
+ @_from_message = _from_message
543
554
  super
544
555
  self.test_id = test_id
545
556
  end
@@ -580,8 +591,9 @@ module Schemas
580
591
  attr_accessor :some_bool
581
592
 
582
593
  # @override
583
- def initialize(test_id: nil,
594
+ def initialize(_from_message: false, test_id: nil,
584
595
  some_bool: nil)
596
+ @_from_message = _from_message
585
597
  super
586
598
  self.test_id = test_id
587
599
  self.some_bool = some_bool
@@ -626,7 +638,8 @@ module Schemas
626
638
  attr_accessor :property
627
639
 
628
640
  # @override
629
- def initialize(property: nil)
641
+ def initialize(_from_message: false, property: nil)
642
+ @_from_message = _from_message
630
643
  super
631
644
  self.property = property
632
645
  end
@@ -663,7 +676,8 @@ module Schemas
663
676
  end
664
677
 
665
678
  # @override
666
- def initialize(properties: {})
679
+ def initialize(_from_message: false, properties: {})
680
+ @_from_message = _from_message
667
681
  super
668
682
  self.properties = properties
669
683
  end
@@ -706,7 +720,8 @@ module Schemas
706
720
  attr_accessor :a_record_field
707
721
 
708
722
  # @override
709
- def initialize(a_record_field: nil)
723
+ def initialize(_from_message: false, a_record_field: nil)
724
+ @_from_message = _from_message
710
725
  super
711
726
  self.a_record_field = a_record_field
712
727
  end
@@ -836,7 +851,7 @@ module Schemas
836
851
  end
837
852
 
838
853
  # @override
839
- def initialize(test_id: nil,
854
+ def initialize(_from_message: false, test_id: nil,
840
855
  test_float: nil,
841
856
  test_string_array: ["test"],
842
857
  test_int_array: [123],
@@ -849,6 +864,7 @@ module Schemas
849
864
  some_enum_array: nil,
850
865
  some_optional_enum: nil,
851
866
  some_enum_with_default: "sym6")
867
+ @_from_message = _from_message
852
868
  super
853
869
  self.test_id = test_id
854
870
  self.test_float = test_float
@@ -919,11 +935,12 @@ module Schemas
919
935
  attr_accessor :timestamp
920
936
 
921
937
  # @override
922
- def initialize(test_id: nil,
938
+ def initialize(_from_message: false, test_id: nil,
923
939
  updated_at: nil,
924
940
  some_int: nil,
925
941
  some_datetime_int: nil,
926
942
  timestamp: nil)
943
+ @_from_message = _from_message
927
944
  super
928
945
  self.test_id = test_id
929
946
  self.updated_at = updated_at
@@ -976,10 +993,11 @@ module Schemas
976
993
  attr_accessor :timestamp
977
994
 
978
995
  # @override
979
- def initialize(test_id: nil,
996
+ def initialize(_from_message: false, test_id: nil,
980
997
  some_int: nil,
981
998
  message_id: nil,
982
999
  timestamp: nil)
1000
+ @_from_message = _from_message
983
1001
  super
984
1002
  self.test_id = test_id
985
1003
  self.some_int = some_int
@@ -1028,9 +1046,10 @@ module Schemas
1028
1046
  attr_accessor :title
1029
1047
 
1030
1048
  # @override
1031
- def initialize(test_id: nil,
1049
+ def initialize(_from_message: false, test_id: nil,
1032
1050
  some_int: nil,
1033
1051
  title: nil)
1052
+ @_from_message = _from_message
1034
1053
  super
1035
1054
  self.test_id = test_id
1036
1055
  self.some_int = some_int
@@ -1079,8 +1098,9 @@ module Schemas
1079
1098
  attr_accessor :record1_id
1080
1099
 
1081
1100
  # @override
1082
- def initialize(record1_map: {},
1101
+ def initialize(_from_message: false, record1_map: {},
1083
1102
  record1_id: 0)
1103
+ @_from_message = _from_message
1084
1104
  super
1085
1105
  self.record1_map = record1_map
1086
1106
  self.record1_id = record1_id
@@ -1113,7 +1133,8 @@ module Schemas
1113
1133
  attr_accessor :record2_id
1114
1134
 
1115
1135
  # @override
1116
- def initialize(record2_id: "")
1136
+ def initialize(_from_message: false, record2_id: "")
1137
+ @_from_message = _from_message
1117
1138
  super
1118
1139
  self.record2_id = record2_id
1119
1140
  end
@@ -1144,7 +1165,8 @@ module Schemas
1144
1165
  attr_accessor :record3_id
1145
1166
 
1146
1167
  # @override
1147
- def initialize(record3_id: 0.0)
1168
+ def initialize(_from_message: false, record3_id: 0.0)
1169
+ @_from_message = _from_message
1148
1170
  super
1149
1171
  self.record3_id = record3_id
1150
1172
  end
@@ -1175,7 +1197,8 @@ module Schemas
1175
1197
  attr_accessor :record4_id
1176
1198
 
1177
1199
  # @override
1178
- def initialize(record4_id: 0)
1200
+ def initialize(_from_message: false, record4_id: 0)
1201
+ @_from_message = _from_message
1179
1202
  super
1180
1203
  self.record4_id = record4_id
1181
1204
  end
@@ -1231,9 +1254,10 @@ module Schemas
1231
1254
  end
1232
1255
 
1233
1256
  # @override
1234
- def initialize(test_id: "",
1257
+ def initialize(_from_message: false, test_id: "",
1235
1258
  test_long: nil,
1236
1259
  test_union_type: nil)
1260
+ @_from_message = _from_message
1237
1261
  super
1238
1262
  self.test_id = test_id
1239
1263
  self.test_long = test_long
@@ -1284,11 +1308,12 @@ module Schemas
1284
1308
  attr_accessor :timestamp
1285
1309
 
1286
1310
  # @override
1287
- def initialize(id: nil,
1311
+ def initialize(_from_message: false, id: nil,
1288
1312
  test_id: nil,
1289
1313
  some_int: nil,
1290
1314
  message_id: nil,
1291
1315
  timestamp: nil)
1316
+ @_from_message = _from_message
1292
1317
  super
1293
1318
  self.id = id
1294
1319
  self.test_id = test_id
@@ -1335,7 +1360,8 @@ module Schemas
1335
1360
  attr_accessor :update_request_id
1336
1361
 
1337
1362
  # @override
1338
- def initialize(update_request_id: nil)
1363
+ def initialize(_from_message: false, update_request_id: nil)
1364
+ @_from_message = _from_message
1339
1365
  super
1340
1366
  self.update_request_id = update_request_id
1341
1367
  end
@@ -1374,7 +1400,8 @@ module Schemas
1374
1400
  attr_accessor :update_response_id
1375
1401
 
1376
1402
  # @override
1377
- def initialize(update_response_id: nil)
1403
+ def initialize(_from_message: false, update_response_id: nil)
1404
+ @_from_message = _from_message
1378
1405
  super
1379
1406
  self.update_response_id = update_response_id
1380
1407
  end
@@ -1429,7 +1456,7 @@ module Schemas
1429
1456
  attr_accessor :created_at
1430
1457
 
1431
1458
  # @override
1432
- def initialize(id: nil,
1459
+ def initialize(_from_message: false, id: nil,
1433
1460
  wibble_id: nil,
1434
1461
  name: nil,
1435
1462
  floop: nil,
@@ -1438,6 +1465,7 @@ module Schemas
1438
1465
  birthday_optional: nil,
1439
1466
  updated_at: nil,
1440
1467
  created_at: nil)
1468
+ @_from_message = _from_message
1441
1469
  super
1442
1470
  self.id = id
1443
1471
  self.wibble_id = wibble_id
@@ -1500,11 +1528,12 @@ module Schemas
1500
1528
  attr_accessor :created_at
1501
1529
 
1502
1530
  # @override
1503
- def initialize(id: nil,
1531
+ def initialize(_from_message: false, id: nil,
1504
1532
  widget_id: nil,
1505
1533
  name: nil,
1506
1534
  updated_at: nil,
1507
1535
  created_at: nil)
1536
+ @_from_message = _from_message
1508
1537
  super
1509
1538
  self.id = id
1510
1539
  self.widget_id = widget_id
@@ -1559,11 +1588,12 @@ module Schemas
1559
1588
  attr_accessor :created_at
1560
1589
 
1561
1590
  # @override
1562
- def initialize(id: nil,
1591
+ def initialize(_from_message: false, id: nil,
1563
1592
  widget_id: nil,
1564
1593
  model_id: nil,
1565
1594
  updated_at: nil,
1566
1595
  created_at: nil)
1596
+ @_from_message = _from_message
1567
1597
  super
1568
1598
  self.id = id
1569
1599
  self.widget_id = widget_id