redhat-developer / redhat-developer/vscode-yaml
UnhandledPromiseRejectionWarning: TypeError: Cannot create property 'url' on string 'string'
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 829
- Forks
- 260
- Avg merge
- 5h 43m
- Merged PRs (30d)
- 1
Description
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)
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
Reproduce the YAML-schema edit cycle and trace validation through jsonParser07.js, especially _validateObjectNode, _validateArrayNode, and SingleYAMLDocument.validate around the reported line. Confirm that changing the invalid property back no longer produces an UnhandledPromiseRejectionWarning and that diagnostics update correctly without a stale highlight.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript, vscode, yaml
- Domain
- devtools, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 42/100