I have 2 properties I want to list out which are os_type and os_version.
os_type would be an enum with several values like windows, linux, etc.
based on the os_type, os_version values would be different enum values.
like for windows, os_version would be 7,8,10
for linux, os_version would be ubuntu, fedora etc
How can I do this with a json schema where os_version is dependent on the os_type and different enum values for os_version are displayed based on the os_type?
This is my current code snippet, not quite working.
{
"namespace": "MetadataOSVersion",
"display_name": "Company Metadata: OS Version",
"description": "Company Metadata: OS Version",
"visibility": "public",
"protected": true,
"objects": [
{
"name": "os_type",
"description": "os_type",
"properties": {
"os_type":
{
"title": "os_type",
"description": "os_type",
"type": "string",
"enum": ["Linux", "Windows"]
},
"os_version":
{
"title": "os_version",
"description": "os_version",
"type": "string",
"required": ["os_type"],
"oneOf": [
{{"os_type": {"enum": ["Windows"], "enum": ["7", "8", "10"]}}},
{{"os_type": {"enum": ["Linux"], "enum": ["Ubuntu", "Fedora"]}}}
]
}
}
}
]
}