Create an Optional Dynamic Validation Schema based on a Value with the Yup
In this lesson we'll show how to setup a nested validation structure using the
yup library. We'll then use the
yup.lazy method to evaluate the
value at runtime and adjust our validation schema. We'll make our nested validation optional only if our
optionalObject actually exists.