title: How do I use the `If` `then` `else` condition in json schema?
body: <p>A relatively new addition to JSON Schema (draft-07) adds the if, then and else keywords. I cannot work out how to use these new key words correctly. Here is my JSON Schema so far:</p>
  
  <pre><code>{
    "type": "object",
    "properties": {
      "foo": {
        "type": "string"
      },
      "bar": {
        "type": "string"
      }
    },
    "if": {
      "properties": {
        "foo": {
          "enum": [
            "bar"
          ]
        }
      }
    },
    "then": {
      "required": [
        "bar"
      ]
    }
  }
  </code></pre>
  
  <p>If the "foo" property equals "bar", Then the "bar" property is required. This works as expected.</p>
  
  <p>However, if the "foo" property does not exist or input is empty then I don't want anything. how to acheive this?</p>
  
  <pre><code>empty input {}.
  </code></pre>
  
  <p>Found Errors:<br>
          Required properties are missing from object: bar.
      Schema path: #/then/required</p>
  
  <p>I use online validation tool:</p>
  
  <p><a href="https://www.jsonschemavalidator.net/" rel="noreferrer">https://www.jsonschemavalidator.net/</a></p>