- 
                Notifications
    
You must be signed in to change notification settings  - Fork 306
 
Open
Labels
Description
Describe the bug
When processing schemas, the server seems to assume that the hash part a $ref is always a JSON pointer.
Therefore the following schema can't be loaded, with an error $ref 'A' in 'file:///...' can not be resolved.
Schema:
{
  "$schema": "http://json-schema.org/draft-07/schema",
  "type": "object",
  "properties": {
    "A": { "$id": "#A", "type": "string" },
    "B": { "$ref": "#A" }
  }
}
Example valid doc:
# yaml-language-server: $schema=fail.schema.json
A: foo
B: bar
Expected Behavior
Schema loads and document validates correctly.
The draft-07 spec says:
Schemas can be identified by any URI that has been given to them, including a JSON Pointer or their URI given directly by "$id".
and goes on to give a very similar example.
Current Behavior
Language server shows the error: $ref 'A' in 'file:///...' can not be resolved.
For the 2019 JSON-schema spec, we should use  "$anchor": "A" instead of "$id": "#A"`. This also doesn't work.
Using a JSON-pointer link "$ref": "/properties/A" does work.
Steps to Reproduce
- Save the files above as 
fail.schema.jsonandfail.yaml - Open 
fail.yamlin an editor talking to yaml-language-server - See spurious diagnostics on the first line of content
 
Environment
- Windows
 - Mac
 - Linux
 - other (please specify)
 
amimasEmilyGraceSeville7cf