avro-gen-ruby 0.1.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 (97) hide show
  1. checksums.yaml +7 -0
  2. data/.github/workflows/ci.yml +34 -0
  3. data/.github/workflows/release.yml +31 -0
  4. data/.gitignore +6 -0
  5. data/.rspec +1 -0
  6. data/.rubocop.yml +100 -0
  7. data/Gemfile +5 -0
  8. data/LICENSE +21 -0
  9. data/README.md +61 -0
  10. data/Rakefile +11 -0
  11. data/avro-gen-ruby.gemspec +32 -0
  12. data/lib/avro_gen/avro_parser.rb +64 -0
  13. data/lib/avro_gen/configuration.rb +60 -0
  14. data/lib/avro_gen/errors.rb +6 -0
  15. data/lib/avro_gen/generator/templates/schema_class.rb.tt +8 -0
  16. data/lib/avro_gen/generator/templates/schema_enum.rb.tt +13 -0
  17. data/lib/avro_gen/generator/templates/schema_record.rb.tt +102 -0
  18. data/lib/avro_gen/generator.rb +375 -0
  19. data/lib/avro_gen/railtie.rb +12 -0
  20. data/lib/avro_gen/schema_class/base.rb +62 -0
  21. data/lib/avro_gen/schema_class/enum.rb +48 -0
  22. data/lib/avro_gen/schema_class/record.rb +108 -0
  23. data/lib/avro_gen/schema_class.rb +62 -0
  24. data/lib/avro_gen/schema_field.rb +26 -0
  25. data/lib/avro_gen/schema_validator.rb +80 -0
  26. data/lib/avro_gen/upgrader.rb +43 -0
  27. data/lib/avro_gen/version.rb +5 -0
  28. data/lib/avro_gen.rb +18 -0
  29. data/lib/tasks/avro.rake +18 -0
  30. data/regenerate_test_schema_classes.rb +32 -0
  31. data/spec/generator_spec.rb +92 -0
  32. data/spec/my_schema_spec.rb +18 -0
  33. data/spec/my_schema_with_circular_reference_spec.rb +97 -0
  34. data/spec/my_schema_with_complex_types_spec.rb +235 -0
  35. data/spec/schema_validator_spec.rb +42 -0
  36. data/spec/schemas/com/my-namespace/Generated.avsc +77 -0
  37. data/spec/schemas/com/my-namespace/MyNestedSchema.avsc +62 -0
  38. data/spec/schemas/com/my-namespace/MySchema.avsc +18 -0
  39. data/spec/schemas/com/my-namespace/MySchemaCompound_key.avsc +18 -0
  40. data/spec/schemas/com/my-namespace/MySchemaId_key.avsc +12 -0
  41. data/spec/schemas/com/my-namespace/MySchemaWithBooleans.avsc +18 -0
  42. data/spec/schemas/com/my-namespace/MySchemaWithCircularReference.avsc +39 -0
  43. data/spec/schemas/com/my-namespace/MySchemaWithComplexTypes.avsc +120 -0
  44. data/spec/schemas/com/my-namespace/MySchemaWithDateTimes.avsc +33 -0
  45. data/spec/schemas/com/my-namespace/MySchemaWithId.avsc +28 -0
  46. data/spec/schemas/com/my-namespace/MySchemaWithTitle.avsc +22 -0
  47. data/spec/schemas/com/my-namespace/MySchemaWithUnionType.avsc +91 -0
  48. data/spec/schemas/com/my-namespace/MySchemaWithUniqueId.avsc +32 -0
  49. data/spec/schemas/com/my-namespace/MySchema_key.avsc +13 -0
  50. data/spec/schemas/com/my-namespace/Wibble.avsc +43 -0
  51. data/spec/schemas/com/my-namespace/Widget.avsc +27 -0
  52. data/spec/schemas/com/my-namespace/WidgetTheSecond.avsc +27 -0
  53. data/spec/schemas/com/my-namespace/WidgetTheThird.avsc +27 -0
  54. data/spec/schemas/com/my-namespace/my-suborg/MyLongNamespaceSchema.avsc +18 -0
  55. data/spec/schemas/com/my-namespace/request/CreateTopic.avsc +11 -0
  56. data/spec/schemas/com/my-namespace/request/Index.avsc +11 -0
  57. data/spec/schemas/com/my-namespace/request/UpdateRequest.avsc +11 -0
  58. data/spec/schemas/com/my-namespace/response/CreateTopic.avsc +11 -0
  59. data/spec/schemas/com/my-namespace/response/Index.avsc +11 -0
  60. data/spec/schemas/com/my-namespace/response/UpdateResponse.avsc +11 -0
  61. data/spec/schemas/my_namespace/generated.rb +164 -0
  62. data/spec/schemas/my_namespace/my_long_namespace_schema.rb +49 -0
  63. data/spec/schemas/my_namespace/my_nested_schema.rb +126 -0
  64. data/spec/schemas/my_namespace/my_schema.rb +62 -0
  65. data/spec/schemas/my_namespace/my_schema_compound_key.rb +42 -0
  66. data/spec/schemas/my_namespace/my_schema_id_key.rb +37 -0
  67. data/spec/schemas/my_namespace/my_schema_key.rb +37 -0
  68. data/spec/schemas/my_namespace/my_schema_with_boolean.rb +42 -0
  69. data/spec/schemas/my_namespace/my_schema_with_circular_reference.rb +84 -0
  70. data/spec/schemas/my_namespace/my_schema_with_complex_type.rb +241 -0
  71. data/spec/schemas/my_namespace/my_schema_with_date_time.rb +57 -0
  72. data/spec/schemas/my_namespace/my_schema_with_id.rb +52 -0
  73. data/spec/schemas/my_namespace/my_schema_with_title.rb +47 -0
  74. data/spec/schemas/my_namespace/my_schema_with_union_type.rb +205 -0
  75. data/spec/schemas/my_namespace/my_schema_with_unique_id.rb +57 -0
  76. data/spec/schemas/my_namespace/request/create_topic.rb +37 -0
  77. data/spec/schemas/my_namespace/request/index.rb +37 -0
  78. data/spec/schemas/my_namespace/request/update_request.rb +37 -0
  79. data/spec/schemas/my_namespace/response/create_topic.rb +37 -0
  80. data/spec/schemas/my_namespace/response/index.rb +37 -0
  81. data/spec/schemas/my_namespace/response/update_response.rb +37 -0
  82. data/spec/schemas/my_namespace/wibble.rb +77 -0
  83. data/spec/schemas/my_namespace/widget.rb +57 -0
  84. data/spec/schemas/my_namespace/widget_the_second.rb +57 -0
  85. data/spec/schemas/my_namespace/widget_the_third.rb +57 -0
  86. data/spec/snapshots/consumers-no-nest.snap +1740 -0
  87. data/spec/snapshots/consumers.snap +1720 -0
  88. data/spec/snapshots/my_nested_schema.snap +121 -0
  89. data/spec/snapshots/my_schema_with_boolean.snap +44 -0
  90. data/spec/snapshots/my_schema_with_circular_reference.snap +81 -0
  91. data/spec/snapshots/my_schema_with_complex_type.snap +236 -0
  92. data/spec/snapshots/my_schema_with_date_time.snap +59 -0
  93. data/spec/snapshots/my_schema_with_union_type.snap +207 -0
  94. data/spec/snapshots/namespace_folders.snap +1800 -0
  95. data/spec/snapshots/namespace_map.snap +1800 -0
  96. data/spec/spec_helper.rb +23 -0
  97. metadata +265 -0
