title: JSON Schema conditional: field is required based on value of another field
body: <p>I'm trying to implement this condition: field is required based on value of another field i.e. if request with "index":"true" exists then "id" element required: true.</p>
  
  <p>Here is a sample schema:</p>
  
  <pre><code>{
    "$schema": "http://json-schema.org/draft-04/schema#",
    "title": "test title",
    "type": "object",
    "properties": {
      "data": {
        "type": "array",
        "items": {
          "$ref": "#/definitions/Item"
        },
        "minItems": 0
      }
    },
    "required": [
      "data"
    ],
    "definitions": {
      "Item": {
        "type": "object",
        "properties": {
          "id": {
            "type": [
              "integer",
              "string"
            ]
          },
          "type": {
            "type": "string"
          }
        }
      }
    }
  }
  </code></pre>
  
  <p>How it can be implemented? </p>
  
  <p>Any pointers will be helpful.</p>