Is it possible to hide certain properties from autocompletions based on the value of a different property? #475
-
{
"properties": {
"type": {
"type": "string"
},
"class": {
"type": "string"
}
}
} I want the class property to only show in the autocompletions if type is set to "values:less_than". Is something like that possible, or is that not related to json schemas? For context I'm using VSC |
Beta Was this translation helpful? Give feedback.
Answered by
gregsdennis
Sep 5, 2023
Replies: 1 comment 1 reply
-
You might be able to use {
// ...
"if": {
"properties": {
"type": { "not": { "const": "values:less_than" } }
},
"required": [ "type" ]
},
"then": {
"properties": {
"class": false
}
}
} That would make validations fail when |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
Xterionix
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You might be able to use
if
/then
/else
.That would make validations fail when
type
is notvalues:less_than
andclass
is present. How VSCode responds to such a schema is unknown. You'll probably need to go to them if it's not supported.