vscode-yaml
vscode-yaml copied to clipboard
Default value from subschema used for string autocompletion elsewhere
Describe the bug
The default value of a property in one subschema is unintentionally used as default value in string item property.
I have a json schema like so:
{
"$defs": {
"Foo": {
"properties": {
"foo": {
"type": "string",
"default": "hello"
}
},
"type": "object"
}
},
"additionalProperties": false,
"properties": {
"foos": {
"items": {
"$ref": "#/$defs/Foo"
},
"type": "array"
},
"bars": {
"items": {
"type": "string"
},
"type": "array"
}
},
"required": [
"bars",
"foos"
],
"type": "object"
}
The completions for this schema is shown like this:
correctly showing the default value for foo but also showing
${1} for bar. When hitting enter, the default value is applied to the bar element as well:
Expected Behavior
I expect the default value to only show up for the property it is defined for.
Current Behavior
Default value shows up unexpectedly in wrong place.
Steps to Reproduce
- Copy the schema
- ctrl + space in new file which uses the schema
- hit enter
Environment
- [ ] Windows
- [ ] Mac
- [x] Linux
- [ ] other (please specify)