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