tarantool / avro-schema

Apache Avro schema tools for Tarantool
57 stars 4 forks source link

nil and box.NULL are treated differently in validate of a union #113

Closed Totktonada closed 6 years ago

Totktonada commented 6 years ago
avro = require('avro_schema')
schema = {'int', 'string', 'null'}
ok, h = avro.create(schema)
tarantool> avro.validate(h, nil)
---
- false
- 'Not a union: nil'
...

tarantool> avro.validate(h, box.NULL)
---
- true
- null
...

flatten treats them equally:

avro = require('avro_schema')
schema = {'int', 'string', 'null'}
ok, h = avro.create(schema)
ok, m = avro.compile(h)
tarantool> m.flatten(nil)
---
- true
- [2, null]
...
tarantool> m.flatten(box.NULL)
---
- true
- [2, null]
...