ajv-validator / ajv-validator/ajv-keywords

transfom: ['trim'] becomes empty after compile

Open
#219 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
257
Forks
51
PR merge metrics
No merged PRs in 30d

Description

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

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.