deimos-ruby 1.23.2 → 1.24.0

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 (46) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +10 -0
  3. data/docs/CONFIGURATION.md +2 -1
  4. data/lib/deimos/config/configuration.rb +10 -1
  5. data/lib/deimos/instrumentation.rb +27 -22
  6. data/lib/deimos/utils/db_poller/base.rb +23 -0
  7. data/lib/deimos/utils/schema_class.rb +18 -3
  8. data/lib/deimos/version.rb +1 -1
  9. data/lib/generators/deimos/schema_class_generator.rb +9 -2
  10. data/regenerate_test_schema_classes.rb +13 -2
  11. data/spec/active_record_batch_consumer_spec.rb +1 -1
  12. data/spec/active_record_consumer_spec.rb +1 -1
  13. data/spec/active_record_producer_spec.rb +1 -1
  14. data/spec/batch_consumer_spec.rb +1 -1
  15. data/spec/consumer_spec.rb +2 -2
  16. data/spec/generators/schema_class_generator_spec.rb +18 -1
  17. data/spec/schemas/com/my-namespace/my-suborg/MyLongNamespaceSchema.avsc +18 -0
  18. data/spec/schemas/my_namespace/generated.rb +1 -1
  19. data/spec/schemas/my_namespace/my_long_namespace_schema.rb +48 -0
  20. data/spec/schemas/my_namespace/my_nested_schema.rb +1 -1
  21. data/spec/schemas/my_namespace/my_schema.rb +1 -1
  22. data/spec/schemas/my_namespace/my_schema_with_circular_reference.rb +1 -1
  23. data/spec/schemas/my_namespace/my_schema_with_complex_type.rb +2 -2
  24. data/spec/schemas/my_namespace/my_updated_schema.rb +2 -1
  25. data/spec/schemas/{request → my_namespace/request}/create_topic.rb +2 -2
  26. data/spec/schemas/{request → my_namespace/request}/index.rb +2 -2
  27. data/spec/schemas/{request → my_namespace/request}/update_request.rb +2 -2
  28. data/spec/schemas/{response → my_namespace/response}/create_topic.rb +2 -2
  29. data/spec/schemas/{response → my_namespace/response}/index.rb +2 -2
  30. data/spec/schemas/{response → my_namespace/response}/update_response.rb +2 -2
  31. data/spec/snapshots/consumers-no-nest.snap +44 -0
  32. data/spec/snapshots/consumers.snap +44 -0
  33. data/spec/snapshots/consumers_and_producers-no-nest.snap +44 -0
  34. data/spec/snapshots/consumers_and_producers.snap +44 -0
  35. data/spec/snapshots/consumers_circular-no-nest.snap +44 -0
  36. data/spec/snapshots/consumers_circular.snap +44 -0
  37. data/spec/snapshots/consumers_complex_types-no-nest.snap +44 -0
  38. data/spec/snapshots/consumers_complex_types.snap +44 -0
  39. data/spec/snapshots/consumers_nested-no-nest.snap +44 -0
  40. data/spec/snapshots/consumers_nested.snap +44 -0
  41. data/spec/snapshots/namespace_folders.snap +254 -210
  42. data/spec/snapshots/namespace_map.snap +1450 -0
  43. data/spec/snapshots/producers_with_key-no-nest.snap +44 -0
  44. data/spec/snapshots/producers_with_key.snap +44 -0
  45. data/spec/utils/db_poller_spec.rb +42 -0
  46. metadata +20 -14
