deimos-ruby 1.16.2 → 1.16.3

Sign up to get free protection for your applications and to get access to all the features.
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
@@ -372,6 +372,13 @@ module Schemas
372
372
  'com.my-namespace'
373
373
  end
374
374
 
375
+ def self.tombstone(key)
376
+ record = self.new
377
+ record.tombstone_key = key
378
+ record.test_id = key
379
+ record
380
+ end
381
+
375
382
  # @override
376
383
  def as_json(_opts={})
377
384
  {
@@ -396,9 +403,9 @@ module Schemas
396
403
  class MySchema < Deimos::SchemaClass::Record
397
404
 
398
405
  ### Attribute Accessors ###
399
- # @param value [String]
406
+ # @return [String]
400
407
  attr_accessor :test_id
401
- # @param value [Integer]
408
+ # @return [Integer]
402
409
  attr_accessor :some_int
403
410
 
404
411
  # @override
@@ -440,9 +447,9 @@ module Schemas
440
447
  class MySchemaCompoundKey < Deimos::SchemaClass::Record
441
448
 
442
449
  ### Attribute Accessors ###
443
- # @param value [String]
450
+ # @return [String]
444
451
  attr_accessor :part_one
445
- # @param value [String]
452
+ # @return [String]
446
453
  attr_accessor :part_two
447
454
 
448
455
  # @override
@@ -484,7 +491,7 @@ module Schemas
484
491
  class MySchemaIdKey < Deimos::SchemaClass::Record
485
492
 
486
493
  ### Attribute Accessors ###
487
- # @param value [Integer]
494
+ # @return [Integer]
488
495
  attr_accessor :id
489
496
 
490
497
  # @override
@@ -523,7 +530,7 @@ module Schemas
523
530
  class MySchemaKey < Deimos::SchemaClass::Record
524
531
 
525
532
  ### Attribute Accessors ###
526
- # @param value [String]
533
+ # @return [String]
527
534
  attr_accessor :test_id
528
535
 
529
536
  # @override
@@ -562,9 +569,9 @@ module Schemas
562
569
  class MySchemaWithBoolean < Deimos::SchemaClass::Record
563
570
 
564
571
  ### Attribute Accessors ###
565
- # @param value [String]
572
+ # @return [String]
566
573
  attr_accessor :test_id
567
- # @param value [Boolean]
574
+ # @return [Boolean]
568
575
  attr_accessor :some_bool
569
576
 
570
577
  # @override
@@ -610,9 +617,9 @@ module Schemas
610
617
  attr_reader :properties
611
618
 
612
619
  ### Attribute Writers ###
613
- # @param values [Hash<String, Property>]
620
+ # @return [Hash<String, Property>]
614
621
  def properties=(values)
615
- @properties = values.transform_values do |value|
622
+ @properties = values&.transform_values do |value|
616
623
  Property.initialize_from_value(value)
617
624
  end
618
625
  end
@@ -669,57 +676,57 @@ module Schemas
669
676
  attr_reader :some_enum_with_default
670
677
 
671
678
  ### Attribute Accessors ###
672
- # @param value [String]
679
+ # @return [String]
673
680
  attr_accessor :test_id
674
- # @param value [Float]
681
+ # @return [Float]
675
682
  attr_accessor :test_float
676
- # @param values [Array<String>]
683
+ # @return [Array<String>]
677
684
  attr_accessor :test_string_array
678
- # @param values [Array<Integer>]
685
+ # @return [Array<Integer>]
679
686
  attr_accessor :test_int_array
680
- # @param value [Integer, nil]
687
+ # @return [Integer, nil]
681
688
  attr_accessor :test_optional_int
682
- # @param values [Hash<String, Integer>]
689
+ # @return [Hash<String, Integer>]
683
690
  attr_accessor :some_integer_map
684
691
 
685
692
  ### Attribute Writers ###
686
- # @param value [ARecord]
693
+ # @return [ARecord]
687
694
  def some_record=(value)
688
695
  @some_record = ARecord.initialize_from_value(value)
689
696
  end
690
697
 
691
- # @param value [nil, ARecord]
698
+ # @return [nil, ARecord]
692
699
  def some_optional_record=(value)
693
700
  @some_optional_record = ARecord.initialize_from_value(value)
694
701
  end
695
702
 
696
- # @param values [Array<ARecord>]
703
+ # @return [Array<ARecord>]
697
704
  def some_record_array=(values)
698
- @some_record_array = values.map do |value|
705
+ @some_record_array = values&.map do |value|
699
706
  ARecord.initialize_from_value(value)
700
707
  end
701
708
  end
702
709
 
703
- # @param values [Hash<String, ARecord>]
710
+ # @return [Hash<String, ARecord>]
704
711
  def some_record_map=(values)
705
- @some_record_map = values.transform_values do |value|
712
+ @some_record_map = values&.transform_values do |value|
706
713
  ARecord.initialize_from_value(value)
707
714
  end
708
715
  end
709
716
 
710
- # @param values [Array<AnEnum>]
717
+ # @return [Array<AnEnum>]
711
718
  def some_enum_array=(values)
712
- @some_enum_array = values.map do |value|
719
+ @some_enum_array = values&.map do |value|
713
720
  AnEnum.initialize_from_value(value)
714
721
  end
715
722
  end
716
723
 
717
- # @param value [nil, AnotherEnum]
724
+ # @return [nil, AnotherEnum]
718
725
  def some_optional_enum=(value)
719
726
  @some_optional_enum = AnotherEnum.initialize_from_value(value)
720
727
  end
721
728
 
722
- # @param value [YetAnotherEnum]
729
+ # @return [YetAnotherEnum]
723
730
  def some_enum_with_default=(value)
724
731
  @some_enum_with_default = YetAnotherEnum.initialize_from_value(value)
725
732
  end
@@ -796,15 +803,15 @@ module Schemas
796
803
  class MySchemaWithDateTime < Deimos::SchemaClass::Record
797
804
 
798
805
  ### Attribute Accessors ###
799
- # @param value [String]
806
+ # @return [String]
800
807
  attr_accessor :test_id
801
- # @param value [Integer, nil]
808
+ # @return [Integer, nil]
802
809
  attr_accessor :updated_at
803
- # @param value [nil, Integer]
810
+ # @return [nil, Integer]
804
811
  attr_accessor :some_int
805
- # @param value [nil, Integer]
812
+ # @return [nil, Integer]
806
813
  attr_accessor :some_datetime_int
807
- # @param value [String]
814
+ # @return [String]
808
815
  attr_accessor :timestamp
809
816
 
810
817
  # @override
@@ -855,13 +862,13 @@ module Schemas
855
862
  class MySchemaWithId < Deimos::SchemaClass::Record
856
863
 
857
864
  ### Attribute Accessors ###
858
- # @param value [String]
865
+ # @return [String]
859
866
  attr_accessor :test_id
860
- # @param value [Integer]
867
+ # @return [Integer]
861
868
  attr_accessor :some_int
862
- # @param value [String]
869
+ # @return [String]
863
870
  attr_accessor :message_id
864
- # @param value [String]
871
+ # @return [String]
865
872
  attr_accessor :timestamp
866
873
 
867
874
  # @override
@@ -909,15 +916,15 @@ module Schemas
909
916
  class MySchemaWithUniqueId < Deimos::SchemaClass::Record
910
917
 
911
918
  ### Attribute Accessors ###
912
- # @param value [Integer]
919
+ # @return [Integer]
913
920
  attr_accessor :id
914
- # @param value [String]
921
+ # @return [String]
915
922
  attr_accessor :test_id
916
- # @param value [Integer]
923
+ # @return [Integer]
917
924
  attr_accessor :some_int
918
- # @param value [String]
925
+ # @return [String]
919
926
  attr_accessor :message_id
920
- # @param value [String]
927
+ # @return [String]
921
928
  attr_accessor :timestamp
922
929
 
923
930
  # @override
@@ -968,7 +975,7 @@ module Schemas
968
975
  class Property < Deimos::SchemaClass::Record
969
976
 
970
977
  ### Attribute Accessors ###
971
- # @param value [Boolean, Integer, Integer, Float, Float, String, Array<Property>, Hash<String, Property>]
978
+ # @return [Boolean, Integer, Integer, Float, Float, String, Array<Property>, Hash<String, Property>]
972
979
  attr_accessor :property
973
980
 
974
981
  # @override
@@ -1007,7 +1014,7 @@ module Schemas
1007
1014
  class UpdateRequest < Deimos::SchemaClass::Record
1008
1015
 
1009
1016
  ### Attribute Accessors ###
1010
- # @param value [String]
1017
+ # @return [String]
1011
1018
  attr_accessor :update_request_id
1012
1019
 
1013
1020
  # @override
@@ -1046,7 +1053,7 @@ module Schemas
1046
1053
  class UpdateResponse < Deimos::SchemaClass::Record
1047
1054
 
1048
1055
  ### Attribute Accessors ###
1049
- # @param value [String]
1056
+ # @return [String]
1050
1057
  attr_accessor :update_response_id
1051
1058
 
1052
1059
  # @override
@@ -1085,23 +1092,23 @@ module Schemas
1085
1092
  class Wibble < Deimos::SchemaClass::Record
1086
1093
 
1087
1094
  ### Attribute Accessors ###
1088
- # @param value [Integer]
1095
+ # @return [Integer]
1089
1096
  attr_accessor :id
1090
- # @param value [Integer]
1097
+ # @return [Integer]
1091
1098
  attr_accessor :wibble_id
1092
- # @param value [String]
1099
+ # @return [String]
1093
1100
  attr_accessor :name
1094
- # @param value [String]
1101
+ # @return [String]
1095
1102
  attr_accessor :floop
1096
- # @param value [Integer]
1103
+ # @return [Integer]
1097
1104
  attr_accessor :birthday_int
1098
- # @param value [Integer]
1105
+ # @return [Integer]
1099
1106
  attr_accessor :birthday_long
1100
- # @param value [nil, Integer]
1107
+ # @return [nil, Integer]
1101
1108
  attr_accessor :birthday_optional
1102
- # @param value [Integer]
1109
+ # @return [Integer]
1103
1110
  attr_accessor :updated_at
1104
- # @param value [Integer]
1111
+ # @return [Integer]
1105
1112
  attr_accessor :created_at
1106
1113
 
1107
1114
  # @override
@@ -1164,15 +1171,15 @@ module Schemas
1164
1171
  class Widget < Deimos::SchemaClass::Record
1165
1172
 
1166
1173
  ### Attribute Accessors ###
1167
- # @param value [Integer]
1174
+ # @return [Integer]
1168
1175
  attr_accessor :id
1169
- # @param value [Integer]
1176
+ # @return [Integer]
1170
1177
  attr_accessor :widget_id
1171
- # @param value [String]
1178
+ # @return [String]
1172
1179
  attr_accessor :name
1173
- # @param value [Integer]
1180
+ # @return [Integer]
1174
1181
  attr_accessor :updated_at
1175
- # @param value [Integer]
1182
+ # @return [Integer]
1176
1183
  attr_accessor :created_at
1177
1184
 
1178
1185
  # @override
@@ -1223,15 +1230,15 @@ module Schemas
1223
1230
  class WidgetTheSecond < Deimos::SchemaClass::Record
1224
1231
 
1225
1232
  ### Attribute Accessors ###
1226
- # @param value [Integer]
1233
+ # @return [Integer]
1227
1234
  attr_accessor :id
1228
- # @param value [Integer]
1235
+ # @return [Integer]
1229
1236
  attr_accessor :widget_id
1230
- # @param value [String]
1237
+ # @return [String]
1231
1238
  attr_accessor :model_id
1232
- # @param value [Integer]
1239
+ # @return [Integer]
1233
1240
  attr_accessor :updated_at
1234
- # @param value [Integer]
1241
+ # @return [Integer]
1235
1242
  attr_accessor :created_at
1236
1243
 
1237
1244
  # @override