redhat-developer / redhat-developer/vscode-yaml

"Unable to load schema" when using `$id`

Open
#922 1 comment 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
TypeScript
Stars
829
Forks
260
Avg merge
5h 43m
Merged PRs (30d)
1

Description

Describe the bug

Problems loading reference 'http://emily.json/#a': Unable to load schema from 'http://emily.json/': Request vscode/content failed unexpectedly without providing any details. error.

when using $ref in:

{
    "$id": "http://emily.json",
    "$schema": "http://json-schema.org/draft-07/schema",
    "type": "object",
    "properties": {
        "first": {
            "$id": "#a",
            "type": "boolean"
        },
        "second": {
            "$ref": "http://emily.json#a"
        }
    }
}

Expected Behavior

Successful reference resolution.

Current Behavior

Failed resolution.

Steps to Reproduce

  1. Create schema.json with:
{
    "$id": "http://emily.json",
    "$schema": "http://json-schema.org/draft-07/schema",
    "type": "object",
    "properties": {
        "first": {
            "$id": "#a",
            "type": "boolean"
        },
        "second": {
            "$ref": "http://emily.json#a"
        }
    }
}

content.

  1. Create test.yaml with:
first: true

content.

  1. Create .vscode/settings.json with:
{
    "yaml.schemas": {
        "schema.json": "test.yaml"
    }
}

content.

  1. Open test.yaml and obtain mentioned error

Environment

  • Windows
  • Mac
  • Linux
  • other (please specify)

Related issue

https://github.com/json-schema-org/json-schema-spec/issues/1398

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the failure with schema.json, test.yaml, and .vscode/settings.json, then read the related json-schema-spec issue 1398 for the expected $id and $ref behavior. Trace schema loading and reference resolution from opening test.yaml; done means the reference resolves without the reported error.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript, vscode
Domain
devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.