avro-schema icon indicating copy to clipboard operation
avro-schema copied to clipboard

flatten({}) fails on a 'record' schema with all fields have default values

Open Totktonada opened this issue 7 years ago • 1 comments

#!/usr/bin/tarantool

local avro = require('avro_schema')
local yaml = require('yaml')

local schema={
    name='example',
    type='record',
    fields={
        {name='f1', type='long', default=0},
        {name='f2', type='long', default=0},
        {name='f3', type='long', default=0},
    }   
}

local _, created = avro.create(schema)
local _, compiled = avro.compile(created)
local _, fl = compiled.flatten({})
print(yaml.encode(fl))

Expected:

--- [0, 0, 0]
...

Got:

--- Expecting MAP, encountered ARRAY
...

Totktonada avatar Apr 12 '17 19:04 Totktonada

Still actual (Avro 3.0).

Khatskevich avatar Aug 10 '18 17:08 Khatskevich