title: JSON Schema not validating required attributes
body: <p>Here is the criteria: the individual region object can co-exist withing the array along with ONLY asia/europe/austrlia (either one region at a time from asia/europe/austrlia).</p>
  
  <p>In addition to this every region object can have few required attributes and nested one.</p>
  
  <p>The issue is the schema validator is not complaining about the required attribute (i.e. width attribute from dimension object)</p>
  
  <p>Here is the JSON Schema</p>
  
  <pre><code>{
    "type": "object",
    "$schema": "http://json-schema.org/draft-07/schema#",
    "properties": {
      "stat_data": {
        "type": "array",
        "if": {
          "contains": {
            "type": "object",
            "properties": {
              "region": {
                "type": "string",
                "enum": [
                  "europe"
                ]
              }
            }
          }
        },
        "then": {
          "not": {
            "contains": {
              "type": "object",
              "properties": {
                "region": {
                  "type": "string",
                  "enum": [
                    "asia",
                    "australia"
                  ]
                }
              }
            }
          }
        },
        "else": {
          "if": {
            "contains": {
              "type": "object",
              "properties": {
                "region": {
                  "type": "string",
                  "enum": [
                    "asia"
                  ]
                }
              }
            }
          },
          "then": {
            "not": {
              "contains": {
                "type": "object",
                "properties": {
                  "region": {
                    "type": "string",
                    "enum": [
                      "europe",
                      "australia"
                    ]
                  }
                }
              }
            }
          },
          "else": {
            "if": {
              "contains": {
                "type": "object",
                "properties": {
                  "region": {
                    "type": "string",
                    "enum": [
                      "australia"
                    ]
                  }
                }
              }
            },
            "then": {
              "not": {
                "contains": {
                  "type": "object",
                  "properties": {
                    "region": {
                      "type": "string",
                      "enum": [
                        "europe",
                        "asia"
                      ]
                    }
                  }
                }
              }
            },
            "else": {}
          }
        },
        "items": {
          "type": "object",
          "properties": {
            "details": {
              "$ref": "#/definitions/dimension"
            },
            "population": {
              "$ref": "#/definitions/details"
            },
            "dimension": {
              "$ref": "#/definitions/population"
            },
            "region": {
              "enum": [
                "asia",
                "europe",
                "australia",
                "some-pencil-region",
                "some-oil-pastels-region"
              ]
            }
          }
        }
      }
    },
    "definitions": {
      "dimension": {
        "type": "object",
        "required": [
          "width"
        ],
        "properties": {
          "height": {
            "type": "integer"
          },
          "width": {
            "type": "integer"
          }
        }
      },
      "details": {
        "type": "object",
        "properties": {
          "brand": {
            "type": "string"
          },
          "year": {
            "type": "integer"
          }
        }
      },
      "population": {
        "type": "object",
        "properties": {
          "change": {
            "type": "integer"
          },
          "year": {
            "type": "integer"
          }
        }
      }
    }
  }
  </code></pre>
  
  <p>and the JSON</p>
  
  <pre><code>{
    "stat_data": [
      {
        "region": "some-pencil-region",
        "details": {
          "brand": "Camlin",
          "year": 2019
        }
      },
      {
        "region": "some-oil-pastels-region",
        "height": 30
      },
      {
        "region": "asia",
        "population": {
          "year": 2018,
          "change": 2
        }
      }
    ]
  }
  </code></pre>
  
  <p>You can check at _https://jsonschema.dev/ by copying schema and json in the editor</p>