Basic type coersion support for JSON Type Definition schemas in Ajv.
This is currently an unimplemented feature in Ajv.
Works by wrapping compiled ValidatorFunctions and handling resulting type errors.
Uses lodash for JS type checking and deep get and sets on the data object.
Supports coercing from JSON types string
, number
, boolean
, and null
to JTD types string
, uint8
, uint16
, uint32
, int8
, int16
, int32
, float32
, float64
, boolean
, and null
.
The coercion rules should mirror that of Ajv.
Coercing to arrays is currently not supported.
The implementation is in Typescript and should work fine with JTDDataType etc.