deimos-ruby 1.16.2 → 1.16.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 (48) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +4 -0
  3. data/README.md +2 -0
  4. data/lib/deimos/schema_class/record.rb +7 -1
  5. data/lib/deimos/version.rb +1 -1
  6. data/lib/generators/deimos/schema_class/templates/schema_record.rb.tt +13 -5
  7. data/lib/generators/deimos/schema_class_generator.rb +40 -22
  8. data/regenerate_test_schema_classes.rb +68 -0
  9. data/spec/generators/schema_class/my_schema_spec.rb +16 -0
  10. data/spec/generators/schema_class/my_schema_with_circular_reference_spec.rb +1 -1
  11. data/spec/generators/schema_class/my_schema_with_complex_types_spec.rb +32 -24
  12. data/spec/producer_spec.rb +11 -11
  13. data/spec/schemas/{generated.rb → my_namespace/generated.rb} +28 -32
  14. data/spec/schemas/{my_nested_schema.rb → my_namespace/my_nested_schema.rb} +23 -16
  15. data/spec/schemas/{my_schema.rb → my_namespace/my_schema.rb} +12 -5
  16. data/spec/schemas/my_namespace/my_schema_compound_key.rb +41 -0
  17. data/spec/schemas/my_namespace/my_schema_id_key.rb +36 -0
  18. data/spec/schemas/{my_schema_key.rb → my_namespace/my_schema_key.rb} +3 -3
  19. data/spec/schemas/my_namespace/my_schema_with_boolean.rb +41 -0
  20. data/spec/schemas/{my_schema_with_circular_reference.rb → my_namespace/my_schema_with_circular_reference.rb} +15 -10
  21. data/spec/schemas/{my_schema_with_complex_type.rb → my_namespace/my_schema_with_complex_type.rb} +34 -49
  22. data/spec/schemas/my_namespace/my_schema_with_date_time.rb +56 -0
  23. data/spec/schemas/my_namespace/my_schema_with_id.rb +51 -0
  24. data/spec/schemas/my_namespace/my_schema_with_unique_id.rb +56 -0
  25. data/spec/schemas/my_namespace/wibble.rb +76 -0
  26. data/spec/schemas/my_namespace/widget.rb +56 -0
  27. data/spec/schemas/my_namespace/widget_the_second.rb +56 -0
  28. data/spec/schemas/request/create_topic.rb +36 -0
  29. data/spec/schemas/request/index.rb +36 -0
  30. data/spec/schemas/request/update_request.rb +36 -0
  31. data/spec/schemas/response/create_topic.rb +36 -0
  32. data/spec/schemas/response/index.rb +36 -0
  33. data/spec/schemas/response/update_response.rb +36 -0
  34. data/spec/snapshots/consumers-no-nest.snap +93 -86
  35. data/spec/snapshots/consumers.snap +94 -87
  36. data/spec/snapshots/consumers_and_producers-no-nest.snap +108 -87
  37. data/spec/snapshots/consumers_and_producers.snap +109 -88
  38. data/spec/snapshots/consumers_circular-no-nest.snap +93 -86
  39. data/spec/snapshots/consumers_circular.snap +94 -87
  40. data/spec/snapshots/consumers_complex_types-no-nest.snap +93 -86
  41. data/spec/snapshots/consumers_complex_types.snap +94 -87
  42. data/spec/snapshots/consumers_nested-no-nest.snap +93 -86
  43. data/spec/snapshots/consumers_nested.snap +94 -87
  44. data/spec/snapshots/namespace_folders.snap +111 -90
  45. data/spec/snapshots/producers_with_key-no-nest.snap +94 -87
  46. data/spec/snapshots/producers_with_key.snap +95 -88
  47. data/spec/spec_helper.rb +2 -1
  48. metadata +48 -15
@@ -8,7 +8,7 @@ module Schemas
8
8
  class ARecord < Deimos::SchemaClass::Record
9
9
 
10
10
  ### Attribute Accessors ###
11
- # @param value [String]
11
+ # @return [String]
12
12
  attr_accessor :a_record_field
13
13
 
