ajv
ajv copied to clipboard
Cannot serialize and then parse int32 type
What version of Ajv are you using? Does the issue happen if you use the latest version?
Using version 8.11.0
Ajv options object
const ajv = new Ajv()
JSON Schema
{
"properties": {
"foo": { "type": "int32" }
}
}
Sample data
{}
Your code
const serialize = ajv.compileSerializer(schema)
const parser = ajv.compileParser(schema)
const data = parser(serialize({}))
What results did you expect?
// data to be:
// {
// foo: undefined
// }
But got:
// data is:
// undefined
"int32"
is not a valid json schema type.
@GabenGar I've updated the header to read "JSON Type Definition (JTD)" to avoid confusion. It should be a valid JTD.