redhat-developer / redhat-developer/vscode-yaml

Schema error when there are both local (path) and remote (URI) schemas that match a file

Open
#523 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Describe the bug

VSCode validates YAML files against configured schemas.

Schemas might be local or remote. //Schema paths with or without URI schema

There might be multiple schemas that match a given file.

When there is any number of local schemas that matches a file, the validation works.

When there is a any number of URI-referenced schemas that matches a file, the validation works.

When there is a local schema that matches a file plus any number of URI-referenced schemas, the validation stops working.

Expected Behavior

I expect the validation behavior to be consustent.

Current Behavior

Problems loading reference 'a:/schema.json': Unable to load schema from 'a:/schema.json': No content.YAML(768)

Steps to Reproduce

  1. Add a YAML file (e.g. component.yaml) with some valid content
  2. Modify VSCode settings to add local schema that matches the file.
  3. The file validates against the schema.
  4. Modify VSCode settings to add URI-based schema path that matches the file. The URI might be http:// or file://
  5. The file immediately stops validating with the following error: Problems loading reference 'a:/schema.json': Unable to load schema from 'a:/schema.json': No content.YAML(768)
  6. This error is only thrown for local schemas when there are any other URI-based schemas matching the same file. Additional local schemas do not seem to trigger the issue.
    "yaml.schemas": {
        "A:\\component_spec.json_schema.json": "component.yaml",
        "https://raw.githubusercontent.com/Cloud-Pipelines/component_spec_schema/master/component_spec.json_schema.json": "component.yaml",
        "file:///A:\\component_spec.json_schema.json": "component.yaml",
    }

Environment

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

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

The issue names no files, tests, or entry points. First reproduce the Windows case with local path and URI schemas, then trace schema loading and URI resolution to identify why the local schema reports no content. Done means matching files validate consistently with local schemas, URI schemas, and both together, without the reported error.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
tooling
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.