vscode-yaml
                                
                                 vscode-yaml copied to clipboard
                                
                                    vscode-yaml copied to clipboard
                            
                            
                            
                        Schema error when there are both local (path) and remote (URI) schemas that match a file
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
- [x] Windows
- [ ] Mac
- [ ] Linux
- [ ] other (please specify)
Hmm, I can't reproduce on linux with:
"yaml.schemas": {
        "/home/jpinkney/Documents/test/foo/schema.json": "test.yaml",
        "./test/foo/schema.json": "test.yaml",
        "file:///home/jpinkney/Documents/test/foo/schema.json": "test.yaml",
},
I wonder if it might be a windows issue. When I get a chance I'll get out my windows box and check it again
I think there might be some issue with how the extension handles the paths on Windows (probably due to changing those paths from their original strings). It's still surprising that the presence of other URIs affects the behavior.