how to validate with yup since yup is Standard Schema compatible?
in very short, if i pass
yup.number() to a onChange field validator i get an error async function passed to sync validator.
i checked the ~standard prop of the schema and the validate prop is an async function. so it makes sense that the error is thrown since i see that the standardSchemaValidator checks this. but which is the right way to add the yup schema?3 Replies
genetic-orange•3mo ago
weird. I guess you can use
onChangeAsync?
but I'm fairly certain that sync/async is covered by standard schema specconscious-sapphireOP•3mo ago
yeah i tried it. it will work but i want to do different async serverside checks after sync checks
i think the implementation of standard schema in yup is not 100% correct
in each case the schema returns a async function under .validate
genetic-orange•3mo ago
use the method instead then
formApi.parseValuesWithSchemaAsync()
lets you combine callbacks with other things as well as have standard schema