14
14
  # @override
@@ -85,7 +85,7 @@ module Schemas
85
85
  class CreateTopic < Deimos::SchemaClass::Record
86
86
 
87
87
  ### Attribute Accessors ###
88
- # @param value [String]
88
+ # @return [String]
89
89
  attr_accessor :response_id
90
90
 
91
91
  # @override
@@ -130,34 +130,34 @@ module Schemas
130
130
  attr_reader :a_record
131
131
 
132
132
  ### Attribute Accessors ###
133
- # @param value [String]
133
+ # @return [String]
134
134
  attr_accessor :a_string
135
- # @param value [Integer]
135
+ # @return [Integer]
136
136
  attr_accessor :a_int
137
- # @param value [Integer]
137
+ # @return [Integer]
138
138
  attr_accessor :a_long
139
- # @param value [Float]
139
+ # @return [Float]
140
140
  attr_accessor :a_float
141
- # @param value [Float]
141
+ # @return [Float]
142
142
  attr_accessor :a_double
143
- # @param value [nil, Integer]
143
+ # @return [nil, Integer]
144
144
  attr_accessor :an_optional_int
145
- # @param values [Array<Integer>]
145
+ # @return [Array<Integer>]
146
146
  attr_accessor :an_array
147
- # @param values [Hash<String, String>]
147
+ # @return [Hash<String, String>]
148
148
  attr_accessor :a_map
149
- # @param value [String]
149
+ # @return [String]
150
150
  attr_accessor :timestamp
151
- # @param value [String]
151
+ # @return [String]
152
152
  attr_accessor :message_id
153
153
 
154
154
  ### Attribute Writers ###
155
- # @param value [AnEnum]
155
+ # @return [AnEnum]
156
156
  def an_enum=(value)
157
157
  @an_enum = AnEnum.initialize_from_value(value)
158
158
  end
159
159
 
160
- # @param value [ARecord]
160
+ # @return [ARecord]
161
161
  def a_record=(value)
162
162
  @a_record = ARecord.initialize_from_value(value)
163
163
  end
@@ -231,7 +231,7 @@ module Schemas
231
231
  class Index < Deimos::SchemaClass::Record
232
232
 
233
233
  ### Attribute Accessors ###
234
- # @param value [String]
234
+ # @return [String]
235
235
  attr_accessor :response_id
236
236
 
237
237
  # @override
@@ -270,13 +270,13 @@ module Schemas
270
270
  class MyNestedRecord < Deimos::SchemaClass::Record
271
271
 
272
272
  ### Attribute Accessors ###
273
- # @param value [Integer]
273
+ # @return [Integer]
274
274
  attr_accessor :some_int
275
- # @param value [Float]
275
+ # @return [Float]
276
276
  attr_accessor :some_float
277
- # @param value [String]
277
+ # @return [String]
278
278
  attr_accessor :some_string
279
- # @param value [nil, Integer]
279
+ # @return [nil, Integer]
280
280
  attr_accessor :some_optional_int
281
281
 
282
282
  # @override
@@ -330,20 +330,20 @@ module Schemas
330
330
  attr_reader :some_optional_record
331
331
 
332
332
  ### Attribute Accessors ###
333
- # @param value [String]
333
+ # @return [String]
334
334
  attr_accessor :test_id
335
- # @param value [Float]
335
+ # @return [Float]
336
336
  attr_accessor :test_float
337
- # @param values [Array<String>]
337
+ # @return [Array<String>]
338
338
  attr_accessor :test_array
339
339
 
340
340
  ### Attribute Writers ###
341
- # @param value [MyNestedRecord]
341
+ # @return [MyNestedRecord]
342
342
  def some_nested_record=(value)
343
343
  @some_nested_record = MyNestedRecord.initialize_from_value(value)
344
344
  end
345
345
 
346
- # @param value [nil, MyNestedRecord]
346
+ # @return [nil, MyNestedRecord]
347
347
  def some_optional_record=(value)
348
348
  @some_optional_record = MyNestedRecord.initialize_from_value(value)
349
349
  end
@@ -400,13 +400,13 @@ module Schemas
400
400
  attr_reader :payload_key
401
401
 
402
402
  ### Attribute Accessors ###
403
- # @param value [String]
403
+ # @return [String]
404
404
  attr_accessor :test_id
405
- # @param value [Integer]
405
+ # @return [Integer]
406
406
  attr_accessor :some_int
407
407
 
408
408
  ### Attribute Writers ###
409
- # @param value [MySchemaKey]
409
+ # @return [MySchemaKey]
410
410
  def payload_key=(value)
411
411
  @payload_key = MySchemaKey.initialize_from_value(value)
412
412
  end
@@ -431,6 +431,13 @@ module Schemas
431
431
  'com.my-namespace'
432
432
  end
433
433
 
434
+ def self.tombstone(key)
435
+ record = self.new
436
+ record.tombstone_key = MySchemaKey.initialize_from_value(key)
437
+ record.payload_key = key
438
+ record
439
+ end
440
+
434
441
  # @override
435
442
  def as_json(_opts={})
436
443
  {
@@ -453,9 +460,9 @@ module Schemas
453
460
  class MySchemaCompoundKey < Deimos::SchemaClass::Record
454
461
 
455
462
  ### Attribute Accessors ###
456
- # @param value [String]
463
+ # @return [String]
457
464
  attr_accessor :part_one
458
- # @param value [String]
465
+ # @return [String]
459
466
  attr_accessor :part_two
460
467
 
461
468
  # @override
@@ -497,7 +504,7 @@ module Schemas
497
504
  class MySchemaIdKey < Deimos::SchemaClass::Record
498
505
 
499
506
  ### Attribute Accessors ###
500
- # @param value [Integer]
507
+ # @return [Integer]
501
508
  attr_accessor :id
502
509
 
503
510
  # @override
@@ -536,7 +543,7 @@ module Schemas
536
543
  class MySchemaKey < Deimos::SchemaClass::Record
537
544
 
538
545
  ### Attribute Accessors ###
539
- # @param value [String]
546
+ # @return [String]
540
547
  attr_accessor :test_id
541
548
 
542
549
  # @override
@@ -575,9 +582,9 @@ module Schemas
575
582
  class MySchemaWithBoolean < Deimos::SchemaClass::Record
576
583
 
577
584
  ### Attribute Accessors ###
578
- # @param value [String]
585
+ # @return [String]
579
586
  attr_accessor :test_id
580
- # @param value [Boolean]
587
+ # @return [Boolean]
581
588
  attr_accessor :some_bool
582
589
 
583
590
  # @override
@@ -623,9 +630,9 @@ module Schemas
623
630
  attr_reader :properties
624
631
 
625
632
  ### Attribute Writers ###
626
- # @param values [Hash<String, Property>]
633
+ # @return [Hash<String, Property>]
627
634
  def properties=(values)
628
- @properties = values.transform_values do |value|
635
+ @properties = values&.transform_values do |value|
629
636
  Property.initialize_from_value(value)
630
637
  end
631
638
  end
@@ -682,57 +689,57 @@ module Schemas
682
689
  attr_reader :some_enum_with_default
683
690
 
684
691
  ### Attribute Accessors ###
685
- # @param value [String]
692
+ # @return [String]
686
693
  attr_accessor :test_id
687
- # @param value [Float]
694
+ # @return [Float]
688
695
  attr_accessor :test_float
689
- # @param values [Array<String>]
696
+ # @return [Array<String>]
690
697
  attr_accessor :test_string_array
691
- # @param values [Array<Integer>]
698
+ # @return [Array<Integer>]
692
699
  attr_accessor :test_int_array
693
- # @param value [Integer, nil]
700
+ # @return [Integer, nil]
694
701
  attr_accessor :test_optional_int
695
- # @param values [Hash<String, Integer>]
702
+ # @return [Hash<String, Integer>]
696
703
  attr_accessor :some_integer_map
697
704
 
698
705
  ### Attribute Writers ###
699
- # @param value [ARecord]
706
+ # @return [ARecord]
700
707
  def some_record=(value)
701
708
  @some_record = ARecord.initialize_from_value(value)
702
709
  end
703
710
 
704
- # @param value [nil, ARecord]
711
+ # @return [nil, ARecord]
705
712
  def some_optional_record=(value)
706
713
  @some_optional_record = ARecord.initialize_from_value(value)
707
714
  end
708
715
 
709
- # @param values [Array<ARecord>]
716
+ # @return [Array<ARecord>]
710
717
  def some_record_array=(values)
711
- @some_record_array = values.map do |value|
718
+ @some_record_array = values&.map do |value|
712
719
  ARecord.initialize_from_value(value)
713
720
  end
714
721
  end
715
722
 
716
- # @param values [Hash<String, ARecord>]
723
+ # @return [Hash<String, ARecord>]
717
724
  def some_record_map=(values)
718
- @some_record_map = values.transform_values do |value|
725
+ @some_record_map = values&.transform_values do |value|
719
726
  ARecord.initialize_from_value(value)
720
727
  end
721
728
  end
722
729
 
723
- # @param values [Array<AnEnum>]
730
+ # @return [Array<AnEnum>]
724
731
  def some_enum_array=(values)
725
- @some_enum_array = values.map do |value|
732
+ @some_enum_array = values&.map do |value|
726
733
  AnEnum.initialize_from_value(value)
727
734
  end
728
735
  end
729
736
 
730
- # @param value [nil, AnotherEnum]
737
+ # @return [nil, AnotherEnum]
731
738
  def some_optional_enum=(value)
732
739
  @some_optional_enum = AnotherEnum.initialize_from_value(value)
733
740
  end
734
741
 
735
- # @param value [YetAnotherEnum]
742
+ # @return [YetAnotherEnum]
736
743
  def some_enum_with_default=(value)
737
744
  @some_enum_with_default = YetAnotherEnum.initialize_from_value(value)
738
745
  end
@@ -809,15 +816,15 @@ module Schemas
809
816
  class MySchemaWithDateTime < Deimos::SchemaClass::Record
810
817
 
811
818
  ### Attribute Accessors ###
812
- # @param value [String]
819
+ # @return [String]
813
820
  attr_accessor :test_id
814
- # @param value [Integer, nil]
821
+ # @return [Integer, nil]
815
822
  attr_accessor :updated_at
816
- # @param value [nil, Integer]
823
+ # @return [nil, Integer]
817
824
  attr_accessor :some_int
818
- # @param value [nil, Integer]
825
+ # @return [nil, Integer]
819
826
  attr_accessor :some_datetime_int
820
- # @param value [String]
827
+ # @return [String]
821
828
  attr_accessor :timestamp
822
829
 
823
830
  # @override
@@ -868,13 +875,13 @@ module Schemas
868
875
  class MySchemaWithId < Deimos::SchemaClass::Record
869
876
 
870
877
  ### Attribute Accessors ###
871
- # @param value [String]
878
+ # @return [String]
872
879
  attr_accessor :test_id
873
- # @param value [Integer]
880
+ # @return [Integer]
874
881
  attr_accessor :some_int
875
- # @param value [String]
882
+ # @return [String]
876
883
  attr_accessor :message_id
877
- # @param value [String]
884
+ # @return [String]
878
885
  attr_accessor :timestamp
879
886
 
880
887
  # @override
@@ -922,15 +929,15 @@ module Schemas
922
929
  class MySchemaWithUniqueId < Deimos::SchemaClass::Record
923
930
 
924
931
  ### Attribute Accessors ###
925
- # @param value [Integer]
932
+ # @return [Integer]
926
933
  attr_accessor :id
927
- # @param value [String]
934
+ # @return [String]
928
935
  attr_accessor :test_id
929
- # @param value [Integer]
936
+ # @return [Integer]
930
937
  attr_accessor :some_int
931
- # @param value [String]
938
+ # @return [String]
932
939
  attr_accessor :message_id
933
- # @param value [String]
940
+ # @return [String]
934
941
  attr_accessor :timestamp
935
942
 
936
943
  # @override
@@ -981,7 +988,7 @@ module Schemas
981
988
  class Property < Deimos::SchemaClass::Record
982
989
 
983
990
  ### Attribute Accessors ###
984
- # @param value [Boolean, Integer, Integer, Float, Float, String, Array<Property>, Hash<String, Property>]
991
+ # @return [Boolean, Integer, Integer, Float, Float, String, Array<Property>, Hash<String, Property>]
985
992
  attr_accessor :property
986
993
 
987
994
  # @override
@@ -1020,7 +1027,7 @@ module Schemas
1020
1027
  class UpdateRequest < Deimos::SchemaClass::Record
1021
1028
 
1022
1029
  ### Attribute Accessors ###
1023
- # @param value [String]
1030
+ # @return [String]
1024
1031
  attr_accessor :update_request_id
1025
1032
 
1026
1033
  # @override
@@ -1059,7 +1066,7 @@ module Schemas
1059
1066
  class UpdateResponse < Deimos::SchemaClass::Record
1060
1067
 
1061
1068
  ### Attribute Accessors ###
1062
- # @param value [String]
1069
+ # @return [String]
1063
1070
  attr_accessor :update_response_id
1064
1071
 
1065
1072
  # @override
@@ -1098,23 +1105,23 @@ module Schemas
1098
1105
  class Wibble < Deimos::SchemaClass::Record
1099
1106
 
1100
1107
  ### Attribute Accessors ###
1101
- # @param value [Integer]
1108
+ # @return [Integer]
1102
1109
  attr_accessor :id
1103
- # @param value [Integer]
1110
+ # @return [Integer]
1104
1111
  attr_accessor :wibble_id
1105
- # @param value [String]
1112
+ # @return [String]
1106
1113
  attr_accessor :name
1107
- # @param value [String]
1114
+ # @return [String]
1108
1115
  attr_accessor :floop
1109
- # @param value [Integer]
1116
+ # @return [Integer]
1110
1117
  attr_accessor :birthday_int
1111
- # @param value [Integer]
1118
+ # @return [Integer]
1112
1119
  attr_accessor :birthday_long
1113
- # @param value [nil, Integer]
1120
+ # @return [nil, Integer]
1114
1121
  attr_accessor :birthday_optional
1115
- # @param value [Integer]
1122
+ # @return [Integer]
1116
1123
  attr_accessor :updated_at
1117
- # @param value [Integer]
1124
+ # @return [Integer]
1118
1125
  attr_accessor :created_at
1119
1126
 
1120
1127
  # @override
@@ -1177,15 +1184,15 @@ module Schemas
1177
1184
  class Widget < Deimos::SchemaClass::Record
1178
1185
 
1179
1186
  ### Attribute Accessors ###
1180
- # @param value [Integer]
1187
+ # @return [Integer]
1181
1188
  attr_accessor :id
1182
- # @param value [Integer]
1189
+ # @return [Integer]
1183
1190
  attr_accessor :widget_id
1184
- # @param value [String]
1191
+ # @return [String]
1185
1192
  attr_accessor :name
1186
- # @param value [Integer]
1193
+ # @return [Integer]
1187
1194
  attr_accessor :updated_at
1188
- # @param value [Integer]
1195
+ # @return [Integer]
1189
1196
  attr_accessor :created_at
1190
1197
 
1191
1198
  # @override
@@ -1236,15 +1243,15 @@ module Schemas
1236
1243
  class WidgetTheSecond < Deimos::SchemaClass::Record
1237
1244
 
1238
1245
  ### Attribute Accessors ###
1239
- # @param value [Integer]
1246
+ # @return [Integer]
1240
1247
  attr_accessor :id
1241
- # @param value [Integer]
1248
+ # @return [Integer]
1242
1249
  attr_accessor :widget_id
1243
- # @param value [String]
1250
+ # @return [String]
1244
1251
  attr_accessor :model_id
1245
- # @param value [Integer]
1252
+ # @return [Integer]
1246
1253
  attr_accessor :updated_at
1247
- # @param value [Integer]
1254
+ # @return [Integer]
1248
1255
  attr_accessor :created_at
1249
1256
 
1250
1257
  # @override