-
Notifications
You must be signed in to change notification settings - Fork 223
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Object autocompletion in arrays with custom indentation produces invalid output #432
Closed
1 of 4 tasks
Comments
@TedDriggs Can you share JSON Schema that you used? I cannot reproduce this with my schemas. |
Here's the one for the file where the error was taking place {
"additionalProperties": {
"properties": {
"field": {
"type": "string"
},
"variants": {
"type": "array",
"items": {
"$ref": "#/definitions/variant",
"uniqueItems": true
}
},
"default": {
"$ref": "#/definitions/variant"
},
"inputs": {
"type": "object",
"additionalProperties": {
"type": "object",
"additionalProperties": {
"$ref": "#/definitions/variant"
}
}
},
"rules": {
"type": "array",
"items": {
"$ref": "./rules.schema.json#/definitions/rule"
}
}
},
"required": ["field", "variants", "inputs", "rules"]
},
"definitions": {
"variant": {
"type": "string",
"pattern": "[a-z][a-z\\d_]*"
}
}
} And here's the referenced {
"type": "array",
"items": {
"$ref": "#/definitions/rule"
},
"definitions": {
"rule": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"notes": {
"type": "string"
},
"links": {
"type": "array",
"items": {
"properties": {
"rel": {
"type": "string"
},
"url": {
"type": "string"
}
}
}
},
"nomination": {
"type": "string",
"pattern": "[a-z0-9_]+"
},
"weight": {
"type": "number",
"minimum": 1
},
"criteria": {
"type": "array",
"minItems": 1,
"items": {
"type": "object",
"properties": {
"field": {
"type": "string"
},
"operator": {
"type": "string"
},
"operand": {
"type": "string"
}
},
"required": ["field", "operator", "operand"],
"additionalProperties": false
}
}
},
"required": ["id", "weight", "criteria", "nomination"]
}
}
} And then here's the {
"yaml.schemas": {
"./schemas/runoffs.schema.json": ["*.runoffs.yaml"]
},
"[yaml]": {
"editor.tabSize": 4
}
} |
bleach31
pushed a commit
to bleach31/vscode-yaml
that referenced
this issue
Jan 25, 2022
Signed-off-by: Yevhen Vydolob <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the bug
I have a YAML file with a schema defined in
.vscode/settings.json
, along with a custom YAML setting ofeditor.tabSize: 4
. When I use the array autocompletion, the following happens:I believe that the generated keys have gone one indentation deeper than their parent, without realizing that an array parent only goes in two spaces.
Expected Behavior
The
model
,weight
, andcriteria
keys should be aligned withid
.Current Behavior
See screenshot
Steps to Reproduce
.vscode/settings.json
with a YAML override, as described aboveEnvironment
The text was updated successfully, but these errors were encountered: