title: JSON Schema regarding use of $ref
body: <p>I understand that $ref takes a URI to a json schema to use but where does $ref : "#" point to?
  Does it just mean use the current schema for this block level? Or does it mean to use the root level schema defined in the root level id?
  Thanks </p>
  
  <p>EDIT:
  So if I have:</p>
  
  <pre><code>"items": {
          "anyOf": [
              { "$ref": "#" },
              { "$ref": "#/definitions/schemaArray" }
          ],
          "default": {}
      }
  </code></pre>
  
  <p>Because it lacks an id field it will attempt to validate the instance items with the root schema first and then if that fails try to validate it with the schemaArray schema defined in the definitions schema, right?</p>
  
  <p>So if I change it to:</p>
  
  <pre><code> "items": {
              "id" : "#/items",
              "anyOf": [
                  { "$ref": "#" },
                  { "$ref": "#/definitions/schemaArray" }
              ],
              "default": {}
          }
  </code></pre>
  
  <p>Then the first subschema in anyOf array will point to the items schema itself?</p>
  
  <p>EDIT #2: Okay so if I had:</p>
  
  <pre><code> "items": {
          "id" : "itemSchema",
          "anyOf": [
              { "$ref": "#" },
              { "$ref": "#/definitions/schemaArray" }
          ],
          "default": {}
      }
  </code></pre>
  
  <p>and</p>
  
  <pre><code>"stringArray": {
          "type": "array",
          "items": { "$ref" : "itemSchema" },
          "minItems": 1,
          "uniqueItems": true
      }
  </code></pre>
  
  <p>"stringArray"'s "items" field would be validated against the above "itemsSchema"?</p>
  
  <p>Also does the second $ref in 'anyOf' work by going to the root and then traversing down the path till it hits that schema?
  Thanks! </p>