Closed Enzyoh closed 4 years ago
You can find more info on using yup.when
here - https://www.npmjs.com/package/yup#mixedwhenkeys-string--arraystring-builder-object--value-schema-schema-schema
And also the validationSchema
accepts a yup schema directly, more info - https://formik.org/docs/api/withFormik#validationschema-schema--props-props--schema
Feel free to re-open the issue, if you need more help around this.
Recommend looking at work-around in #506 for anyone else coming to this issue (i.e. define validate
function to mimic the validationSchema
behavior).
❓Question
In using Yup independently of Formik, I can pass options during the validation process. Something like
yupSchema.validate(sampleObjectToValidate, {context: {options})
This is very handy when you use 'when' (want to conditionally change your schema with different code paths). How do I pass this context when using formik's validationSchema.