redhat-developer / redhat-developer/vscode-yaml
Schema error when there are both local (path) and remote (URI) schemas that match a file
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
- Add a YAML file (e.g.
component.yaml) with some valid content - Modify VSCode settings to add local schema that matches the file.
- The file validates against the schema.
- Modify VSCode settings to add URI-based schema path that matches the file. The URI might be
http://orfile:// - 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) - 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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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