title: Condition Validation using Yup for array dynamically and some of array children depends on other children of same array
body: <p>I need to validate an array's child which depends upon another child of the same array, using yup I need to put required for the child if its parent-dependent object has the answer matched for it to be required.</p>
  <pre><code> [
        { question: 'ARRIVAL', answer: 'AIR' },
        { question: 'DEPORT', answer: 'SEA' },
        { question: 'AIR_ARRIVAL_TIME', answer: '' },
        { question: 'AIR_ARRIVAL_PLACE', answer: '' },
        { question: 'SEA_ARRIVAL_TIME', answer: '' },
        { question: 'SEA_ARRIVAL_PLACE', answer: '' },
        { question: 'AIR_DEPORT_TIME', answer: '' },
        { question: 'AIR_DEPORT_PLACE', answer: '' },
        { question: 'SEA_DEPORT_TIME', answer: '' },
        { question: 'SEA_DEPORT_PLACE', answer: '' },
      ];
  </code></pre>
  <p>I need to validate it using Yup. And index of the object is random.</p>
  <p>When</p>
  <pre><code>question:'ARRIVAL'
  answer:'AIR'
  </code></pre>
  <p>then</p>
  <pre><code>question: 'AIR_ARRIVAL_TIME', answer: ''  &lt;--Required
  question: 'AIR_ARRIVAL_PLACE', answer: ''  &lt;--Required
      
  question: 'SEA_ARRIVAL_TIME', answer: ''  &lt;---Not Required
  question: 'AIR_ARRIVAL_PLACE', answer: ''  &lt;---Not Required
  </code></pre>
  <p>When</p>
  <pre><code>question:'ARRIVAL'
  answer:'SEA'
  </code></pre>
  <p>then</p>
  <pre><code>question: 'AIR_ARRIVAL_TIME', answer: ''  &lt;--Not Required
  question: 'AIR_ARRIVAL_PLACE', answer: ''  &lt;--Not Required
  
  question: 'SEA_ARRIVAL_TIME', answer: ''  &lt;---Required
  question: 'SEA_ARRIVAL_PLACE', answer: ''  &lt;---Required
  </code></pre>
  <p>When</p>
  <pre><code>question:'DEPORT'
  answer:'SEA'
  </code></pre>
  <p>then</p>
  <pre><code>question: 'AIR_DEPORT_TIME', answer: ''  &lt;--Not Required
  question: 'AIR_DEPORT_PLACE', answer: ''  &lt;--Not Required
  
  question: 'SEA_DEPORT_TIME', answer: ''  &lt;---Required
  question: 'SEA_DEPORT_PLACE', answer: ''  &lt;---Required
  </code></pre>
  <p>When</p>
  <pre><code>question:'DEPORT'
  answer:'AIR'
  </code></pre>
  <p>then</p>
  <pre><code>question: 'AIR_DEPORT_TIME', answer: ''  &lt;--Required
  question: 'AIR_DEPORT_PLACE', answer: ''  &lt;--Required
  
  question: 'SEA_DEPORT_TIME', answer: ''  &lt;--- Not Required
  question: 'SEA_DEPORT_PLACE', answer: ''  &lt;---Not Required
  </code></pre>
  <p>//==========================
  Also If</p>
  <pre><code>question: 'AIR_DEPORT_TIME', answer: ''
  question: 'AIR_DEPORT_PLACE', answer: ''
  </code></pre>
  <p>exists But</p>
  <pre><code>question:'ARRIVAL'
  answer:'AIR'
  </code></pre>
  <p>is not there then</p>
  <pre><code>question: 'AIR_DEPORT_TIME', answer: '' &lt;--required
  question: 'AIR_DEPORT_PLACE', answer: '' &lt;---required
  </code></pre>