Repository: vscode
Issue: [json] support references in schema associations
Labels: feature-request,json


Issue Type: <b>Bug</b>

## Steps to repro

in `settings.json...`

```json
"json.schemas": [

        {
            "url": "http://localhost:8080/my.schema.json#/$defs/inner_schema",
            "fileMatch": [
                "/**/tests/testfile.json"
            ]
        }
]
```

in `./tests/testfile.json`

```json
{
	"name": "example"
}
```

in `./schemata/my.schema.json`

```json
{
    "$schema": "https://json-schema.org/draft-07/schema#",
    "$id": "https://example.com/schemata/my.schema.json#",
    "type": "boolean",
    "default": true,
    "$defs": {
    	"inner_schema": {
    		"type": "object",
    		"properties": {
    			"name": {
    				"type": "string"
    			}
    		},
            "additionalProperties": false
    	}
    }
}

```

in root folder `package.json` I'm using a simple web server to serve the local schemas.


```json
{
  "dependencies": {
    "http-server": "^13.0.1"
  },
  "scripts": {
    "dev": "http-server ./schemata -p 8080",
    "start": "npm run dev&"
  }
}
```

To serve the files in ./schemata locally...

`$ npm start`


Disable/Enable the JSON>Format setting to force the schema to be pulled.

## Incorrect Behaviour in Latest Version

Version: 1.63.2
Commit: 899d46d82c4c95423fb7e10e68eba52050e30ba3
Date: 2021-12-15T09:37:28.172Z (5 days ago)
Electron: 13.5.2
Chromium: 91.0.4472.164
Node.js: 14.16.0
V8: 9.1.269.39-electron.0
OS: Darwin x64 20.6.0

1. change the "name" property to something else. Observe that intellisense DOES NOT flag an error.

###Logging from http-server

[2021-12-20T21:14:41.762Z]  "GET /my.schema.json" "undefined"
(node:16871) [DEP0066] DeprecationWarning: OutgoingMessage.prototype._headers is deprecated
(Use `node --trace-deprecation ...` to show where the warning was created)
[2021-12-20T21:14:42.083Z]  "GET /my.schema.json" "undefined"

## Correct Behaviour in October Version

Version: 1.62.3
Commit: ccbaa2d27e38e5afa3e5c21c1c7bef4657064247
Date: 2021-11-17T07:59:13.865Z (1 mo ago)
Electron: 13.5.2
Chrome: 91.0.4472.164
Node.js: 14.16.0
V8: 9.1.269.39-electron.0
OS: Darwin x64 20.6.0

1. change the "name" property to something else (I deleted the a). Observe that intellisense DOES flag an error "Property nme is not allowed" and squiggle underlines the property.


###Logging from http-server

[2021-12-20T21:08:14.282Z]  "GET /my.schema.json" "undefined"
(node:16271) [DEP0066] DeprecationWarning: OutgoingMessage.prototype._headers is deprecated
(Use `node --trace-deprecation ...` to show where the warning was created)
[2021-12-20T21:08:14.699Z]  "GET /my.schema.json" "undefined"





VS Code version: Code 1.63.2 (899d46d82c4c95423fb7e10e68eba52050e30ba3, 2021-12-15T09:37:28.172Z)
OS version: Darwin x64 20.6.0
Restricted Mode: No

<details>
<summary>System Info</summary>

|Item|Value|
|---|---|
|CPUs|Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz (16 x 2300)|
|GPU Status|2d_canvas: enabled<br>gpu_compositing: enabled<br>metal: disabled_off<br>multiple_raster_threads: enabled_on<br>oop_rasterization: enabled<br>opengl: enabled_on<br>rasterization: enabled<br>skia_renderer: disabled_off_ok<br>video_decode: enabled<br>webgl: enabled<br>webgl2: enabled|
|Load (avg)|2, 3, 3|
|Memory (System)|16.00GB (0.02GB free)|
|Process Argv|--crash-reporter-id 2ef050c8-e5c1-40dc-bd2f-e23017bbfd9e|
|Screen Reader|no|
|VM|0%|
</details><details><summary>Extensions (16)</summary>

Extension|Author (truncated)|Version
---|---|---
vscode-openapi|42C|4.7.1
doxdocgen|csc|1.3.2
vscode-pull-request-github|Git|0.34.1
better-cpp-syntax|jef|1.15.10
remote-containers|ms-|0.209.6
remote-ssh|ms-|0.70.0
remote-ssh-edit|ms-|0.70.0
remote-wsl|ms-|0.63.13
cmake-tools|ms-|1.9.2
cpptools|ms-|1.7.1
cpptools-extension-pack|ms-|1.1.0
vsliveshare|ms-|1.0.5200
vsliveshare-audio|ms-|0.1.91
vscode-yaml|red|1.2.2
cmake|twx|0.0.17
debug|web|0.25.1

(1 theme extensions excluded)

</details><details>
<summary>A/B Experiments</summary>

```
vsliv368cf:30146710
vsreu685:30147344
python383cf:30185419
vspor879:30202332
vspor708:30202333
vspor363:30204092
pythontb:30283811
pythonptprofiler:30281270
vshan820:30294714
vstes263:30335439
vscoreces:30384385
pythondataviewer:30285071
vscod805cf:30301675
pythonvspyt200:30340761
binariesv615:30325510
bridge0708:30335490
bridge0723:30353136
vsaa593:30376534
pythonvs932:30410667
vscop804:30404766
vscop940:30404999
vsrem710cf:30416617
vscexrecpromp3t1:30407762

```

</details>

<!-- generated by issue reporter -->