@@ -0,0 +1,1450 @@
1
+ spec/app/lib/schema_classes/schemas/my_namespace/generated.rb:
2
+ # frozen_string_literal: true
3
+
4
+ # This file is autogenerated by Deimos, Do NOT modify
5
+ module Schemas; module MyNamespace
6
+ ### Primary Schema Class ###
7
+ # Autogenerated Schema for Record at com.my-namespace.Generated
8
+ class Generated < Deimos::SchemaClass::Record
9
+
10
+ ### Secondary Schema Classes ###
11
+ # Autogenerated Schema for Record at com.my-namespace.ARecord
12
+ class ARecord < Deimos::SchemaClass::Record
13
+
14
+ ### Attribute Accessors ###
15
+ # @return [String]
16
+ attr_accessor :a_record_field
17
+
18
+ # @override
19
+ def initialize(a_record_field: nil)
20
+ super
21
+ self.a_record_field = a_record_field
22
+ end
23
+
24
+ # @override
25
+ def schema
26
+ 'ARecord'
27
+ end
28
+
29
+ # @override
30
+ def namespace
31
+ 'com.my-namespace'
32
+ end
33
+
34
+ # @override
35
+ def as_json(_opts={})
36
+ {
37
+ 'a_record_field' => @a_record_field
38
+ }
39
+ end
40
+ end
41
+
42
+ # Autogenerated Schema for Enum at com.my-namespace.AnEnum
43
+ class AnEnum < Deimos::SchemaClass::Enum
44
+ # @return ['sym1', 'sym2']
45
+ attr_accessor :an_enum
46
+
47
+ # @override
48
+ def symbols
49
+ %w(sym1 sym2)
50
+ end
51
+ end
52
+
53
+
54
+ ### Attribute Readers ###
55
+ # @return [AnEnum]
56
+ attr_reader :an_enum
57
+ # @return [ARecord]
58
+ attr_reader :a_record
59
+
60
+ ### Attribute Accessors ###
61
+ # @return [String]
62
+ attr_accessor :a_string
63
+ # @return [Integer]
64
+ attr_accessor :a_int
65
+ # @return [Integer]
66
+ attr_accessor :a_long
67
+ # @return [Float]
68
+ attr_accessor :a_float
69
+ # @return [Float]
70
+ attr_accessor :a_double
71
+ # @return [nil, Integer]
72
+ attr_accessor :an_optional_int
73
+ # @return [Array<Integer>]
74
+ attr_accessor :an_array
75
+ # @return [Hash<String, String>]
76
+ attr_accessor :a_map
77
+ # @return [String]
78
+ attr_accessor :timestamp
79
+ # @return [String]
80
+ attr_accessor :message_id
81
+
82
+ ### Attribute Writers ###
83
+ # @return [AnEnum]
84
+ def an_enum=(value)
85
+ @an_enum = AnEnum.initialize_from_value(value)
86
+ end
87
+
88
+ # @return [ARecord]
89
+ def a_record=(value)
90
+ @a_record = ARecord.initialize_from_value(value)
91
+ end
92
+
93
+ # @override
94
+ def initialize(a_string: nil,
95
+ a_int: nil,
96
+ a_long: nil,
97
+ a_float: nil,
98
+ a_double: nil,
99
+ an_optional_int: nil,
100
+ an_enum: nil,
101
+ an_array: nil,
102
+ a_map: nil,
103
+ timestamp: nil,
104
+ message_id: nil,
105
+ a_record: nil)
106
+ super
107
+ self.a_string = a_string
108
+ self.a_int = a_int
109
+ self.a_long = a_long
110
+ self.a_float = a_float
111
+ self.a_double = a_double
112
+ self.an_optional_int = an_optional_int
113
+ self.an_enum = an_enum
114
+ self.an_array = an_array
115
+ self.a_map = a_map
116
+ self.timestamp = timestamp
117
+ self.message_id = message_id
118
+ self.a_record = a_record
119
+ end
120
+
121
+ # @override
122
+ def schema
123
+ 'Generated'
124
+ end
125
+
126
+ # @override
127
+ def namespace
128
+ 'com.my-namespace'
129
+ end
130
+
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
+ # @override
139
+ def as_json(_opts={})
140
+ {
141
+ 'a_string' => @a_string,
142
+ 'a_int' => @a_int,
143
+ 'a_long' => @a_long,
144
+ 'a_float' => @a_float,
145
+ 'a_double' => @a_double,
146
+ 'an_optional_int' => @an_optional_int,
147
+ 'an_enum' => @an_enum&.as_json,
148
+ 'an_array' => @an_array,
149
+ 'a_map' => @a_map,
150
+ 'timestamp' => @timestamp,
151
+ 'message_id' => @message_id,
152
+ 'a_record' => @a_record&.as_json
153
+ }
154
+ end
155
+ end
156
+ end; end
157
+
158
+
159
+ spec/app/lib/schema_classes/schemas/my_namespace/my_long_namespace_schema.rb:
160
+ # frozen_string_literal: true
161
+
162
+ # This file is autogenerated by Deimos, Do NOT modify
163
+ module Schemas; module MyNamespace
164
+ ### Primary Schema Class ###
165
+ # Autogenerated Schema for Record at com.my-namespace.my-suborg.MyLongNamespaceSchema
166
+ class MyLongNamespaceSchema < Deimos::SchemaClass::Record
167
+
168
+ ### Attribute Accessors ###
169
+ # @return [String]
170
+ attr_accessor :test_id
171
+ # @return [Integer]
172
+ attr_accessor :some_int
173
+
174
+ # @override
175
+ def initialize(test_id: nil,
176
+ some_int: nil)
177
+ super
178
+ self.test_id = test_id
179
+ self.some_int = some_int
180
+ end
181
+
182
+ # @override
183
+ def schema
184
+ 'MyLongNamespaceSchema'
185
+ end
186
+
187
+ # @override
188
+ def namespace
189
+ 'com.my-namespace.my-suborg'
190
+ end
191
+
192
+ # @override
193
+ def as_json(_opts={})
194
+ {
195
+ 'test_id' => @test_id,
196
+ 'some_int' => @some_int
197
+ }
198
+ end
199
+ end
200
+ end; end
201
+
202
+
203
+ spec/app/lib/schema_classes/schemas/my_namespace/my_nested_schema.rb:
204
+ # frozen_string_literal: true
205
+
206
+ # This file is autogenerated by Deimos, Do NOT modify
207
+ module Schemas; module MyNamespace
208
+ ### Primary Schema Class ###
209
+ # Autogenerated Schema for Record at com.my-namespace.MyNestedSchema
210
+ class MyNestedSchema < Deimos::SchemaClass::Record
211
+
212
+ ### Secondary Schema Classes ###
213
+ # Autogenerated Schema for Record at com.my-namespace.MyNestedRecord
214
+ class MyNestedRecord < Deimos::SchemaClass::Record
215
+
216
+ ### Attribute Accessors ###
217
+ # @return [Integer]
218
+ attr_accessor :some_int
219
+ # @return [Float]
220
+ attr_accessor :some_float
221
+ # @return [String]
222
+ attr_accessor :some_string
223
+ # @return [nil, Integer]
224
+ attr_accessor :some_optional_int
225
+
226
+ # @override
227
+ def initialize(some_int: nil,
228
+ some_float: nil,
229
+ some_string: nil,
230
+ some_optional_int: nil)
231
+ super
232
+ self.some_int = some_int
233
+ self.some_float = some_float
234
+ self.some_string = some_string
235
+ self.some_optional_int = some_optional_int
236
+ end
237
+
238
+ # @override
239
+ def schema
240
+ 'MyNestedRecord'
241
+ end
242
+
243
+ # @override
244
+ def namespace
245
+ 'com.my-namespace'
246
+ end
247
+
248
+ # @override
249
+ def as_json(_opts={})
250
+ {
251
+ 'some_int' => @some_int,
252
+ 'some_float' => @some_float,
253
+ 'some_string' => @some_string,
254
+ 'some_optional_int' => @some_optional_int
255
+ }
256
+ end
257
+ end
258
+
259
+
260
+ ### Attribute Readers ###
261
+ # @return [MyNestedRecord]
262
+ attr_reader :some_nested_record
263
+ # @return [nil, MyNestedRecord]
264
+ attr_reader :some_optional_record
265
+
266
+ ### Attribute Accessors ###
267
+ # @return [String]
268
+ attr_accessor :test_id
269
+ # @return [Float]
270
+ attr_accessor :test_float
271
+ # @return [Array<String>]
272
+ attr_accessor :test_array
273
+
274
+ ### Attribute Writers ###
275
+ # @return [MyNestedRecord]
276
+ def some_nested_record=(value)
277
+ @some_nested_record = MyNestedRecord.initialize_from_value(value)
278
+ end
279
+
280
+ # @return [nil, MyNestedRecord]
281
+ def some_optional_record=(value)
282
+ @some_optional_record = MyNestedRecord.initialize_from_value(value)
283
+ end
284
+
285
+ # @override
286
+ def initialize(test_id: nil,
287
+ test_float: nil,
288
+ test_array: nil,
289
+ some_nested_record: nil,
290
+ some_optional_record: nil)
291
+ super
292
+ self.test_id = test_id
293
+ self.test_float = test_float
294
+ self.test_array = test_array
295
+ self.some_nested_record = some_nested_record
296
+ self.some_optional_record = some_optional_record
297
+ end
298
+
299
+ # @override
300
+ def schema
301
+ 'MyNestedSchema'
302
+ end
303
+
304
+ # @override
305
+ def namespace
306
+ 'com.my-namespace'
307
+ end
308
+
309
+ def self.tombstone(key)
310
+ record = self.allocate
311
+ record.tombstone_key = key
312
+ record.test_id = key
313
+ record
314
+ end
315
+
316
+ # @override
317
+ def as_json(_opts={})
318
+ {
319
+ 'test_id' => @test_id,
320
+ 'test_float' => @test_float,
321
+ 'test_array' => @test_array,
322
+ 'some_nested_record' => @some_nested_record&.as_json,
323
+ 'some_optional_record' => @some_optional_record&.as_json
324
+ }
325
+ end
326
+ end
327
+ end; end
328
+
329
+
330
+ spec/app/lib/schema_classes/schemas/my_namespace/my_schema.rb:
331
+ # frozen_string_literal: true
332
+
333
+ # This file is autogenerated by Deimos, Do NOT modify
334
+ module Schemas; module MyNamespace
335
+ ### Primary Schema Class ###
336
+ # Autogenerated Schema for Record at com.my-namespace.MySchema
337
+ class MySchema < Deimos::SchemaClass::Record
338
+
339
+ ### Attribute Readers ###
340
+ # @return [MySchemaKey]
341
+ attr_reader :payload_key
342
+
343
+ ### Attribute Accessors ###
344
+ # @return [String]
345
+ attr_accessor :test_id
346
+ # @return [Integer]
347
+ attr_accessor :some_int
348
+
349
+ ### Attribute Writers ###
350
+ # @return [MySchemaKey]
351
+ def payload_key=(value)
352
+ @payload_key = MySchemaKey.initialize_from_value(value)
353
+ end
354
+
355
+ # @override
356
+ def initialize(test_id: nil,
357
+ some_int: nil,
358
+ payload_key: nil)
359
+ super
360
+ self.test_id = test_id
361
+ self.some_int = some_int
362
+ self.payload_key = payload_key
363
+ end
364
+
365
+ # @override
366
+ def schema
367
+ 'MySchema'
368
+ end
369
+
370
+ # @override
371
+ def namespace
372
+ 'com.my-namespace'
373
+ end
374
+
375
+ def self.tombstone(key)
376
+ record = self.allocate
377
+ record.tombstone_key = MySchemaKey.initialize_from_value(key)
378
+ record.payload_key = key
379
+ record
380
+ end
381
+
382
+ # @override
383
+ def as_json(_opts={})
384
+ {
385
+ 'test_id' => @test_id,
386
+ 'some_int' => @some_int,
387
+ 'payload_key' => @payload_key&.as_json
388
+ }
389
+ end
390
+ end
391
+ end; end
392
+
393
+
394
+ spec/app/lib/schema_classes/schemas/my_namespace/my_schema_compound_key.rb:
395
+ # frozen_string_literal: true
396
+
397
+ # This file is autogenerated by Deimos, Do NOT modify
398
+ module Schemas; module MyNamespace
399
+ ### Primary Schema Class ###
400
+ # Autogenerated Schema for Record at com.my-namespace.MySchemaCompound_key
401
+ class MySchemaCompoundKey < Deimos::SchemaClass::Record
402
+
403
+ ### Attribute Accessors ###
404
+ # @return [String]
405
+ attr_accessor :part_one
406
+ # @return [String]
407
+ attr_accessor :part_two
408
+
409
+ # @override
410
+ def initialize(part_one: nil,
411
+ part_two: nil)
412
+ super
413
+ self.part_one = part_one
414
+ self.part_two = part_two
415
+ end
416
+
417
+ # @override
418
+ def schema
419
+ 'MySchemaCompound_key'
420
+ end
421
+
422
+ # @override
423
+ def namespace
424
+ 'com.my-namespace'
425
+ end
426
+
427
+ # @override
428
+ def as_json(_opts={})
429
+ {
430
+ 'part_one' => @part_one,
431
+ 'part_two' => @part_two
432
+ }
433
+ end
434
+ end
435
+ end; end
436
+
437
+
438
+ spec/app/lib/schema_classes/schemas/my_namespace/my_schema_id_key.rb:
439
+ # frozen_string_literal: true
440
+
441
+ # This file is autogenerated by Deimos, Do NOT modify
442
+ module Schemas; module MyNamespace
443
+ ### Primary Schema Class ###
444
+ # Autogenerated Schema for Record at com.my-namespace.MySchemaId_key
445
+ class MySchemaIdKey < Deimos::SchemaClass::Record
446
+
447
+ ### Attribute Accessors ###
448
+ # @return [Integer]
449
+ attr_accessor :id
450
+
451
+ # @override
452
+ def initialize(id: nil)
453
+ super
454
+ self.id = id
455
+ end
456
+
457
+ # @override
458
+ def schema
459
+ 'MySchemaId_key'
460
+ end
461
+
462
+ # @override
463
+ def namespace
464
+ 'com.my-namespace'
465
+ end
466
+
467
+ # @override
468
+ def as_json(_opts={})
469
+ {
470
+ 'id' => @id
471
+ }
472
+ end
473
+ end
474
+ end; end
475
+
476
+
477
+ spec/app/lib/schema_classes/schemas/my_namespace/my_schema_key.rb:
478
+ # frozen_string_literal: true
479
+
480
+ # This file is autogenerated by Deimos, Do NOT modify
481
+ module Schemas; module MyNamespace
482
+ ### Primary Schema Class ###
483
+ # Autogenerated Schema for Record at com.my-namespace.MySchema_key
484
+ class MySchemaKey < Deimos::SchemaClass::Record
485
+
486
+ ### Attribute Accessors ###
487
+ # @return [String]
488
+ attr_accessor :test_id
489
+
490
+ # @override
491
+ def initialize(test_id: nil)
492
+ super
493
+ self.test_id = test_id
494
+ end
495
+
496
+ # @override
497
+ def schema
498
+ 'MySchema_key'
499
+ end
500
+
501
+ # @override
502
+ def namespace
503
+ 'com.my-namespace'
504
+ end
505
+
506
+ # @override
507
+ def as_json(_opts={})
508
+ {
509
+ 'test_id' => @test_id
510
+ }
511
+ end
512
+ end
513
+ end; end
514
+
515
+
516
+ spec/app/lib/schema_classes/schemas/my_namespace/my_schema_with_boolean.rb:
517
+ # frozen_string_literal: true
518
+
519
+ # This file is autogenerated by Deimos, Do NOT modify
520
+ module Schemas; module MyNamespace
521
+ ### Primary Schema Class ###
522
+ # Autogenerated Schema for Record at com.my-namespace.MySchemaWithBooleans
523
+ class MySchemaWithBoolean < Deimos::SchemaClass::Record
524
+
525
+ ### Attribute Accessors ###
526
+ # @return [String]
527
+ attr_accessor :test_id
528
+ # @return [Boolean]
529
+ attr_accessor :some_bool
530
+
531
+ # @override
532
+ def initialize(test_id: nil,
533
+ some_bool: nil)
534
+ super
535
+ self.test_id = test_id
536
+ self.some_bool = some_bool
537
+ end
538
+
539
+ # @override
540
+ def schema
541
+ 'MySchemaWithBooleans'
542
+ end
543
+
544
+ # @override
545
+ def namespace
546
+ 'com.my-namespace'
547
+ end
548
+
549
+ # @override
550
+ def as_json(_opts={})
551
+ {
552
+ 'test_id' => @test_id,
553
+ 'some_bool' => @some_bool
554
+ }
555
+ end
556
+ end
557
+ end; end
558
+
559
+
560
+ spec/app/lib/schema_classes/schemas/my_namespace/my_schema_with_circular_reference.rb:
561
+ # frozen_string_literal: true
562
+
563
+ # This file is autogenerated by Deimos, Do NOT modify
564
+ module Schemas; module MyNamespace
565
+ ### Primary Schema Class ###
566
+ # Autogenerated Schema for Record at com.my-namespace.MySchemaWithCircularReference
567
+ class MySchemaWithCircularReference < Deimos::SchemaClass::Record
568
+
569
+ ### Secondary Schema Classes ###
570
+ # Autogenerated Schema for Record at com.my-namespace.Property
571
+ class Property < Deimos::SchemaClass::Record
572
+
573
+ ### Attribute Accessors ###
574
+ # @return [Boolean, Integer, Integer, Float, Float, String, Array<Property>, Hash<String, Property>]
575
+ attr_accessor :property
576
+
577
+ # @override
578
+ def initialize(property: nil)
579
+ super
580
+ self.property = property
581
+ end
582
+
583
+ # @override
584
+ def schema
585
+ 'Property'
586
+ end
587
+
588
+ # @override
589
+ def namespace
590
+ 'com.my-namespace'
591
+ end
592
+
593
+ # @override
594
+ def as_json(_opts={})
595
+ {
596
+ 'property' => @property
597
+ }
598
+ end
599
+ end
600
+
601
+
602
+ ### Attribute Readers ###
603
+ # @return [Hash<String, Property>]
604
+ attr_reader :properties
605
+
606
+ ### Attribute Writers ###
607
+ # @return [Hash<String, Property>]
608
+ def properties=(values)
609
+ @properties = values&.transform_values do |value|
610
+ Property.initialize_from_value(value)
611
+ end
612
+ end
613
+
614
+ # @override
615
+ def initialize(properties: {})
616
+ super
617
+ self.properties = properties
618
+ end
619
+
620
+ # @override
621
+ def schema
622
+ 'MySchemaWithCircularReference'
623
+ end
624
+
625
+ # @override
626
+ def namespace
627
+ 'com.my-namespace'
628
+ end
629
+
630
+ # @override
631
+ def as_json(_opts={})
632
+ {
633
+ 'properties' => @properties.transform_values { |v| v&.as_json }
634
+ }
635
+ end
636
+ end
637
+ end; end
638
+
639
+
640
+ spec/app/lib/schema_classes/schemas/my_namespace/my_schema_with_complex_type.rb:
641
+ # frozen_string_literal: true
642
+
643
+ # This file is autogenerated by Deimos, Do NOT modify
644
+ module Schemas; module MyNamespace
645
+ ### Primary Schema Class ###
646
+ # Autogenerated Schema for Record at com.my-namespace.MySchemaWithComplexTypes
647
+ class MySchemaWithComplexType < Deimos::SchemaClass::Record
648
+
649
+ ### Secondary Schema Classes ###
650
+ # Autogenerated Schema for Record at com.my-namespace.ARecord
651
+ class ARecord < Deimos::SchemaClass::Record
652
+
653
+ ### Attribute Accessors ###
654
+ # @return [String]
655
+ attr_accessor :a_record_field
656
+
657
+ # @override
658
+ def initialize(a_record_field: nil)
659
+ super
660
+ self.a_record_field = a_record_field
661
+ end
662
+
663
+ # @override
664
+ def schema
665
+ 'ARecord'
666
+ end
667
+
668
+ # @override
669
+ def namespace
670
+ 'com.my-namespace'
671
+ end
672
+
673
+ # @override
674
+ def as_json(_opts={})
675
+ {
676
+ 'a_record_field' => @a_record_field
677
+ }
678
+ end
679
+ end
680
+
681
+ # Autogenerated Schema for Enum at com.my-namespace.AnEnum
682
+ class AnEnum < Deimos::SchemaClass::Enum
683
+ # @return ['sym1', 'sym2']
684
+ attr_accessor :an_enum
685
+
686
+ # @override
687
+ def symbols
688
+ %w(sym1 sym2)
689
+ end
690
+ end
691
+
692
+ # Autogenerated Schema for Enum at com.my-namespace.AnotherEnum
693
+ class AnotherEnum < Deimos::SchemaClass::Enum
694
+ # @return ['sym3', 'sym4']
695
+ attr_accessor :another_enum
696
+
697
+ # @override
698
+ def symbols
699
+ %w(sym3 sym4)
700
+ end
701
+ end
702
+
703
+ # Autogenerated Schema for Enum at com.my-namespace.YetAnotherEnum
704
+ class YetAnotherEnum < Deimos::SchemaClass::Enum
705
+ # @return ['sym5', 'sym6']
706
+ attr_accessor :yet_another_enum
707
+
708
+ # @override
709
+ def symbols
710
+ %w(sym5 sym6)
711
+ end
712
+ end
713
+
714
+
715
+ ### Attribute Readers ###
716
+ # @return [ARecord]
717
+ attr_reader :some_record
718
+ # @return [nil, ARecord]
719
+ attr_reader :some_optional_record
720
+ # @return [Array<ARecord>]
721
+ attr_reader :some_record_array
722
+ # @return [Hash<String, ARecord>]
723
+ attr_reader :some_record_map
724
+ # @return [Array<AnEnum>]
725
+ attr_reader :some_enum_array
726
+ # @return [nil, AnotherEnum]
727
+ attr_reader :some_optional_enum
728
+ # @return [YetAnotherEnum]
729
+ attr_reader :some_enum_with_default
730
+
731
+ ### Attribute Accessors ###
732
+ # @return [String]
733
+ attr_accessor :test_id
734
+ # @return [Float]
735
+ attr_accessor :test_float
736
+ # @return [Array<String>]
737
+ attr_accessor :test_string_array
738
+ # @return [Array<Integer>]
739
+ attr_accessor :test_int_array
740
+ # @return [Integer, nil]
741
+ attr_accessor :test_optional_int
742
+ # @return [Hash<String, Integer>]
743
+ attr_accessor :some_integer_map
744
+
745
+ ### Attribute Writers ###
746
+ # @return [ARecord]
747
+ def some_record=(value)
748
+ @some_record = ARecord.initialize_from_value(value)
749
+ end
750
+
751
+ # @return [nil, ARecord]
752
+ def some_optional_record=(value)
753
+ @some_optional_record = ARecord.initialize_from_value(value)
754
+ end
755
+
756
+ # @return [Array<ARecord>]
757
+ def some_record_array=(values)
758
+ @some_record_array = values&.map do |value|
759
+ ARecord.initialize_from_value(value)
760
+ end
761
+ end
762
+
763
+ # @return [Hash<String, ARecord>]
764
+ def some_record_map=(values)
765
+ @some_record_map = values&.transform_values do |value|
766
+ ARecord.initialize_from_value(value)
767
+ end
768
+ end
769
+
770
+ # @return [Array<AnEnum>]
771
+ def some_enum_array=(values)
772
+ @some_enum_array = values&.map do |value|
773
+ AnEnum.initialize_from_value(value)
774
+ end
775
+ end
776
+
777
+ # @return [nil, AnotherEnum]
778
+ def some_optional_enum=(value)
779
+ @some_optional_enum = AnotherEnum.initialize_from_value(value)
780
+ end
781
+
782
+ # @return [YetAnotherEnum]
783
+ def some_enum_with_default=(value)
784
+ @some_enum_with_default = YetAnotherEnum.initialize_from_value(value)
785
+ end
786
+
787
+ # @override
788
+ def initialize(test_id: nil,
789
+ test_float: nil,
790
+ test_string_array: ["test"],
791
+ test_int_array: [123],
792
+ test_optional_int: 123,
793
+ some_integer_map: {"abc"=>123},
794
+ some_record: {"a_record_field"=>"Test String"},
795
+ some_optional_record: nil,
796
+ some_record_array: nil,
797
+ some_record_map: nil,
798
+ some_enum_array: nil,
799
+ some_optional_enum: nil,
800
+ some_enum_with_default: "sym6")
801
+ super
802
+ self.test_id = test_id
803
+ self.test_float = test_float
804
+ self.test_string_array = test_string_array
805
+ self.test_int_array = test_int_array
806
+ self.test_optional_int = test_optional_int
807
+ self.some_integer_map = some_integer_map
808
+ self.some_record = some_record
809
+ self.some_optional_record = some_optional_record
810
+ self.some_record_array = some_record_array
811
+ self.some_record_map = some_record_map
812
+ self.some_enum_array = some_enum_array
813
+ self.some_optional_enum = some_optional_enum
814
+ self.some_enum_with_default = some_enum_with_default
815
+ end
816
+
817
+ # @override
818
+ def schema
819
+ 'MySchemaWithComplexTypes'
820
+ end
821
+
822
+ # @override
823
+ def namespace
824
+ 'com.my-namespace'
825
+ end
826
+
827
+ # @override
828
+ def as_json(_opts={})
829
+ {
830
+ 'test_id' => @test_id,
831
+ 'test_float' => @test_float,
832
+ 'test_string_array' => @test_string_array,
833
+ 'test_int_array' => @test_int_array,
834
+ 'test_optional_int' => @test_optional_int,
835
+ 'some_integer_map' => @some_integer_map,
836
+ 'some_record' => @some_record&.as_json,
837
+ 'some_optional_record' => @some_optional_record&.as_json,
838
+ 'some_record_array' => @some_record_array.map { |v| v&.as_json },
839
+ 'some_record_map' => @some_record_map.transform_values { |v| v&.as_json },
840
+ 'some_enum_array' => @some_enum_array.map { |v| v&.as_json },
841
+ 'some_optional_enum' => @some_optional_enum&.as_json,
842
+ 'some_enum_with_default' => @some_enum_with_default&.as_json
843
+ }
844
+ end
845
+ end
846
+ end; end
847
+
848
+
849
+ spec/app/lib/schema_classes/schemas/my_namespace/my_schema_with_date_time.rb:
850
+ # frozen_string_literal: true
851
+
852
+ # This file is autogenerated by Deimos, Do NOT modify
853
+ module Schemas; module MyNamespace
854
+ ### Primary Schema Class ###
855
+ # Autogenerated Schema for Record at com.my-namespace.MySchemaWithDateTimes
856
+ class MySchemaWithDateTime < Deimos::SchemaClass::Record
857
+
858
+ ### Attribute Accessors ###
859
+ # @return [String]
860
+ attr_accessor :test_id
861
+ # @return [Integer, nil]
862
+ attr_accessor :updated_at
863
+ # @return [nil, Integer]
864
+ attr_accessor :some_int
865
+ # @return [nil, Integer]
866
+ attr_accessor :some_datetime_int
867
+ # @return [String]
868
+ attr_accessor :timestamp
869
+
870
+ # @override
871
+ def initialize(test_id: nil,
872
+ updated_at: nil,
873
+ some_int: nil,
874
+ some_datetime_int: nil,
875
+ timestamp: nil)
876
+ super
877
+ self.test_id = test_id
878
+ self.updated_at = updated_at
879
+ self.some_int = some_int
880
+ self.some_datetime_int = some_datetime_int
881
+ self.timestamp = timestamp
882
+ end
883
+
884
+ # @override
885
+ def schema
886
+ 'MySchemaWithDateTimes'
887
+ end
888
+
889
+ # @override
890
+ def namespace
891
+ 'com.my-namespace'
892
+ end
893
+
894
+ # @override
895
+ def as_json(_opts={})
896
+ {
897
+ 'test_id' => @test_id,
898
+ 'updated_at' => @updated_at,
899
+ 'some_int' => @some_int,
900
+ 'some_datetime_int' => @some_datetime_int,
901
+ 'timestamp' => @timestamp
902
+ }
903
+ end
904
+ end
905
+ end; end
906
+
907
+
908
+ spec/app/lib/schema_classes/schemas/my_namespace/my_schema_with_id.rb:
909
+ # frozen_string_literal: true
910
+
911
+ # This file is autogenerated by Deimos, Do NOT modify
912
+ module Schemas; module MyNamespace
913
+ ### Primary Schema Class ###
914
+ # Autogenerated Schema for Record at com.my-namespace.MySchemaWithId
915
+ class MySchemaWithId < Deimos::SchemaClass::Record
916
+
917
+ ### Attribute Accessors ###
918
+ # @return [String]
919
+ attr_accessor :test_id
920
+ # @return [Integer]
921
+ attr_accessor :some_int
922
+ # @return [String]
923
+ attr_accessor :message_id
924
+ # @return [String]
925
+ attr_accessor :timestamp
926
+
927
+ # @override
928
+ def initialize(test_id: nil,
929
+ some_int: nil,
930
+ message_id: nil,
931
+ timestamp: nil)
932
+ super
933
+ self.test_id = test_id
934
+ self.some_int = some_int
935
+ self.message_id = message_id
936
+ self.timestamp = timestamp
937
+ end
938
+
939
+ # @override
940
+ def schema
941
+ 'MySchemaWithId'
942
+ end
943
+
944
+ # @override
945
+ def namespace
946
+ 'com.my-namespace'
947
+ end
948
+
949
+ # @override
950
+ def as_json(_opts={})
951
+ {
952
+ 'test_id' => @test_id,
953
+ 'some_int' => @some_int,
954
+ 'message_id' => @message_id,
955
+ 'timestamp' => @timestamp
956
+ }
957
+ end
958
+ end
959
+ end; end
960
+
961
+
962
+ spec/app/lib/schema_classes/schemas/my_namespace/my_schema_with_unique_id.rb:
963
+ # frozen_string_literal: true
964
+
965
+ # This file is autogenerated by Deimos, Do NOT modify
966
+ module Schemas; module MyNamespace
967
+ ### Primary Schema Class ###
968
+ # Autogenerated Schema for Record at com.my-namespace.MySchemaWithUniqueId
969
+ class MySchemaWithUniqueId < Deimos::SchemaClass::Record
970
+
971
+ ### Attribute Accessors ###
972
+ # @return [Integer]
973
+ attr_accessor :id
974
+ # @return [String]
975
+ attr_accessor :test_id
976
+ # @return [Integer]
977
+ attr_accessor :some_int
978
+ # @return [String]
979
+ attr_accessor :message_id
980
+ # @return [String]
981
+ attr_accessor :timestamp
982
+
983
+ # @override
984
+ def initialize(id: nil,
985
+ test_id: nil,
986
+ some_int: nil,
987
+ message_id: nil,
988
+ timestamp: nil)
989
+ super
990
+ self.id = id
991
+ self.test_id = test_id
992
+ self.some_int = some_int
993
+ self.message_id = message_id
994
+ self.timestamp = timestamp
995
+ end
996
+
997
+ # @override
998
+ def schema
999
+ 'MySchemaWithUniqueId'
1000
+ end
1001
+
1002
+ # @override
1003
+ def namespace
1004
+ 'com.my-namespace'
1005
+ end
1006
+
1007
+ # @override
1008
+ def as_json(_opts={})
1009
+ {
1010
+ 'id' => @id,
1011
+ 'test_id' => @test_id,
1012
+ 'some_int' => @some_int,
1013
+ 'message_id' => @message_id,
1014
+ 'timestamp' => @timestamp
1015
+ }
1016
+ end
1017
+ end
1018
+ end; end
1019
+
1020
+
1021
+ spec/app/lib/schema_classes/schemas/my_namespace/request/create_topic.rb:
1022
+ # frozen_string_literal: true
1023
+
1024
+ # This file is autogenerated by Deimos, Do NOT modify
1025
+ module Schemas; module MyNamespace; module Request
1026
+ ### Primary Schema Class ###
1027
+ # Autogenerated Schema for Record at com.my-namespace.request.CreateTopic
1028
+ class CreateTopic < Deimos::SchemaClass::Record
1029
+
1030
+ ### Attribute Accessors ###
1031
+ # @return [String]
1032
+ attr_accessor :request_id
1033
+
1034
+ # @override
1035
+ def initialize(request_id: nil)
1036
+ super
1037
+ self.request_id = request_id
1038
+ end
1039
+
1040
+ # @override
1041
+ def schema
1042
+ 'CreateTopic'
1043
+ end
1044
+
1045
+ # @override
1046
+ def namespace
1047
+ 'com.my-namespace.request'
1048
+ end
1049
+
1050
+ # @override
1051
+ def as_json(_opts={})
1052
+ {
1053
+ 'request_id' => @request_id
1054
+ }
1055
+ end
1056
+ end
1057
+ end; end; end
1058
+
1059
+
1060
+ spec/app/lib/schema_classes/schemas/my_namespace/request/index.rb:
1061
+ # frozen_string_literal: true
1062
+
1063
+ # This file is autogenerated by Deimos, Do NOT modify
1064
+ module Schemas; module MyNamespace; module Request
1065
+ ### Primary Schema Class ###
1066
+ # Autogenerated Schema for Record at com.my-namespace.request.Index
1067
+ class Index < Deimos::SchemaClass::Record
1068
+
1069
+ ### Attribute Accessors ###
1070
+ # @return [String]
1071
+ attr_accessor :request_id
1072
+
1073
+ # @override
1074
+ def initialize(request_id: nil)
1075
+ super
1076
+ self.request_id = request_id
1077
+ end
1078
+
1079
+ # @override
1080
+ def schema
1081
+ 'Index'
1082
+ end
1083
+
1084
+ # @override
1085
+ def namespace
1086
+ 'com.my-namespace.request'
1087
+ end
1088
+
1089
+ # @override
1090
+ def as_json(_opts={})
1091
+ {
1092
+ 'request_id' => @request_id
1093
+ }
1094
+ end
1095
+ end
1096
+ end; end; end
1097
+
1098
+
1099
+ spec/app/lib/schema_classes/schemas/my_namespace/request/update_request.rb:
1100
+ # frozen_string_literal: true
1101
+
1102
+ # This file is autogenerated by Deimos, Do NOT modify
1103
+ module Schemas; module MyNamespace; module Request
1104
+ ### Primary Schema Class ###
1105
+ # Autogenerated Schema for Record at com.my-namespace.request.UpdateRequest
1106
+ class UpdateRequest < Deimos::SchemaClass::Record
1107
+
1108
+ ### Attribute Accessors ###
1109
+ # @return [String]
1110
+ attr_accessor :update_request_id
1111
+
1112
+ # @override
1113
+ def initialize(update_request_id: nil)
1114
+ super
1115
+ self.update_request_id = update_request_id
1116
+ end
1117
+
1118
+ # @override
1119
+ def schema
1120
+ 'UpdateRequest'
1121
+ end
1122
+
1123
+ # @override
1124
+ def namespace
1125
+ 'com.my-namespace.request'
1126
+ end
1127
+
1128
+ # @override
1129
+ def as_json(_opts={})
1130
+ {
1131
+ 'update_request_id' => @update_request_id
1132
+ }
1133
+ end
1134
+ end
1135
+ end; end; end
1136
+
1137
+
1138
+ spec/app/lib/schema_classes/schemas/my_namespace/response/create_topic.rb:
1139
+ # frozen_string_literal: true
1140
+
1141
+ # This file is autogenerated by Deimos, Do NOT modify
1142
+ module Schemas; module MyNamespace; module Response
1143
+ ### Primary Schema Class ###
1144
+ # Autogenerated Schema for Record at com.my-namespace.response.CreateTopic
1145
+ class CreateTopic < Deimos::SchemaClass::Record
1146
+
1147
+ ### Attribute Accessors ###
1148
+ # @return [String]
1149
+ attr_accessor :response_id
1150
+
1151
+ # @override
1152
+ def initialize(response_id: nil)
1153
+ super
1154
+ self.response_id = response_id
1155
+ end
1156
+
1157
+ # @override
1158
+ def schema
1159
+ 'CreateTopic'
1160
+ end
1161
+
1162
+ # @override
1163
+ def namespace
1164
+ 'com.my-namespace.response'
1165
+ end
1166
+
1167
+ # @override
1168
+ def as_json(_opts={})
1169
+ {
1170
+ 'response_id' => @response_id
1171
+ }
1172
+ end
1173
+ end
1174
+ end; end; end
1175
+
1176
+
1177
+ spec/app/lib/schema_classes/schemas/my_namespace/response/index.rb:
1178
+ # frozen_string_literal: true
1179
+
1180
+ # This file is autogenerated by Deimos, Do NOT modify
1181
+ module Schemas; module MyNamespace; module Response
1182
+ ### Primary Schema Class ###
1183
+ # Autogenerated Schema for Record at com.my-namespace.response.Index
1184
+ class Index < Deimos::SchemaClass::Record
1185
+
1186
+ ### Attribute Accessors ###
1187
+ # @return [String]
1188
+ attr_accessor :response_id
1189
+
1190
+ # @override
1191
+ def initialize(response_id: nil)
1192
+ super
1193
+ self.response_id = response_id
1194
+ end
1195
+
1196
+ # @override
1197
+ def schema
1198
+ 'Index'
1199
+ end
1200
+
1201
+ # @override
1202
+ def namespace
1203
+ 'com.my-namespace.response'
1204
+ end
1205
+
1206
+ # @override
1207
+ def as_json(_opts={})
1208
+ {
1209
+ 'response_id' => @response_id
1210
+ }
1211
+ end
1212
+ end
1213
+ end; end; end
1214
+
1215
+
1216
+ spec/app/lib/schema_classes/schemas/my_namespace/response/update_response.rb:
1217
+ # frozen_string_literal: true
1218
+
1219
+ # This file is autogenerated by Deimos, Do NOT modify
1220
+ module Schemas; module MyNamespace; module Response
1221
+ ### Primary Schema Class ###
1222
+ # Autogenerated Schema for Record at com.my-namespace.response.UpdateResponse
1223
+ class UpdateResponse < Deimos::SchemaClass::Record
1224
+
1225
+ ### Attribute Accessors ###
1226
+ # @return [String]
1227
+ attr_accessor :update_response_id
1228
+
1229
+ # @override
1230
+ def initialize(update_response_id: nil)
1231
+ super
1232
+ self.update_response_id = update_response_id
1233
+ end
1234
+
1235
+ # @override
1236
+ def schema
1237
+ 'UpdateResponse'
1238
+ end
1239
+
1240
+ # @override
1241
+ def namespace
1242
+ 'com.my-namespace.response'
1243
+ end
1244
+
1245
+ # @override
1246
+ def as_json(_opts={})
1247
+ {
1248
+ 'update_response_id' => @update_response_id
1249
+ }
1250
+ end
1251
+ end
1252
+ end; end; end
1253
+
1254
+
1255
+ spec/app/lib/schema_classes/schemas/my_namespace/wibble.rb:
1256
+ # frozen_string_literal: true
1257
+
1258
+ # This file is autogenerated by Deimos, Do NOT modify
1259
+ module Schemas; module MyNamespace
1260
+ ### Primary Schema Class ###
1261
+ # Autogenerated Schema for Record at com.my-namespace.Wibble
1262
+ class Wibble < Deimos::SchemaClass::Record
1263
+
1264
+ ### Attribute Accessors ###
1265
+ # @return [Integer]
1266
+ attr_accessor :id
1267
+ # @return [Integer]
1268
+ attr_accessor :wibble_id
1269
+ # @return [String]
1270
+ attr_accessor :name
1271
+ # @return [String]
1272
+ attr_accessor :floop
1273
+ # @return [Integer]
1274
+ attr_accessor :birthday_int
1275
+ # @return [Integer]
1276
+ attr_accessor :birthday_long
1277
+ # @return [nil, Integer]
1278
+ attr_accessor :birthday_optional
1279
+ # @return [Integer]
1280
+ attr_accessor :updated_at
1281
+ # @return [Integer]
1282
+ attr_accessor :created_at
1283
+
1284
+ # @override
1285
+ def initialize(id: nil,
1286
+ wibble_id: nil,
1287
+ name: nil,
1288
+ floop: nil,
1289
+ birthday_int: nil,
1290
+ birthday_long: nil,
1291
+ birthday_optional: nil,
1292
+ updated_at: nil,
1293
+ created_at: nil)
1294
+ super
1295
+ self.id = id
1296
+ self.wibble_id = wibble_id
1297
+ self.name = name
1298
+ self.floop = floop
1299
+ self.birthday_int = birthday_int
1300
+ self.birthday_long = birthday_long
1301
+ self.birthday_optional = birthday_optional
1302
+ self.updated_at = updated_at
1303
+ self.created_at = created_at
1304
+ end
1305
+
1306
+ # @override
1307
+ def schema
1308
+ 'Wibble'
1309
+ end
1310
+
1311
+ # @override
1312
+ def namespace
1313
+ 'com.my-namespace'
1314
+ end
1315
+
1316
+ # @override
1317
+ def as_json(_opts={})
1318
+ {
1319
+ 'id' => @id,
1320
+ 'wibble_id' => @wibble_id,
1321
+ 'name' => @name,
1322
+ 'floop' => @floop,
1323
+ 'birthday_int' => @birthday_int,
1324
+ 'birthday_long' => @birthday_long,
1325
+ 'birthday_optional' => @birthday_optional,
1326
+ 'updated_at' => @updated_at,
1327
+ 'created_at' => @created_at
1328
+ }
1329
+ end
1330
+ end
1331
+ end; end
1332
+
1333
+
1334
+ spec/app/lib/schema_classes/schemas/my_namespace/widget.rb:
1335
+ # frozen_string_literal: true
1336
+
1337
+ # This file is autogenerated by Deimos, Do NOT modify
1338
+ module Schemas; module MyNamespace
1339
+ ### Primary Schema Class ###
1340
+ # Autogenerated Schema for Record at com.my-namespace.Widget
1341
+ class Widget < Deimos::SchemaClass::Record
1342
+
1343
+ ### Attribute Accessors ###
1344
+ # @return [Integer]
1345
+ attr_accessor :id
1346
+ # @return [Integer]
1347
+ attr_accessor :widget_id
1348
+ # @return [String]
1349
+ attr_accessor :name
1350
+ # @return [Integer]
1351
+ attr_accessor :updated_at
1352
+ # @return [Integer]
1353
+ attr_accessor :created_at
1354
+
1355
+ # @override
1356
+ def initialize(id: nil,
1357
+ widget_id: nil,
1358
+ name: nil,
1359
+ updated_at: nil,
1360
+ created_at: nil)
1361
+ super
1362
+ self.id = id
1363
+ self.widget_id = widget_id
1364
+ self.name = name
1365
+ self.updated_at = updated_at
1366
+ self.created_at = created_at
1367
+ end
1368
+
1369
+ # @override
1370
+ def schema
1371
+ 'Widget'
1372
+ end
1373
+
1374
+ # @override
1375
+ def namespace
1376
+ 'com.my-namespace'
1377
+ end
1378
+
1379
+ # @override
1380
+ def as_json(_opts={})
1381
+ {
1382
+ 'id' => @id,
1383
+ 'widget_id' => @widget_id,
1384
+ 'name' => @name,
1385
+ 'updated_at' => @updated_at,
1386
+ 'created_at' => @created_at
1387
+ }
1388
+ end
1389
+ end
1390
+ end; end
1391
+
1392
+
1393
+ spec/app/lib/schema_classes/schemas/my_namespace/widget_the_second.rb:
1394
+ # frozen_string_literal: true
1395
+
1396
+ # This file is autogenerated by Deimos, Do NOT modify
1397
+ module Schemas; module MyNamespace
1398
+ ### Primary Schema Class ###
1399
+ # Autogenerated Schema for Record at com.my-namespace.WidgetTheSecond
1400
+ class WidgetTheSecond < Deimos::SchemaClass::Record
1401
+
1402
+ ### Attribute Accessors ###
1403
+ # @return [Integer]
1404
+ attr_accessor :id
1405
+ # @return [Integer]
1406
+ attr_accessor :widget_id
1407
+ # @return [String]
1408
+ attr_accessor :model_id
1409
+ # @return [Integer]
1410
+ attr_accessor :updated_at
1411
+ # @return [Integer]
1412
+ attr_accessor :created_at
1413
+
1414
+ # @override
1415
+ def initialize(id: nil,
1416
+ widget_id: nil,
1417
+ model_id: nil,
1418
+ updated_at: nil,
1419
+ created_at: nil)
1420
+ super
1421
+ self.id = id
1422
+ self.widget_id = widget_id
1423
+ self.model_id = model_id
1424
+ self.updated_at = updated_at
1425
+ self.created_at = created_at
1426
+ end
1427
+
1428
+ # @override
1429
+ def schema
1430
+ 'WidgetTheSecond'
1431
+ end
1432
+
1433
+ # @override
1434
+ def namespace
1435
+ 'com.my-namespace'
1436
+ end
1437
+
1438
+ # @override
1439
+ def as_json(_opts={})
1440
+ {
1441
+ 'id' => @id,
1442
+ 'widget_id' => @widget_id,
1443
+ 'model_id' => @model_id,
1444
+ 'updated_at' => @updated_at,
1445
+ 'created_at' => @created_at
1446
+ }
1447
+ end
1448
+ end
1449
+ end; end
1450
+