When I define an Avromatic class, and instantiate it, I expect all the nested records to also be instantiated. Instead, only the top-most record is instantiated, and any sub-records are nil.
Here's a simple reproduction:
Avro Schema:
{
"type": "record",
"name": "top_rec",
"namespace": "com.example",
"fields": [
{
"name": "sub",
"type": {
"type": "record",
"name": "sub_rec",
"namespace": "com.example",
"fields": [
{
"name": "i",
"type": "int"
}
]
}
}
]
}
Then we load the schema and create a class:
schema_file = File.read('top_rec.avsc')
schema = Avro::Schema.parse(schema_file)
nestedClass = Avromatic::Model.model(schema: schema)
myClass = nestedClass.new
puts myClass.inspect
Actual Result:
Expected Result:
#<TopRec sub: #<SubRec i: nil>>
Obviously, it's possible to manually instantiate the entire class hierarchy, but this quickly becomes difficult as the level of nesting increases.
When I define an Avromatic class, and instantiate it, I expect all the nested records to also be instantiated. Instead, only the top-most record is instantiated, and any sub-records are nil.
Here's a simple reproduction:
Avro Schema:
{ "type": "record", "name": "top_rec", "namespace": "com.example", "fields": [ { "name": "sub", "type": { "type": "record", "name": "sub_rec", "namespace": "com.example", "fields": [ { "name": "i", "type": "int" } ] } } ] }Then we load the schema and create a class:
Actual Result:
Expected Result:
Obviously, it's possible to manually instantiate the entire class hierarchy, but this quickly becomes difficult as the level of nesting increases.