vscode-yaml
vscode-yaml copied to clipboard
UnhandledPromiseRejectionWarning: TypeError: Cannot create property 'url' on string 'string'
Describe the bug
When I am editing a YAML file with my custom schema, it validates properly and gives me an error highlight once, but when I fix the error, the highlight never goes away. When I look at the message log, I see a traceback:
[Error - 9:17:30 PM] (node:96798) UnhandledPromiseRejectionWarning: TypeError: Cannot create property 'url' on string 'string'
at _validateObjectNode (/Users/pprescod/.vscode/extensions/redhat.vscode-yaml-0.22.0/node_modules/yaml-language-server/out/server/src/languageservice/parser/jsonParser07.js:983:44)
at validate (/Users/pprescod/.vscode/extensions/redhat.vscode-yaml-0.22.0/node_modules/yaml-language-server/out/server/src/languageservice/parser/jsonParser07.js:438:13)
at _validateArrayNode (/Users/pprescod/.vscode/extensions/redhat.vscode-yaml-0.22.0/node_modules/yaml-language-server/out/server/src/languageservice/parser/jsonParser07.js:843:21)
at validate (/Users/pprescod/.vscode/extensions/redhat.vscode-yaml-0.22.0/node_modules/yaml-language-server/out/server/src/languageservice/parser/jsonParser07.js:441:13)
at SingleYAMLDocument.validate (/Users/pprescod/.vscode/extensions/redhat.vscode-yaml-0.22.0/node_modules/yaml-language-server/out/server/src/languageservice/parser/jsonParser07.js:398:13)
at getDiagnostics (/Users/pprescod/.vscode/extensions/redhat.vscode-yaml-0.22.0/node_modules/vscode-json-languageservice/lib/umd/services/jsonValidation.js:69:59)
at /Users/pprescod/.vscode/extensions/redhat.vscode-yaml-0.22.0/node_modules/vscode-json-languageservice/lib/umd/services/jsonValidation.js:106:24
jsonParser07.js line 983 is
propertySchema.url = (_a = schema.url) !== null && _a !== void 0 ? _a : originalSchema.url;
Expected Behavior
Errors should change as I edit my file. No tracebacks.
Steps to Reproduce
- Create this Schema file:
{
"$id": "https://github.com/SFDO-Tooling/Snowfakery/schema/snowfakery_recipe.schema.json",
"description": "Snowfakery recipe.",
"type": "array",
"minItems": 1
}
- Create a related Schema
yaml-language-server: $schema=file:snowfakery_recipe.schema.json
- object: fooboffsef fields: foo: bar
-
Change the file URL to be appropriate for your setup.
-
Try changing
- object: fooboffsefto- objectxxx: fooboffsefto get a validation error. -
Change it back.
Environment
- [ ] Windows
- [ X] Mac
- [ ] Linux
- [ ] other (please specify)