ajv-keywords
ajv-keywords copied to clipboard
transfom: ['trim'] becomes empty after compile
Not sure this is ajv-keywords bug or ajv itself, or even this is a bug of a feature)) But it was very tricky to find out why transform trim sometimes doesn't work
It turns that ajv.compile spoils my userSchema after first call and array items are vanished
"ajv": "^8.6.3", "ajv-keywords": "^5.0.0",
console.log(JSON.stringify(userSchema))
//{"type":"object","properties":{"id":{"type":"string","allOf":[{"transform":["trim"] ...
ajv.compile(userSchema)
console.log(JSON.stringify(userSchema))
//{"type":"object","properties":{"id":{"type":"string","allOf":[{"transform":[]...
const validate = ajv.compile(userSchema)
This is not expected behavior
should I use deep clone for schemas to avoid this? or is there any better solution?
I need to reproduce - looks like it’s a big, should be fixed