microsoft/vscode

[json] allow $ref in confiuguration schemas

Opened this issue · 1 comments

Issue Type: Bug

Steps to Reproduce:

  1. Create a "definitions" member for a JSON schema, and put a subschema there.
  2. Attempt to refer to this subschema in settings.json.

I'm in a folder called "json" with a subfolder called "schemas" with the schemas, and a subfolder called ".vscode" for the settings.json.

Here is the definitions schema I am using:

{
  "$schema": "https://json-schema.org/draft/2019-09/schema",
  "type": "object",
  "definitions": {
    "items": {
      "type": "array",
      "items": {
        "$ref": "items.json#"
      },
      "minItems": 1
    }
  }
}

If I just make items.json into an array and use "url": "./schemas/items.json" works fine, but that isn't very conducive to my current work case.

 

So I tried using this:

"schema": {
	"type": "array",
	"items": {
	  "$ref": "./schemas/items.json"
	}
  }

Got this error: "Problems loading reference 'vscode://schemas/custom/schemas/items.json': Request vscode/content failed with message: cannot open vscode://schemas/custom/schemas/items.json. Detail: resource is not available".

 

Tried using this:
"url": "file:///C:/Users/BLATANT-DOXX-RISK/Source/Repos/json/schemas/types.json#/definitions/items"

And it just used types.json, ignored the definitions part, and looked for nothing but a blank object.

 

Finally, I tried using this: "url": "./schemas/types.json#/definitions/items".

Got this error: "File not found (c:\Users\BLATANT-DOXX-RISK\Source\Repos\json\schemas\types.json#\definitions\items))".

 

@aeschli came up a lot when looking through Github issues.


VS Code version: Code 1.38.1 (b37e54c, 2019-09-11T13:35:15.005Z)
OS version: Windows_NT x64 10.0.18362

System Info
Item Value
CPUs Intel(R) Core(TM) i7-6700HQ CPU @ 2.60GHz (8 x 2592)
GPU Status 2d_canvas: enabled
flash_3d: enabled
flash_stage3d: enabled
flash_stage3d_baseline: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
native_gpu_memory_buffers: disabled_software
oop_rasterization: disabled_off
protected_video_decode: unavailable_off
rasterization: enabled
skia_deferred_display_list: disabled_off
skia_renderer: disabled_off
surface_synchronization: enabled_on
video_decode: enabled
viz_display_compositor: disabled_off
webgl: enabled
webgl2: enabled
Load (avg) undefined
Memory (System) 15.80GB (7.40GB free)
Process Argv C:\Users\ZACH-GAMING\Source\Repos\Cataclysm-DDA-Testing\data\json
Screen Reader no
VM 0%
Extensions: none

We don't support refering to subschemas (#/../) from settings.json. You can only do that out of schema files.