Question: Is it possible to validate a field only when it exists?

I'm going to create an application. A field(email) may / may not display on step 2, it depends on the step 1's selected option. The problem is that I can't put `email: Yup.string().Required()`, it causes that the validation run all the time even the field is not displayed.

Answer: 
I saw another related answer here, maybe this is a valid solution too?

<https://github.com/jquense/yup/issues/1114>

Copying code from there:

```
const schema = yup.object({
    phone: yup.string().when('$exist', {
        is: exist => exist,
        then: yup.string().required(),
        otherwise: yup.string()
    })
})

```
You can use Cyclic Dependency for make this.

Example:

```
const YOUR_SCHEMA_NAME = yup.object().shape({
    email: yup.string().when('email', {
        is: (exists) => !!exists,
        then: yup.string().email(),
        otherwise: yup.string(),
    }),
}, [['email', 'email']]);

```