Is there a way to enforce the structure of an object setting?
For example package.json
:
{
"contributes": {
"configuration": {
"properties": {
"myextension.mysetting": {
"type": "object",
"default": {
"anyKey": {
"property1": "",
"property2": ""
}
}
}
}
}
}
}
The setting myextension.mysetting
is an object type, where key anyKey
could be any string at user’s choosing and property1
and property2
are the only acceptable properties in that object. If user attempt enter other property name (i.e. property3
) it should show it as not an acceptable property.
Is this possible?
2
Answers
With @rioV8 answer this is the solution I was looking for:
you can add the property
to the scheme where you define
property1
andproperty2