ajv-keywords
ajv-keywords copied to clipboard
`transform` Addtions (WIP)
Just jotting down notes for after https://github.com/epoberezkin/ajv-keywords/pull/64 is merged
-
[ ] Allow options, similar to
dynamicDefaults -
[ ]
toEnumCasehave option to ignore certain char when determining uniqueness ie strip out,and- -
[ ] replace string or regex
-
[ ] strip html tags w/ options (alias of replace w/ defaults)
-
[ ] review idea of having addons for more complex/custom transforms
- [ ] xss
-
[ ] leftPad/rightPad/regexPad/patternCoerce string. ie
1:45->01:45:00.000 -
[ ] floor/ceil number
Options: (WIP)
{
"type":"object",
"transforms":{
"$defaults":{
},
"name":{
"toEnumCase":{"ignorePattern":"[\.]", "ignore":[",","-"]}
},
"time":{
}
}
}
Ref: https://github.com/epoberezkin/ajv-keywords/pull/64
Instead of trying to include all the cases for the possible needed transform see if it's possible to have the transform keyword take a custom function
{
transform:['trim', (x) => x+'string']
}
@khaledosama999 having javascript inside of json will break other things (linter for example). ajv v7 has some new abilities that allow #99 to be more possible. I can see the transform keyword disappearing at some point in favour of a collection of custom keywords that can do the transform.
So right now what is the solution? I want to encode incoming URLs that include spaces so is there any way to do that right now ?
There isn't a solution right now that I'm aware of.