title: JSON Schema if/then require nested object
body: <p>I have a JSON:</p>
  
  <pre><code>{
      "i0": {
          "j0": {
              "a0": true
          }
      },
      "i1": {
          "j1": {
              "a1": "stuff"
          }
      }
  }
  </code></pre>
  
  <p>I want a validation:
   If <code>a0</code> is true, <code>a1</code> should be required.</p>
  
  <p>My schema is currently:</p>
  
  <pre><code>{
      "$schema": "http://json-schema.org/draft-07/schema",
      "id": "id",
      "type": "object",
      "required": [
          "i0",
          "i1"
      ],
      "allOf": [
          {
              "if": {
                  "properties": {
                      "i0": {
                          "j0": {
                              "a0": true
                          }
                      }
                  }
              },
              "then": {
                  "properties": {
                      "i1": {
                          "j1": {
                              "required": [
                                  "a1"
                              ]
                          }
                      }
                  }
              }
          }
      ]
  }
  </code></pre>
  
  <p>This conditional seems to not actually be run. Alternatively, I have have seen gotten a very similar conditional to work if I try to put the <code>required</code> on the same level as the value I am checking. As in:</p>
  
  <pre><code>"allOf": [
      {
          "if": {
              "a0": true
          },
          "then": {
              "required": [
                  "a1"
              ]
          }
      }
  ]
  </code></pre>
  
  <p>but this would require <code>a1</code> to be under <code>j0</code> along with <code>a1</code>.
  How do I require an object under <code>j1</code> based on a value under <code>j0</code>?</p>