title: validate either object with Yup
body: <p>I'm trying to validate an object, which is an union type of two objects. It's like two different subforms where you can fill either of them or both, but it shouldn't be empty</p>
  <p>here's a simplified example:</p>
  <pre><code>// it's valid if it has all of the fields of the first sub-form
  const valid1 = {
    a: &quot;a&quot;,
    b: &quot;b&quot;,
    c: &quot;c&quot;
  };
  
  // it's valid if it has all of the fields of the second sub-form
  const valid2 = {
    d: &quot;a&quot;,
    e: &quot;b&quot;,
    f: &quot;c&quot;
  };
  
  // it's valid if it has all of the fields of both sub-forms
  const valid3 = {
    ...valid1,
    ...valid2
  };
  
  // it's invalid if it's empty or has only one sub-form field
  
  const invalid1 = {
    ...valid1,
    e: &quot;b&quot;
  };
  
  const invalid2 = {
    ...valid2,
    a: &quot;a&quot;
  };
  
  const invalid3 = {};
  
  </code></pre>
  <p><a href="https://codesandbox.io/s/yup-formik-c16lyg?file=/src/index.js:1321-1433" rel="nofollow noreferrer">here's a sandbox setup</a> with all of my attempts so far</p>