yaml-language-server
yaml-language-server copied to clipboard
Missing required property value reported as type error
Describe the bug
A missing required property is reported as a type error.
Incorrect type. Expected "string".
This is likely due to the YAML to JSON conversion which inserts a null where the yaml has no value.
Expected Behavior
The error should be reported as a missing value.
Current Behavior
The error is reported as at type error.
Steps to Reproduce
- Copy and open this blueprint in vscode where the yaml-language-server is installed.
- Add this yaml-language-server schema declaration: https://raw.githubusercontent.com/Cloud-Schematics/vscode-blueprint-schema/master/blueprint_schema.json
- Remove the value of the
nameof one of the modules.
Environment
- [x] Windows
- [x] Mac
- [x] Linux
- [ ] other (please specify)
I do not think the current behaviour is incorrect in this case. In YAML, empty values are recognized as null . So the parser basically reports the value as null, and the schema validator reports that the schema is expecting a string.
This can probably be resolved on the referenced schema by defining the type of the property as name : { "type": ["string", "null"] }