Built in YAML Schemas are not working
See original GitHub issueDescribe the bug
Based on the discovery in https://github.com/redhat-developer/vscode-yaml/issues/392#issuecomment-728380295 it looks like YAML Schemas aren’t validating correctly.
Expected Behavior
Flow-map: !!map { Clark: Evans, Ingy: döt Net, Oren: Ben-Kiki }
should validate without any errors
Current Behavior
Flow-map: !!map { Clark: Evans, Ingy: döt Net, Oren: Ben-Kiki }
has unknown tag tag:yaml.org,2002:map error
Steps to Reproduce
- Paste
Flow-map: !!map { Clark: Evans, Ingy: döt Net, Oren: Ben-Kiki }
into document and observe the errors that occur
Environment
- Windows
- Mac
- Linux
- other (please specify)
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
How to configure YAML schema to make editing files easier
Discover the benefits of providing a YAML schema and how to make it consumable for all of your users, making it easier to...
Read more >Don't use JSON schema when edition YAML file in Visual ...
How to turn this off and simply use YAML syntax highlighting without specific JSON schema? In the schema selector there is not "No...
Read more >YAML Schemas: Validating Data without Writing Code
The answer is yes, but the correct choice depends on the language you're working with. Some languages have built-in types that easily map...
Read more >YAML - Visual Studio Marketplace
Provides comprehensive YAML Language support to Visual Studio Code, via the yaml-language-server, with built-in Kubernetes syntax support.
Read more >How to create your own auto-completion for JSON and YAML ...
While JSON Schema is designed to work with JSON files, it can be used ... JSON Schema Store is Open source, so why...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Fixed with the new parser
The issue comes from here: https://github.com/redhat-developer/yaml-language-server/blob/master/src/languageservice/utils/parseUtils.ts#L101
Because the schema is passed into the ast library, the default is not used: https://github.com/redhat-developer/yaml-ast-parser/blob/master/src/loader.ts#L171
I think you’d have to extend the default schema with custom tags, rather than creating one from scratch here: https://github.com/redhat-developer/yaml-language-server/blob/master/src/languageservice/utils/parseUtils.ts#L70-L77
I did this in a fork and it works. I’m just not very typescript savy.