-
Notifications
You must be signed in to change notification settings - Fork 266
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rejects schemas where $ref refers to $id or $anchor #823
Labels
Comments
Browsing the code findSection() looks suspicious: it seems ids/anchors would have to be handled somewhere near there, rather than just assuming the hash fragment is a JSON pointer. |
We are using vscode-json-langaugeservice to resolve schemas. This has been fixed upstream, we probably need to adjust to this later version. |
remcohaszing
added a commit
to remcohaszing/schemastore
that referenced
this issue
Mar 27, 2023
The schemas now use an intermediate schema to resolve the hash using a ref. For more info, see: microsoft/vscode-json-languageservice#123 redhat-developer/yaml-language-server#585 redhat-developer/yaml-language-server#637 redhat-developer/yaml-language-server#823
remcohaszing
added a commit
to remcohaszing/schemastore
that referenced
this issue
Mar 27, 2023
The schemas now use an intermediate schema to resolve the hash using a ref. For more info, see: microsoft/vscode-json-languageservice#123 redhat-developer/yaml-language-server#585 redhat-developer/yaml-language-server#637 redhat-developer/yaml-language-server#823
4 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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:
Example valid doc:
Expected Behavior
Schema loads and document validates correctly.
The draft-07 spec says:
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
fail.schema.json
andfail.yaml
fail.yaml
in an editor talking to yaml-language-serverEnvironment
The text was updated successfully, but these errors were encountered: