redhat-developer / redhat-developer/vscode-yaml
Changing default value on another property value
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 829
- Forks
- 260
- Avg merge
- 5h 43m
- Merged PRs (30d)
- 1
Description
Summary
I have the following schema (it is just a simplified jekyll.json from my PR):
{
"$schema": "http://json-schema.org/draft-07/schema",
"$comment": "https://jekyllrb.com/docs/configuration/",
"title": "Jekyll static site generator config file schema",
"definitions": {
"implementation": {
"description": "The implementation to use",
"type": "string",
"enum": [
"sassc",
"sass-embedded"
],
"default": "sassc"
}
},
"type": "object",
"properties": {
"sass": {
"description": "Sass options",
"type": "object",
"properties": {
"implementation": {
"$ref": "#/definitions/implementation"
}
},
"allOf": [
{
"if": {
"properties": {
"implementation": {
"const": "sassc"
}
}
},
"then": {
"type": "object",
"properties": {
"implementation": {
"$ref": "#/definitions/implementation"
},
"style": {
"description": "Style of CSS-output",
"type": "string",
"enum": [
"nested",
"compact",
"compressed",
"expanded"
],
"default": "compact"
}
},
"additionalProperties": true
},
"else": {
"type": "object",
"properties": {
"implementation": {
"$ref": "#/definitions/implementation"
},
"style": {
"description": "Style of CSS-output",
"type": "string",
"enum": [
"nested",
"compact",
"compressed",
"expanded"
],
"default": "expanded"
}
},
"additionalProperties": false
}
}
],
"additionalProperties": false
}
},
"additionalProperties": false
}
Default style value must be dependant on implementation value:
- if
implementationissasscthenstyledefault iscompact - else
styledefault isexpanded
The problem is that when I try to use my style property I obtain: Property style is not allowed. error:

How to fix this problem?
Relevant information
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
No repository file or test is named. Reproduce the reported style error with the simplified schema, then trace the YAML language server's handling of conditional allOf schemas and property completion. Done means the conditional schema no longer reports style as disallowed and applies the expected default for each implementation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript, vscode, yaml
- Domain
- devtools, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100