You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In some circumstances, I wish to disable the coercion of a property. Take for example a timestamp defined as a number. If the user provides a boolean value, I expect a validation error to be thrown and not the value true to be converted to 1 which is a valid but incorrect timestamp:
What do you think is the correct solution to problem?
My expectation is the ability to entirely or selectively disable some coercion rules, either at a global level when AJV is instantiated or at a local level when the property is defined.
At a global level:
constajv=newAjv({coerceTypes: {// all coercion rules are enabled by default beside the ones declared:boolean_to_integer: false}})
Would it be possible to simply expose a hook where we could implement our own coercion rule, I have many situation where implementing my own coersion or no coersion at all would be trivial if i could just plug my own function.
What version of Ajv you are you using?
7.0.3
What problem do you want to solve?
In some circumstances, I wish to disable the coercion of a property. Take for example a timestamp defined as a
number
. If the user provides a boolean value, I expect a validation error to be thrown and not the valuetrue
to be converted to1
which is a valid but incorrect timestamp:What do you think is the correct solution to problem?
My expectation is the ability to entirely or selectively disable some coercion rules, either at a global level when AJV is instantiated or at a local level when the property is defined.
At a global level:
At a local level:
Will you be able to implement it?
Maybe with some guidelines
The text was updated successfully, but these errors were encountered: