redhat-developer / redhat-developer/vscode-yaml
default value dollar sign is not completely escaped
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 829
- Forks
- 260
- Avg merge
- 5h 43m
- Merged PRs (30d)
- 1
Description
Describe the bug
I think this is a follow up from https://github.com/redhat-developer/vscode-yaml/issues/258.
I have a schema with an default value that starts with an dollar sign. These values are in the root properties and in children properties.
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"foo": {
"type": "object",
"properties": {
"bar": {
"type": "string",
"default": "$TEMP"
}
},
"required": ["bar"]
},
"baz": {
"type": "string",
"default": "$TEMP"
}
},
"required": ["foo", "baz"]
}
When I now add this schema to an file and try to create this file via CTRL+Space and Tab, I get the following preview and YAML.
foo:
bar:
baz: $TEMP
As you see from the yaml and the image, the $TEMP of baz gets escaped and will be correctly displayed in the yaml.
However, my bar value will not be displayed correctly.
It looks like the $ sign is not correctly escaped.
As a workaround, I could write "default": "\\$TEMP" in my schema, however this is not the perfect way, because baz is working correctly.
Expected Behavior
I expect that all my $ signs in the json schema will be escaped and not only the ones from the first properties.
Current Behavior
Currently only the first layer of properties will have escaped dollar signs, nested properties will not be escaped
Steps to Reproduce
- add the schema from above to VSCode
- Create a new file and use the above schema
- press CTRL+Space and tab to see the generated result
Environment
- Windows
- 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 issue with the schema in the report by invoking VS Code completion with Ctrl+Space and Tab. Start at the schema-driven completion path and trace how dollar signs are escaped for nested properties such as foo.bar versus the root-level baz. Done means generated YAML preserves the $TEMP default at every nesting level.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100