@@ -0,0 +1,1740 @@
1
+ spec/app/lib/schema_classes/a_record.rb:
2
+ # frozen_string_literal: true
3
+
4
+ # This file is autogenerated by AvroGen, Do NOT modify
5
+ module Schemas
6
+ ### Primary Schema Class ###
7
+ # Autogenerated Schema for Record at com.my-namespace.ARecord
8
+ class ARecord < AvroGen::SchemaClass::Record
9
+
10
+ ### Attribute Accessors ###
11
+ # @return [String]
12
+ attr_accessor :a_record_field
13
+
14
+ # @override
15
+ def initialize(_from_message: false, a_record_field: nil)
16
+ @_from_message = _from_message
17
+ super
18
+ self.a_record_field = a_record_field
19
+ end
20
+
21
+ # @override
22
+ def schema
23
+ 'ARecord'
24
+ end
25
+
26
+ # @override
27
+ def namespace
28
+ 'com.my-namespace'
29
+ end
30
+
31
+ # @override
32
+ def as_json(_opts={})
33
+ {
34
+ 'a_record_field' => @a_record_field
35
+ }
36
+ end
37
+ end
38
+ end
39
+
40
+
41
+ spec/app/lib/schema_classes/an_enum.rb:
42
+ # frozen_string_literal: true
43
+
44
+ # This file is autogenerated by AvroGen, Do NOT modify
45
+ module Schemas
46
+ ### Primary Schema Class ###
47
+ # Autogenerated Schema for Enum at com.my-namespace.AnEnum
48
+ class AnEnum < AvroGen::SchemaClass::Enum
49
+ # @override
50
+ def symbols
51
+ %w(sym1 sym2)
52
+ end
53
+
54
+
55
+ def sym1?
56
+ @value == 'sym1'
57
+ end
58
+
59
+ def sym2?
60
+ @value == 'sym2'
61
+ end
62
+
63
+ end
64
+ end
65
+
66
+
67
+ spec/app/lib/schema_classes/another_enum.rb:
68
+ # frozen_string_literal: true
69
+
70
+ # This file is autogenerated by AvroGen, Do NOT modify
71
+ module Schemas
72
+ ### Primary Schema Class ###
73
+ # Autogenerated Schema for Enum at com.my-namespace.AnotherEnum
74
+ class AnotherEnum < AvroGen::SchemaClass::Enum
75
+ # @override
76
+ def symbols
77
+ %w(sym3 sym4)
78
+ end
79
+
80
+
81
+ def sym3?
82
+ @value == 'sym3'
83
+ end
84
+
85
+ def sym4?
86
+ @value == 'sym4'
87
+ end
88
+
89
+ end
90
+ end
91
+
92
+
93
+ spec/app/lib/schema_classes/create_topic.rb:
94
+ # frozen_string_literal: true
95
+
96
+ # This file is autogenerated by AvroGen, Do NOT modify
97
+ module Schemas
98
+ ### Primary Schema Class ###
99
+ # Autogenerated Schema for Record at com.my-namespace.response.CreateTopic
100
+ class CreateTopic < AvroGen::SchemaClass::Record
101
+
102
+ ### Attribute Accessors ###
103
+ # @return [String]
104
+ attr_accessor :response_id
105
+
106
+ # @override
107
+ def initialize(_from_message: false, response_id: nil)
108
+ @_from_message = _from_message
109
+ super
110
+ self.response_id = response_id
111
+ end
112
+
113
+ # @override
114
+ def schema
115
+ 'CreateTopic'
116
+ end
117
+
118
+ # @override
119
+ def namespace
120
+ 'com.my-namespace.response'
121
+ end
122
+
123
+ # @override
124
+ def as_json(_opts={})
125
+ {
126
+ 'response_id' => @response_id
127
+ }
128
+ end
129
+ end
130
+ end
131
+
132
+
133
+ spec/app/lib/schema_classes/generated.rb:
134
+ # frozen_string_literal: true
135
+
136
+ # This file is autogenerated by AvroGen, Do NOT modify
137
+ module Schemas
138
+ ### Primary Schema Class ###
139
+ # Autogenerated Schema for Record at com.my-namespace.Generated
140
+ class Generated < AvroGen::SchemaClass::Record
141
+
142
+ ### Attribute Readers ###
143
+ # @return [AnEnum]
144
+ attr_reader :an_enum
145
+ # @return [ARecord]
146
+ attr_reader :a_record
147
+
148
+ ### Attribute Accessors ###
149
+ # @return [String]
150
+ attr_accessor :a_string
151
+ # @return [Integer]
152
+ attr_accessor :a_int
153
+ # @return [Integer]
154
+ attr_accessor :a_long
155
+ # @return [Float]
156
+ attr_accessor :a_float
157
+ # @return [Float]
158
+ attr_accessor :a_double
159
+ # @return [nil, Integer]
160
+ attr_accessor :an_optional_int
161
+ # @return [Array<Integer>]
162
+ attr_accessor :an_array
163
+ # @return [Hash<String, String>]
164
+ attr_accessor :a_map
165
+ # @return [String]
166
+ attr_accessor :timestamp
167
+ # @return [String]
168
+ attr_accessor :message_id
169
+
170
+ ### Attribute Writers ###
171
+ # @return [AnEnum]
172
+ def an_enum=(value)
173
+ @an_enum = AnEnum.initialize_from_value(value, from_message: self._from_message)
174
+ end
175
+
176
+ # @return [ARecord]
177
+ def a_record=(value)
178
+ @a_record = ARecord.initialize_from_value(value, from_message: self._from_message)
179
+ end
180
+
181
+ # @override
182
+ def initialize(_from_message: false, a_string: nil,
183
+ a_int: nil,
184
+ a_long: nil,
185
+ a_float: nil,
186
+ a_double: nil,
187
+ an_optional_int: nil,
188
+ an_enum: nil,
189
+ an_array: nil,
190
+ a_map: nil,
191
+ timestamp: nil,
192
+ message_id: nil,
193
+ a_record: nil)
194
+ @_from_message = _from_message
195
+ super
196
+ self.a_string = a_string
197
+ self.a_int = a_int
198
+ self.a_long = a_long
199
+ self.a_float = a_float
200
+ self.a_double = a_double
201
+ self.an_optional_int = an_optional_int
202
+ self.an_enum = an_enum
203
+ self.an_array = an_array
204
+ self.a_map = a_map
205
+ self.timestamp = timestamp
206
+ self.message_id = message_id
207
+ self.a_record = a_record
208
+ end
209
+
210
+ # @override
211
+ def schema
212
+ 'Generated'
213
+ end
214
+
215
+ # @override
216
+ def namespace
217
+ 'com.my-namespace'
218
+ end
219
+
220
+ def self.tombstone(key)
221
+ record = self.allocate
222
+ record.tombstone_key = key
223
+ record.a_string = key
224
+ record
225
+ end
226
+
227
+ # @override
228
+ def as_json(_opts={})
229
+ {
230
+ 'a_string' => @a_string,
231
+ 'a_int' => @a_int,
232
+ 'a_long' => @a_long,
233
+ 'a_float' => @a_float,
234
+ 'a_double' => @a_double,
235
+ 'an_optional_int' => @an_optional_int,
236
+ 'an_enum' => @an_enum&.as_json,
237
+ 'an_array' => @an_array,
238
+ 'a_map' => @a_map,
239
+ 'timestamp' => @timestamp,
240
+ 'message_id' => @message_id,
241
+ 'a_record' => @a_record&.as_json
242
+ }
243
+ end
244
+ end
245
+ end
246
+
247
+
248
+ spec/app/lib/schema_classes/index.rb:
249
+ # frozen_string_literal: true
250
+
251
+ # This file is autogenerated by AvroGen, Do NOT modify
252
+ module Schemas
253
+ ### Primary Schema Class ###
254
+ # Autogenerated Schema for Record at com.my-namespace.response.Index
255
+ class Index < AvroGen::SchemaClass::Record
256
+
257
+ ### Attribute Accessors ###
258
+ # @return [String]
259
+ attr_accessor :response_id
260
+
261
+ # @override
262
+ def initialize(_from_message: false, response_id: nil)
263
+ @_from_message = _from_message
264
+ super
265
+ self.response_id = response_id
266
+ end
267
+
268
+ # @override
269
+ def schema
270
+ 'Index'
271
+ end
272
+
273
+ # @override
274
+ def namespace
275
+ 'com.my-namespace.response'
276
+ end
277
+
278
+ # @override
279
+ def as_json(_opts={})
280
+ {
281
+ 'response_id' => @response_id
282
+ }
283
+ end
284
+ end
285
+ end
286
+
287
+
288
+ spec/app/lib/schema_classes/my_long_namespace_schema.rb:
289
+ # frozen_string_literal: true
290
+
291
+ # This file is autogenerated by AvroGen, Do NOT modify
292
+ module Schemas
293
+ ### Primary Schema Class ###
294
+ # Autogenerated Schema for Record at com.my-namespace.my-suborg.MyLongNamespaceSchema
295
+ class MyLongNamespaceSchema < AvroGen::SchemaClass::Record
296
+
297
+ ### Attribute Accessors ###
298
+ # @return [String]
299
+ attr_accessor :test_id
300
+ # @return [Integer]
301
+ attr_accessor :some_int
302
+
303
+ # @override
304
+ def initialize(_from_message: false, test_id: nil,
305
+ some_int: nil)
306
+ @_from_message = _from_message
307
+ super
308
+ self.test_id = test_id
309
+ self.some_int = some_int
310
+ end
311
+
312
+ # @override
313
+ def schema
314
+ 'MyLongNamespaceSchema'
315
+ end
316
+
317
+ # @override
318
+ def namespace
319
+ 'com.my-namespace.my-suborg'
320
+ end
321
+
322
+ # @override
323
+ def as_json(_opts={})
324
+ {
325
+ 'test_id' => @test_id,
326
+ 'some_int' => @some_int
327
+ }
328
+ end
329
+ end
330
+ end
331
+
332
+
333
+ spec/app/lib/schema_classes/my_nested_record.rb:
334
+ # frozen_string_literal: true
335
+
336
+ # This file is autogenerated by AvroGen, Do NOT modify
337
+ module Schemas
338
+ ### Primary Schema Class ###
339
+ # Autogenerated Schema for Record at com.my-namespace.MyNestedRecord
340
+ class MyNestedRecord < AvroGen::SchemaClass::Record
341
+
342
+ ### Attribute Accessors ###
343
+ # @return [Integer]
344
+ attr_accessor :some_int
345
+ # @return [Float]
346
+ attr_accessor :some_float
347
+ # @return [String]
348
+ attr_accessor :some_string
349
+ # @return [nil, Integer]
350
+ attr_accessor :some_optional_int
351
+
352
+ # @override
353
+ def initialize(_from_message: false, some_int: nil,
354
+ some_float: nil,
355
+ some_string: nil,
356
+ some_optional_int: nil)
357
+ @_from_message = _from_message
358
+ super
359
+ self.some_int = some_int
360
+ self.some_float = some_float
361
+ self.some_string = some_string
362
+ self.some_optional_int = some_optional_int
363
+ end
364
+
365
+ # @override
366
+ def schema
367
+ 'MyNestedRecord'
368
+ end
369
+
370
+ # @override
371
+ def namespace
372
+ 'com.my-namespace'
373
+ end
374
+
375
+ # @override
376
+ def as_json(_opts={})
377
+ {
378
+ 'some_int' => @some_int,
379
+ 'some_float' => @some_float,
380
+ 'some_string' => @some_string,
381
+ 'some_optional_int' => @some_optional_int
382
+ }
383
+ end
384
+ end
385
+ end
386
+
387
+
388
+ spec/app/lib/schema_classes/my_nested_schema.rb:
389
+ # frozen_string_literal: true
390
+
391
+ # This file is autogenerated by AvroGen, Do NOT modify
392
+ module Schemas
393
+ ### Primary Schema Class ###
394
+ # Autogenerated Schema for Record at com.my-namespace.MyNestedSchema
395
+ class MyNestedSchema < AvroGen::SchemaClass::Record
396
+
397
+ ### Attribute Readers ###
398
+ # @return [MyNestedRecord]
399
+ attr_reader :some_nested_record
400
+ # @return [nil, MyNestedRecord]
401
+ attr_reader :some_optional_record
402
+
403
+ ### Attribute Accessors ###
404
+ # @return [String]
405
+ attr_accessor :test_id
406
+ # @return [Float]
407
+ attr_accessor :test_float
408
+ # @return [Array<String>]
409
+ attr_accessor :test_array
410
+
411
+ ### Attribute Writers ###
412
+ # @return [MyNestedRecord]
413
+ def some_nested_record=(value)
414
+ @some_nested_record = MyNestedRecord.initialize_from_value(value, from_message: self._from_message)
415
+ end
416
+
417
+ # @return [nil, MyNestedRecord]
418
+ def some_optional_record=(value)
419
+ @some_optional_record = MyNestedRecord.initialize_from_value(value, from_message: self._from_message)
420
+ end
421
+
422
+ # @override
423
+ def initialize(_from_message: false, test_id: nil,
424
+ test_float: nil,
425
+ test_array: nil,
426
+ some_nested_record: nil,
427
+ some_optional_record: nil)
428
+ @_from_message = _from_message
429
+ super
430
+ self.test_id = test_id
431
+ self.test_float = test_float
432
+ self.test_array = test_array
433
+ self.some_nested_record = some_nested_record
434
+ self.some_optional_record = some_optional_record
435
+ end
436
+
437
+ # @override
438
+ def schema
439
+ 'MyNestedSchema'
440
+ end
441
+
442
+ # @override
443
+ def namespace
444
+ 'com.my-namespace'
445
+ end
446
+
447
+ # @override
448
+ def as_json(_opts={})
449
+ {
450
+ 'test_id' => @test_id,
451
+ 'test_float' => @test_float,
452
+ 'test_array' => @test_array,
453
+ 'some_nested_record' => @some_nested_record&.as_json,
454
+ 'some_optional_record' => @some_optional_record&.as_json
455
+ }
456
+ end
457
+ end
458
+ end
459
+
460
+
461
+ spec/app/lib/schema_classes/my_schema.rb:
462
+ # frozen_string_literal: true
463
+
464
+ # This file is autogenerated by AvroGen, Do NOT modify
465
+ module Schemas
466
+ ### Primary Schema Class ###
467
+ # Autogenerated Schema for Record at com.my-namespace.MySchema
468
+ class MySchema < AvroGen::SchemaClass::Record
469
+
470
+ ### Attribute Accessors ###
471
+ # @return [String]
472
+ attr_accessor :test_id
473
+ # @return [Integer]
474
+ attr_accessor :some_int
475
+
476
+ # @override
477
+ def initialize(_from_message: false, test_id: nil,
478
+ some_int: nil)
479
+ @_from_message = _from_message
480
+ super
481
+ self.test_id = test_id
482
+ self.some_int = some_int
483
+ end
484
+
485
+ # @override
486
+ def schema
487
+ 'MySchema'
488
+ end
489
+
490
+ # @override
491
+ def namespace
492
+ 'com.my-namespace'
493
+ end
494
+
495
+ # @override
496
+ def as_json(_opts={})
497
+ {
498
+ 'test_id' => @test_id,
499
+ 'some_int' => @some_int
500
+ }
501
+ end
502
+ end
503
+ end
504
+
505
+
506
+ spec/app/lib/schema_classes/my_schema_compound_key.rb:
507
+ # frozen_string_literal: true
508
+
509
+ # This file is autogenerated by AvroGen, Do NOT modify
510
+ module Schemas
511
+ ### Primary Schema Class ###
512
+ # Autogenerated Schema for Record at com.my-namespace.MySchemaCompound_key
513
+ class MySchemaCompoundKey < AvroGen::SchemaClass::Record
514
+
515
+ ### Attribute Accessors ###
516
+ # @return [String]
517
+ attr_accessor :part_one
518
+ # @return [String]
519
+ attr_accessor :part_two
520
+
521
+ # @override
522
+ def initialize(_from_message: false, part_one: nil,
523
+ part_two: nil)
524
+ @_from_message = _from_message
525
+ super
526
+ self.part_one = part_one
527
+ self.part_two = part_two
528
+ end
529
+
530
+ # @override
531
+ def schema
532
+ 'MySchemaCompound_key'
533
+ end
534
+
535
+ # @override
536
+ def namespace
537
+ 'com.my-namespace'
538
+ end
539
+
540
+ # @override
541
+ def as_json(_opts={})
542
+ {
543
+ 'part_one' => @part_one,
544
+ 'part_two' => @part_two
545
+ }
546
+ end
547
+ end
548
+ end
549
+
550
+
551
+ spec/app/lib/schema_classes/my_schema_id_key.rb:
552
+ # frozen_string_literal: true
553
+
554
+ # This file is autogenerated by AvroGen, Do NOT modify
555
+ module Schemas
556
+ ### Primary Schema Class ###
557
+ # Autogenerated Schema for Record at com.my-namespace.MySchemaId_key
558
+ class MySchemaIdKey < AvroGen::SchemaClass::Record
559
+
560
+ ### Attribute Accessors ###
561
+ # @return [Integer]
562
+ attr_accessor :id
563
+
564
+ # @override
565
+ def initialize(_from_message: false, id: nil)
566
+ @_from_message = _from_message
567
+ super
568
+ self.id = id
569
+ end
570
+
571
+ # @override
572
+ def schema
573
+ 'MySchemaId_key'
574
+ end
575
+
576
+ # @override
577
+ def namespace
578
+ 'com.my-namespace'
579
+ end
580
+
581
+ # @override
582
+ def as_json(_opts={})
583
+ {
584
+ 'id' => @id
585
+ }
586
+ end
587
+ end
588
+ end
589
+
590
+
591
+ spec/app/lib/schema_classes/my_schema_key.rb:
592
+ # frozen_string_literal: true
593
+
594
+ # This file is autogenerated by AvroGen, Do NOT modify
595
+ module Schemas
596
+ ### Primary Schema Class ###
597
+ # Autogenerated Schema for Record at com.my-namespace.MySchema_key
598
+ class MySchemaKey < AvroGen::SchemaClass::Record
599
+
600
+ ### Attribute Accessors ###
601
+ # @return [String]
602
+ attr_accessor :test_id
603
+
604
+ # @override
605
+ def initialize(_from_message: false, test_id: nil)
606
+ @_from_message = _from_message
607
+ super
608
+ self.test_id = test_id
609
+ end
610
+
611
+ # @override
612
+ def schema
613
+ 'MySchema_key'
614
+ end
615
+
616
+ # @override
617
+ def namespace
618
+ 'com.my-namespace'
619
+ end
620
+
621
+ # @override
622
+ def as_json(_opts={})
623
+ {
624
+ 'test_id' => @test_id
625
+ }
626
+ end
627
+ end
628
+ end
629
+
630
+
631
+ spec/app/lib/schema_classes/my_schema_with_boolean.rb:
632
+ # frozen_string_literal: true
633
+
634
+ # This file is autogenerated by AvroGen, Do NOT modify
635
+ module Schemas
636
+ ### Primary Schema Class ###
637
+ # Autogenerated Schema for Record at com.my-namespace.MySchemaWithBooleans
638
+ class MySchemaWithBoolean < AvroGen::SchemaClass::Record
639
+
640
+ ### Attribute Accessors ###
641
+ # @return [String]
642
+ attr_accessor :test_id
643
+ # @return [Boolean]
644
+ attr_accessor :some_bool
645
+
646
+ # @override
647
+ def initialize(_from_message: false, test_id: nil,
648
+ some_bool: nil)
649
+ @_from_message = _from_message
650
+ super
651
+ self.test_id = test_id
652
+ self.some_bool = some_bool
653
+ end
654
+
655
+ # @override
656
+ def schema
657
+ 'MySchemaWithBooleans'
658
+ end
659
+
660
+ # @override
661
+ def namespace
662
+ 'com.my-namespace'
663
+ end
664
+
665
+ # @override
666
+ def as_json(_opts={})
667
+ {
668
+ 'test_id' => @test_id,
669
+ 'some_bool' => @some_bool
670
+ }
671
+ end
672
+ end
673
+ end
674
+
675
+
676
+ spec/app/lib/schema_classes/my_schema_with_circular_reference.rb:
677
+ # frozen_string_literal: true
678
+
679
+ # This file is autogenerated by AvroGen, Do NOT modify
680
+ module Schemas
681
+ ### Primary Schema Class ###
682
+ # Autogenerated Schema for Record at com.my-namespace.MySchemaWithCircularReference
683
+ class MySchemaWithCircularReference < AvroGen::SchemaClass::Record
684
+
685
+ ### Attribute Readers ###
686
+ # @return [Hash<String, Property>]
687
+ attr_reader :properties
688
+
689
+ ### Attribute Writers ###
690
+ # @return [Hash<String, Property>]
691
+ def properties=(values)
692
+ @properties = values&.transform_values do |value|
693
+ Property.initialize_from_value(value, from_message: self._from_message)
694
+ end
695
+ end
696
+
697
+ # @override
698
+ def initialize(_from_message: false, properties: {})
699
+ @_from_message = _from_message
700
+ super
701
+ self.properties = properties
702
+ end
703
+
704
+ # @override
705
+ def schema
706
+ 'MySchemaWithCircularReference'
707
+ end
708
+
709
+ # @override
710
+ def namespace
711
+ 'com.my-namespace'
712
+ end
713
+
714
+ # @override
715
+ def as_json(_opts={})
716
+ {
717
+ 'properties' => @properties.transform_values { |v| v&.as_json }
718
+ }
719
+ end
720
+ end
721
+ end
722
+
723
+
724
+ spec/app/lib/schema_classes/my_schema_with_complex_type.rb:
725
+ # frozen_string_literal: true
726
+
727
+ # This file is autogenerated by AvroGen, Do NOT modify
728
+ module Schemas
729
+ ### Primary Schema Class ###
730
+ # Autogenerated Schema for Record at com.my-namespace.MySchemaWithComplexTypes
731
+ class MySchemaWithComplexType < AvroGen::SchemaClass::Record
732
+
733
+ ### Attribute Readers ###
734
+ # @return [ARecord]
735
+ attr_reader :some_record
736
+ # @return [nil, ARecord]
737
+ attr_reader :some_optional_record
738
+ # @return [Array<ARecord>]
739
+ attr_reader :some_record_array
740
+ # @return [Hash<String, ARecord>]
741
+ attr_reader :some_record_map
742
+ # @return [Array<AnEnum>]
743
+ attr_reader :some_enum_array
744
+ # @return [nil, AnotherEnum]
745
+ attr_reader :some_optional_enum
746
+ # @return [YetAnotherEnum]
747
+ attr_reader :some_enum_with_default
748
+
749
+ ### Attribute Accessors ###
750
+ # @return [String]
751
+ attr_accessor :test_id
752
+ # @return [String, nil]
753
+ attr_accessor :union_string
754
+ # @return [Float]
755
+ attr_accessor :test_float
756
+ # @return [Array<String>]
757
+ attr_accessor :test_string_array
758
+ # @return [Array<Integer>]
759
+ attr_accessor :test_int_array
760
+ # @return [Integer, nil]
761
+ attr_accessor :test_optional_int
762
+ # @return [Hash<String, Integer>]
763
+ attr_accessor :some_integer_map
764
+
765
+ ### Attribute Writers ###
766
+ # @return [ARecord]
767
+ def some_record=(value)
768
+ @some_record = ARecord.initialize_from_value(value, from_message: self._from_message)
769
+ end
770
+
771
+ # @return [nil, ARecord]
772
+ def some_optional_record=(value)
773
+ @some_optional_record = ARecord.initialize_from_value(value, from_message: self._from_message)
774
+ end
775
+
776
+ # @return [Array<ARecord>]
777
+ def some_record_array=(values)
778
+ @some_record_array = values&.map do |value|
779
+ ARecord.initialize_from_value(value, from_message: self._from_message)
780
+ end
781
+ end
782
+
783
+ # @return [Hash<String, ARecord>]
784
+ def some_record_map=(values)
785
+ @some_record_map = values&.transform_values do |value|
786
+ ARecord.initialize_from_value(value, from_message: self._from_message)
787
+ end
788
+ end
789
+
790
+ # @return [Array<AnEnum>]
791
+ def some_enum_array=(values)
792
+ @some_enum_array = values&.map do |value|
793
+ AnEnum.initialize_from_value(value, from_message: self._from_message)
794
+ end
795
+ end
796
+
797
+ # @return [nil, AnotherEnum]
798
+ def some_optional_enum=(value)
799
+ @some_optional_enum = AnotherEnum.initialize_from_value(value, from_message: self._from_message)
800
+ end
801
+
802
+ # @return [YetAnotherEnum]
803
+ def some_enum_with_default=(value)
804
+ @some_enum_with_default = YetAnotherEnum.initialize_from_value(value, from_message: self._from_message)
805
+ end
806
+
807
+ # @override
808
+ def initialize(_from_message: false, test_id: nil,
809
+ union_string: "",
810
+ test_float: nil,
811
+ test_string_array: ["test"],
812
+ test_int_array: [123],
813
+ test_optional_int: 123,
814
+ some_integer_map: {"abc"=>123},
815
+ some_record: {"a_record_field"=>"Test String"},
816
+ some_optional_record: nil,
817
+ some_record_array: nil,
818
+ some_record_map: nil,
819
+ some_enum_array: nil,
820
+ some_optional_enum: nil,
821
+ some_enum_with_default: "sym6")
822
+ @_from_message = _from_message
823
+ super
824
+ self.test_id = test_id
825
+ self.union_string = union_string
826
+ self.test_float = test_float
827
+ self.test_string_array = test_string_array
828
+ self.test_int_array = test_int_array
829
+ self.test_optional_int = test_optional_int
830
+ self.some_integer_map = some_integer_map
831
+ self.some_record = some_record
832
+ self.some_optional_record = some_optional_record
833
+ self.some_record_array = some_record_array
834
+ self.some_record_map = some_record_map
835
+ self.some_enum_array = some_enum_array
836
+ self.some_optional_enum = some_optional_enum
837
+ self.some_enum_with_default = some_enum_with_default
838
+ end
839
+
840
+ # @override
841
+ def schema
842
+ 'MySchemaWithComplexTypes'
843
+ end
844
+
845
+ # @override
846
+ def namespace
847
+ 'com.my-namespace'
848
+ end
849
+
850
+ # @override
851
+ def as_json(_opts={})
852
+ {
853
+ 'test_id' => @test_id,
854
+ 'union_string' => @union_string,
855
+ 'test_float' => @test_float,
856
+ 'test_string_array' => @test_string_array,
857
+ 'test_int_array' => @test_int_array,
858
+ 'test_optional_int' => @test_optional_int,
859
+ 'some_integer_map' => @some_integer_map,
860
+ 'some_record' => @some_record&.as_json,
861
+ 'some_optional_record' => @some_optional_record&.as_json,
862
+ 'some_record_array' => @some_record_array.map { |v| v&.as_json },
863
+ 'some_record_map' => @some_record_map.transform_values { |v| v&.as_json },
864
+ 'some_enum_array' => @some_enum_array.map { |v| v&.as_json },
865
+ 'some_optional_enum' => @some_optional_enum&.as_json,
866
+ 'some_enum_with_default' => @some_enum_with_default&.as_json
867
+ }
868
+ end
869
+ end
870
+ end
871
+
872
+
873
+ spec/app/lib/schema_classes/my_schema_with_date_time.rb:
874
+ # frozen_string_literal: true
875
+
876
+ # This file is autogenerated by AvroGen, Do NOT modify
877
+ module Schemas
878
+ ### Primary Schema Class ###
879
+ # Autogenerated Schema for Record at com.my-namespace.MySchemaWithDateTimes
880
+ class MySchemaWithDateTime < AvroGen::SchemaClass::Record
881
+
882
+ ### Attribute Accessors ###
883
+ # @return [String]
884
+ attr_accessor :test_id
885
+ # @return [Integer, nil]
886
+ attr_accessor :updated_at
887
+ # @return [nil, Integer]
888
+ attr_accessor :some_int
889
+ # @return [nil, Integer]
890
+ attr_accessor :some_datetime_int
891
+ # @return [String]
892
+ attr_accessor :timestamp
893
+
894
+ # @override
895
+ def initialize(_from_message: false, test_id: nil,
896
+ updated_at: nil,
897
+ some_int: nil,
898
+ some_datetime_int: nil,
899
+ timestamp: nil)
900
+ @_from_message = _from_message
901
+ super
902
+ self.test_id = test_id
903
+ self.updated_at = updated_at
904
+ self.some_int = some_int
905
+ self.some_datetime_int = some_datetime_int
906
+ self.timestamp = timestamp
907
+ end
908
+
909
+ # @override
910
+ def schema
911
+ 'MySchemaWithDateTimes'
912
+ end
913
+
914
+ # @override
915
+ def namespace
916
+ 'com.my-namespace'
917
+ end
918
+
919
+ # @override
920
+ def as_json(_opts={})
921
+ {
922
+ 'test_id' => @test_id,
923
+ 'updated_at' => @updated_at,
924
+ 'some_int' => @some_int,
925
+ 'some_datetime_int' => @some_datetime_int,
926
+ 'timestamp' => @timestamp
927
+ }
928
+ end
929
+ end
930
+ end
931
+
932
+
933
+ spec/app/lib/schema_classes/my_schema_with_id.rb:
934
+ # frozen_string_literal: true
935
+
936
+ # This file is autogenerated by AvroGen, Do NOT modify
937
+ module Schemas
938
+ ### Primary Schema Class ###
939
+ # Autogenerated Schema for Record at com.my-namespace.MySchemaWithId
940
+ class MySchemaWithId < AvroGen::SchemaClass::Record
941
+
942
+ ### Attribute Accessors ###
943
+ # @return [String]
944
+ attr_accessor :test_id
945
+ # @return [Integer]
946
+ attr_accessor :some_int
947
+ # @return [String]
948
+ attr_accessor :message_id
949
+ # @return [String]
950
+ attr_accessor :timestamp
951
+
952
+ # @override
953
+ def initialize(_from_message: false, test_id: nil,
954
+ some_int: nil,
955
+ message_id: nil,
956
+ timestamp: nil)
957
+ @_from_message = _from_message
958
+ super
959
+ self.test_id = test_id
960
+ self.some_int = some_int
961
+ self.message_id = message_id
962
+ self.timestamp = timestamp
963
+ end
964
+
965
+ # @override
966
+ def schema
967
+ 'MySchemaWithId'
968
+ end
969
+
970
+ # @override
971
+ def namespace
972
+ 'com.my-namespace'
973
+ end
974
+
975
+ # @override
976
+ def as_json(_opts={})
977
+ {
978
+ 'test_id' => @test_id,
979
+ 'some_int' => @some_int,
980
+ 'message_id' => @message_id,
981
+ 'timestamp' => @timestamp
982
+ }
983
+ end
984
+ end
985
+ end
986
+
987
+
988
+ spec/app/lib/schema_classes/my_schema_with_title.rb:
989
+ # frozen_string_literal: true
990
+
991
+ # This file is autogenerated by AvroGen, Do NOT modify
992
+ module Schemas
993
+ ### Primary Schema Class ###
994
+ # Autogenerated Schema for Record at com.my-namespace.MySchemaWithTitle
995
+ class MySchemaWithTitle < AvroGen::SchemaClass::Record
996
+
997
+ ### Attribute Accessors ###
998
+ # @return [String]
999
+ attr_accessor :test_id
1000
+ # @return [Integer]
1001
+ attr_accessor :some_int
1002
+ # @return [String]
1003
+ attr_accessor :title
1004
+
1005
+ # @override
1006
+ def initialize(_from_message: false, test_id: nil,
1007
+ some_int: nil,
1008
+ title: nil)
1009
+ @_from_message = _from_message
1010
+ super
1011
+ self.test_id = test_id
1012
+ self.some_int = some_int
1013
+ self.title = title
1014
+ end
1015
+
1016
+ # @override
1017
+ def schema
1018
+ 'MySchemaWithTitle'
1019
+ end
1020
+
1021
+ # @override
1022
+ def namespace
1023
+ 'com.my-namespace'
1024
+ end
1025
+
1026
+ # @override
1027
+ def as_json(_opts={})
1028
+ {
1029
+ 'test_id' => @test_id,
1030
+ 'some_int' => @some_int,
1031
+ 'title' => @title
1032
+ }
1033
+ end
1034
+ end
1035
+ end
1036
+
1037
+
1038
+ spec/app/lib/schema_classes/my_schema_with_union_type.rb:
1039
+ # frozen_string_literal: true
1040
+
1041
+ # This file is autogenerated by AvroGen, Do NOT modify
1042
+ module Schemas
1043
+ ### Primary Schema Class ###
1044
+ # Autogenerated Schema for Record at com.my-namespace.MySchemaWithUnionType
1045
+ class MySchemaWithUnionType < AvroGen::SchemaClass::Record
1046
+
1047
+ ### Attribute Readers ###
1048
+ # @return [nil, Record1, Record2, Record3, Record4, Integer, Array<String>]
1049
+ attr_reader :test_union_type
1050
+
1051
+ ### Attribute Accessors ###
1052
+ # @return [String]
1053
+ attr_accessor :test_id
1054
+ # @return [nil, Integer]
1055
+ attr_accessor :test_long
1056
+
1057
+ ### Attribute Writers ###
1058
+ # @return [nil, Record1, Record2, Record3, Record4, Integer, Array<String>]
1059
+ def test_union_type=(value)
1060
+ @test_union_type = initialize_test_union_type_type(value, from_message: self._from_message)
1061
+ end
1062
+
1063
+ # Helper method to determine which schema type to use for test_union_type
1064
+ # @param value [Hash, nil]
1065
+ # @param from_message [Boolean] whether this was initialized from a real Avro message
1066
+ # @return [Object, nil]
1067
+ def initialize_test_union_type_type(value, from_message: false)
1068
+ return nil if value.nil?
1069
+
1070
+ klass = [Record1, Record2, Record3, Record4].find do |candidate|
1071
+ fields = candidate.new.as_json.keys
1072
+ (value.keys - fields).empty?
1073
+ end
1074
+
1075
+ klass.initialize_from_value(value, from_message: self._from_message)
1076
+ end
1077
+
1078
+ # @override
1079
+ def initialize(_from_message: false, test_id: "",
1080
+ test_long: nil,
1081
+ test_union_type: nil)
1082
+ @_from_message = _from_message
1083
+ super
1084
+ self.test_id = test_id
1085
+ self.test_long = test_long
1086
+ self.test_union_type = test_union_type
1087
+ end
1088
+
1089
+ # @override
1090
+ def schema
1091
+ 'MySchemaWithUnionType'
1092
+ end
1093
+
1094
+ # @override
1095
+ def namespace
1096
+ 'com.my-namespace'
1097
+ end
1098
+
1099
+ # @override
1100
+ def as_json(_opts={})
1101
+ {
1102
+ 'test_id' => @test_id,
1103
+ 'test_long' => @test_long,
1104
+ 'test_union_type' => @test_union_type&.as_json
1105
+ }
1106
+ end
1107
+ end
1108
+ end
1109
+
1110
+
1111
+ spec/app/lib/schema_classes/my_schema_with_unique_id.rb:
1112
+ # frozen_string_literal: true
1113
+
1114
+ # This file is autogenerated by AvroGen, Do NOT modify
1115
+ module Schemas
1116
+ ### Primary Schema Class ###
1117
+ # Autogenerated Schema for Record at com.my-namespace.MySchemaWithUniqueId
1118
+ class MySchemaWithUniqueId < AvroGen::SchemaClass::Record
1119
+
1120
+ ### Attribute Accessors ###
1121
+ # @return [Integer]
1122
+ attr_accessor :id
1123
+ # @return [String]
1124
+ attr_accessor :test_id
1125
+ # @return [Integer]
1126
+ attr_accessor :some_int
1127
+ # @return [String]
1128
+ attr_accessor :message_id
1129
+ # @return [String]
1130
+ attr_accessor :timestamp
1131
+
1132
+ # @override
1133
+ def initialize(_from_message: false, id: nil,
1134
+ test_id: nil,
1135
+ some_int: nil,
1136
+ message_id: nil,
1137
+ timestamp: nil)
1138
+ @_from_message = _from_message
1139
+ super
1140
+ self.id = id
1141
+ self.test_id = test_id
1142
+ self.some_int = some_int
1143
+ self.message_id = message_id
1144
+ self.timestamp = timestamp
1145
+ end
1146
+
1147
+ # @override
1148
+ def schema
1149
+ 'MySchemaWithUniqueId'
1150
+ end
1151
+
1152
+ # @override
1153
+ def namespace
1154
+ 'com.my-namespace'
1155
+ end
1156
+
1157
+ # @override
1158
+ def as_json(_opts={})
1159
+ {
1160
+ 'id' => @id,
1161
+ 'test_id' => @test_id,
1162
+ 'some_int' => @some_int,
1163
+ 'message_id' => @message_id,
1164
+ 'timestamp' => @timestamp
1165
+ }
1166
+ end
1167
+ end
1168
+ end
1169
+
1170
+
1171
+ spec/app/lib/schema_classes/property.rb:
1172
+ # frozen_string_literal: true
1173
+
1174
+ # This file is autogenerated by AvroGen, Do NOT modify
1175
+ module Schemas
1176
+ ### Primary Schema Class ###
1177
+ # Autogenerated Schema for Record at com.my-namespace.Property
1178
+ class Property < AvroGen::SchemaClass::Record
1179
+
1180
+ ### Attribute Accessors ###
1181
+ # @return [Boolean, Integer, Integer, Float, Float, String, Array<Property>, Hash<String, Property>]
1182
+ attr_accessor :property
1183
+
1184
+ # @override
1185
+ def initialize(_from_message: false, property: nil)
1186
+ @_from_message = _from_message
1187
+ super
1188
+ self.property = property
1189
+ end
1190
+
1191
+ # @override
1192
+ def schema
1193
+ 'Property'
1194
+ end
1195
+
1196
+ # @override
1197
+ def namespace
1198
+ 'com.my-namespace'
1199
+ end
1200
+
1201
+ # @override
1202
+ def as_json(_opts={})
1203
+ {
1204
+ 'property' => @property
1205
+ }
1206
+ end
1207
+ end
1208
+ end
1209
+
1210
+
1211
+ spec/app/lib/schema_classes/record1.rb:
1212
+ # frozen_string_literal: true
1213
+
1214
+ # This file is autogenerated by AvroGen, Do NOT modify
1215
+ module Schemas
1216
+ ### Primary Schema Class ###
1217
+ # Autogenerated Schema for Record at com.flipp.content.Record1
1218
+ class Record1 < AvroGen::SchemaClass::Record
1219
+
1220
+ ### Attribute Accessors ###
1221
+ # @return [Hash<String, Integer>]
1222
+ attr_accessor :record1_map
1223
+ # @return [Integer]
1224
+ attr_accessor :record1_id
1225
+
1226
+ # @override
1227
+ def initialize(_from_message: false, record1_map: {},
1228
+ record1_id: 0)
1229
+ @_from_message = _from_message
1230
+ super
1231
+ self.record1_map = record1_map
1232
+ self.record1_id = record1_id
1233
+ end
1234
+
1235
+ # @override
1236
+ def schema
1237
+ 'Record1'
1238
+ end
1239
+
1240
+ # @override
1241
+ def namespace
1242
+ 'com.flipp.content'
1243
+ end
1244
+
1245
+ # @override
1246
+ def as_json(_opts={})
1247
+ {
1248
+ 'record1_map' => @record1_map,
1249
+ 'record1_id' => @record1_id
1250
+ }
1251
+ end
1252
+ end
1253
+ end
1254
+
1255
+
1256
+ spec/app/lib/schema_classes/record2.rb:
1257
+ # frozen_string_literal: true
1258
+
1259
+ # This file is autogenerated by AvroGen, Do NOT modify
1260
+ module Schemas
1261
+ ### Primary Schema Class ###
1262
+ # Autogenerated Schema for Record at com.flipp.content.Record2
1263
+ class Record2 < AvroGen::SchemaClass::Record
1264
+
1265
+ ### Attribute Accessors ###
1266
+ # @return [String]
1267
+ attr_accessor :record2_id
1268
+
1269
+ # @override
1270
+ def initialize(_from_message: false, record2_id: "")
1271
+ @_from_message = _from_message
1272
+ super
1273
+ self.record2_id = record2_id
1274
+ end
1275
+
1276
+ # @override
1277
+ def schema
1278
+ 'Record2'
1279
+ end
1280
+
1281
+ # @override
1282
+ def namespace
1283
+ 'com.flipp.content'
1284
+ end
1285
+
1286
+ # @override
1287
+ def as_json(_opts={})
1288
+ {
1289
+ 'record2_id' => @record2_id
1290
+ }
1291
+ end
1292
+ end
1293
+ end
1294
+
1295
+
1296
+ spec/app/lib/schema_classes/record3.rb:
1297
+ # frozen_string_literal: true
1298
+
1299
+ # This file is autogenerated by AvroGen, Do NOT modify
1300
+ module Schemas
1301
+ ### Primary Schema Class ###
1302
+ # Autogenerated Schema for Record at com.flipp.content.Record3
1303
+ class Record3 < AvroGen::SchemaClass::Record
1304
+
1305
+ ### Attribute Accessors ###
1306
+ # @return [Float]
1307
+ attr_accessor :record3_id
1308
+
1309
+ # @override
1310
+ def initialize(_from_message: false, record3_id: 0.0)
1311
+ @_from_message = _from_message
1312
+ super
1313
+ self.record3_id = record3_id
1314
+ end
1315
+
1316
+ # @override
1317
+ def schema
1318
+ 'Record3'
1319
+ end
1320
+
1321
+ # @override
1322
+ def namespace
1323
+ 'com.flipp.content'
1324
+ end
1325
+
1326
+ # @override
1327
+ def as_json(_opts={})
1328
+ {
1329
+ 'record3_id' => @record3_id
1330
+ }
1331
+ end
1332
+ end
1333
+ end
1334
+
1335
+
1336
+ spec/app/lib/schema_classes/record4.rb:
1337
+ # frozen_string_literal: true
1338
+
1339
+ # This file is autogenerated by AvroGen, Do NOT modify
1340
+ module Schemas
1341
+ ### Primary Schema Class ###
1342
+ # Autogenerated Schema for Record at com.flipp.content.Record4
1343
+ class Record4 < AvroGen::SchemaClass::Record
1344
+
1345
+ ### Attribute Accessors ###
1346
+ # @return [Integer]
1347
+ attr_accessor :record4_id
1348
+
1349
+ # @override
1350
+ def initialize(_from_message: false, record4_id: 0)
1351
+ @_from_message = _from_message
1352
+ super
1353
+ self.record4_id = record4_id
1354
+ end
1355
+
1356
+ # @override
1357
+ def schema
1358
+ 'Record4'
1359
+ end
1360
+
1361
+ # @override
1362
+ def namespace
1363
+ 'com.flipp.content'
1364
+ end
1365
+
1366
+ # @override
1367
+ def as_json(_opts={})
1368
+ {
1369
+ 'record4_id' => @record4_id
1370
+ }
1371
+ end
1372
+ end
1373
+ end
1374
+
1375
+
1376
+ spec/app/lib/schema_classes/update_request.rb:
1377
+ # frozen_string_literal: true
1378
+
1379
+ # This file is autogenerated by AvroGen, Do NOT modify
1380
+ module Schemas
1381
+ ### Primary Schema Class ###
1382
+ # Autogenerated Schema for Record at com.my-namespace.request.UpdateRequest
1383
+ class UpdateRequest < AvroGen::SchemaClass::Record
1384
+
1385
+ ### Attribute Accessors ###
1386
+ # @return [String]
1387
+ attr_accessor :update_request_id
1388
+
1389
+ # @override
1390
+ def initialize(_from_message: false, update_request_id: nil)
1391
+ @_from_message = _from_message
1392
+ super
1393
+ self.update_request_id = update_request_id
1394
+ end
1395
+
1396
+ # @override
1397
+ def schema
1398
+ 'UpdateRequest'
1399
+ end
1400
+
1401
+ # @override
1402
+ def namespace
1403
+ 'com.my-namespace.request'
1404
+ end
1405
+
1406
+ # @override
1407
+ def as_json(_opts={})
1408
+ {
1409
+ 'update_request_id' => @update_request_id
1410
+ }
1411
+ end
1412
+ end
1413
+ end
1414
+
1415
+
1416
+ spec/app/lib/schema_classes/update_response.rb:
1417
+ # frozen_string_literal: true
1418
+
1419
+ # This file is autogenerated by AvroGen, Do NOT modify
1420
+ module Schemas
1421
+ ### Primary Schema Class ###
1422
+ # Autogenerated Schema for Record at com.my-namespace.response.UpdateResponse
1423
+ class UpdateResponse < AvroGen::SchemaClass::Record
1424
+
1425
+ ### Attribute Accessors ###
1426
+ # @return [String]
1427
+ attr_accessor :update_response_id
1428
+
1429
+ # @override
1430
+ def initialize(_from_message: false, update_response_id: nil)
1431
+ @_from_message = _from_message
1432
+ super
1433
+ self.update_response_id = update_response_id
1434
+ end
1435
+
1436
+ # @override
1437
+ def schema
1438
+ 'UpdateResponse'
1439
+ end
1440
+
1441
+ # @override
1442
+ def namespace
1443
+ 'com.my-namespace.response'
1444
+ end
1445
+
1446
+ # @override
1447
+ def as_json(_opts={})
1448
+ {
1449
+ 'update_response_id' => @update_response_id
1450
+ }
1451
+ end
1452
+ end
1453
+ end
1454
+
1455
+
1456
+ spec/app/lib/schema_classes/wibble.rb:
1457
+ # frozen_string_literal: true
1458
+
1459
+ # This file is autogenerated by AvroGen, Do NOT modify
1460
+ module Schemas
1461
+ ### Primary Schema Class ###
1462
+ # Autogenerated Schema for Record at com.my-namespace.Wibble
1463
+ class Wibble < AvroGen::SchemaClass::Record
1464
+
1465
+ ### Attribute Accessors ###
1466
+ # @return [Integer]
1467
+ attr_accessor :id
1468
+ # @return [Integer]
1469
+ attr_accessor :wibble_id
1470
+ # @return [String]
1471
+ attr_accessor :name
1472
+ # @return [String]
1473
+ attr_accessor :floop
1474
+ # @return [Integer]
1475
+ attr_accessor :birthday_int
1476
+ # @return [Integer]
1477
+ attr_accessor :birthday_long
1478
+ # @return [nil, Integer]
1479
+ attr_accessor :birthday_optional
1480
+ # @return [Integer]
1481
+ attr_accessor :updated_at
1482
+ # @return [Integer]
1483
+ attr_accessor :created_at
1484
+
1485
+ # @override
1486
+ def initialize(_from_message: false, id: nil,
1487
+ wibble_id: nil,
1488
+ name: nil,
1489
+ floop: nil,
1490
+ birthday_int: nil,
1491
+ birthday_long: nil,
1492
+ birthday_optional: nil,
1493
+ updated_at: nil,
1494
+ created_at: nil)
1495
+ @_from_message = _from_message
1496
+ super
1497
+ self.id = id
1498
+ self.wibble_id = wibble_id
1499
+ self.name = name
1500
+ self.floop = floop
1501
+ self.birthday_int = birthday_int
1502
+ self.birthday_long = birthday_long
1503
+ self.birthday_optional = birthday_optional
1504
+ self.updated_at = updated_at
1505
+ self.created_at = created_at
1506
+ end
1507
+
1508
+ # @override
1509
+ def schema
1510
+ 'Wibble'
1511
+ end
1512
+
1513
+ # @override
1514
+ def namespace
1515
+ 'com.my-namespace'
1516
+ end
1517
+
1518
+ # @override
1519
+ def as_json(_opts={})
1520
+ {
1521
+ 'id' => @id,
1522
+ 'wibble_id' => @wibble_id,
1523
+ 'name' => @name,
1524
+ 'floop' => @floop,
1525
+ 'birthday_int' => @birthday_int,
1526
+ 'birthday_long' => @birthday_long,
1527
+ 'birthday_optional' => @birthday_optional,
1528
+ 'updated_at' => @updated_at,
1529
+ 'created_at' => @created_at
1530
+ }
1531
+ end
1532
+ end
1533
+ end
1534
+
1535
+
1536
+ spec/app/lib/schema_classes/widget.rb:
1537
+ # frozen_string_literal: true
1538
+
1539
+ # This file is autogenerated by AvroGen, Do NOT modify
1540
+ module Schemas
1541
+ ### Primary Schema Class ###
1542
+ # Autogenerated Schema for Record at com.my-namespace.Widget
1543
+ class Widget < AvroGen::SchemaClass::Record
1544
+
1545
+ ### Attribute Accessors ###
1546
+ # @return [Integer]
1547
+ attr_accessor :id
1548
+ # @return [Integer]
1549
+ attr_accessor :widget_id
1550
+ # @return [String]
1551
+ attr_accessor :name
1552
+ # @return [Integer]
1553
+ attr_accessor :updated_at
1554
+ # @return [Integer]
1555
+ attr_accessor :created_at
1556
+
1557
+ # @override
1558
+ def initialize(_from_message: false, id: nil,
1559
+ widget_id: nil,
1560
+ name: nil,
1561
+ updated_at: nil,
1562
+ created_at: nil)
1563
+ @_from_message = _from_message
1564
+ super
1565
+ self.id = id
1566
+ self.widget_id = widget_id
1567
+ self.name = name
1568
+ self.updated_at = updated_at
1569
+ self.created_at = created_at
1570
+ end
1571
+
1572
+ # @override
1573
+ def schema
1574
+ 'Widget'
1575
+ end
1576
+
1577
+ # @override
1578
+ def namespace
1579
+ 'com.my-namespace'
1580
+ end
1581
+
1582
+ # @override
1583
+ def as_json(_opts={})
1584
+ {
1585
+ 'id' => @id,
1586
+ 'widget_id' => @widget_id,
1587
+ 'name' => @name,
1588
+ 'updated_at' => @updated_at,
1589
+ 'created_at' => @created_at
1590
+ }
1591
+ end
1592
+ end
1593
+ end
1594
+
1595
+
1596
+ spec/app/lib/schema_classes/widget_the_second.rb:
1597
+ # frozen_string_literal: true
1598
+
1599
+ # This file is autogenerated by AvroGen, Do NOT modify
1600
+ module Schemas
1601
+ ### Primary Schema Class ###
1602
+ # Autogenerated Schema for Record at com.my-namespace.WidgetTheSecond
1603
+ class WidgetTheSecond < AvroGen::SchemaClass::Record
1604
+
1605
+ ### Attribute Accessors ###
1606
+ # @return [Integer]
1607
+ attr_accessor :id
1608
+ # @return [Integer]
1609
+ attr_accessor :widget_id
1610
+ # @return [String]
1611
+ attr_accessor :model_id
1612
+ # @return [Integer]
1613
+ attr_accessor :updated_at
1614
+ # @return [Integer]
1615
+ attr_accessor :created_at
1616
+
1617
+ # @override
1618
+ def initialize(_from_message: false, id: nil,
1619
+ widget_id: nil,
1620
+ model_id: nil,
1621
+ updated_at: nil,
1622
+ created_at: nil)
1623
+ @_from_message = _from_message
1624
+ super
1625
+ self.id = id
1626
+ self.widget_id = widget_id
1627
+ self.model_id = model_id
1628
+ self.updated_at = updated_at
1629
+ self.created_at = created_at
1630
+ end
1631
+
1632
+ # @override
1633
+ def schema
1634
+ 'WidgetTheSecond'
1635
+ end
1636
+
1637
+ # @override
1638
+ def namespace
1639
+ 'com.my-namespace'
1640
+ end
1641
+
1642
+ # @override
1643
+ def as_json(_opts={})
1644
+ {
1645
+ 'id' => @id,
1646
+ 'widget_id' => @widget_id,
1647
+ 'model_id' => @model_id,
1648
+ 'updated_at' => @updated_at,
1649
+ 'created_at' => @created_at
1650
+ }
1651
+ end
1652
+ end
1653
+ end
1654
+
1655
+
1656
+ spec/app/lib/schema_classes/widget_the_third.rb:
1657
+ # frozen_string_literal: true
1658
+
1659
+ # This file is autogenerated by AvroGen, Do NOT modify
1660
+ module Schemas
1661
+ ### Primary Schema Class ###
1662
+ # Autogenerated Schema for Record at com.my-namespace.WidgetTheThird
1663
+ class WidgetTheThird < AvroGen::SchemaClass::Record
1664
+
1665
+ ### Attribute Accessors ###
1666
+ # @return [String]
1667
+ attr_accessor :id
1668
+ # @return [Integer]
1669
+ attr_accessor :widget_id
1670
+ # @return [String]
1671
+ attr_accessor :model_id
1672
+ # @return [Integer]
1673
+ attr_accessor :updated_at
1674
+ # @return [Integer]
1675
+ attr_accessor :created_at
1676
+
1677
+ # @override
1678
+ def initialize(_from_message: false, id: nil,
1679
+ widget_id: nil,
1680
+ model_id: nil,
1681
+ updated_at: nil,
1682
+ created_at: nil)
1683
+ @_from_message = _from_message
1684
+ super
1685
+ self.id = id
1686
+ self.widget_id = widget_id
1687
+ self.model_id = model_id
1688
+ self.updated_at = updated_at
1689
+ self.created_at = created_at
1690
+ end
1691
+
1692
+ # @override
1693
+ def schema
1694
+ 'WidgetTheThird'
1695
+ end
1696
+
1697
+ # @override
1698
+ def namespace
1699
+ 'com.my-namespace'
1700
+ end
1701
+
1702
+ # @override
1703
+ def as_json(_opts={})
1704
+ {
1705
+ 'id' => @id,
1706
+ 'widget_id' => @widget_id,
1707
+ 'model_id' => @model_id,
1708
+ 'updated_at' => @updated_at,
1709
+ 'created_at' => @created_at
1710
+ }
1711
+ end
1712
+ end
1713
+ end
1714
+
1715
+
1716
+ spec/app/lib/schema_classes/yet_another_enum.rb:
1717
+ # frozen_string_literal: true
1718
+
1719
+ # This file is autogenerated by AvroGen, Do NOT modify
1720
+ module Schemas
1721
+ ### Primary Schema Class ###
1722
+ # Autogenerated Schema for Enum at com.my-namespace.YetAnotherEnum
1723
+ class YetAnotherEnum < AvroGen::SchemaClass::Enum
1724
+ # @override
1725
+ def symbols
1726
+ %w(sym5 sym6)
1727
+ end
1728
+
1729
+
1730
+ def sym5?
1731
+ @value == 'sym5'
1732
+ end
1733
+
1734
+ def sym6?
1735
+ @value == 'sym6'
1736
+ end
1737
+
1738
+ end
1739
+ end
1740
+