tarantool/avro-schema

wrap strings into quotes in error messages

Khatskevich opened this issue · 1 comments

local json = require('json')
local schema, ok, res, handle, obj
local schema =
[[
{
    "fields": [
      {
        "name": "f1",
        "type": "int"
      },
      {
        "name": "union",
        "type": [
          "null",
          "int",
          "string"
        ],
        "default": "null"
      }
    ],
    "type": "record",
    "name": "X"
  }
]]


schema = json.decode(schema)
print(schema.fields[2].default)
ok, handle = avro.create(schema)
print("create", json.encode(handle))
res = avro.export(handle)
print("export", json.encode(res))

error is

X/union: Default value not valid (Not a null: null)

whch is a little confusing, I prefer

X/union: Default value not valid (Not a null: "null")

@racktear suggests

expected null, got string