One of the fields in my data is as follows:
{
"license":
"url": "<some url>",
"label": "<some label>"
}
I would like to validate that, for example, if the user provides either of the values for "url":
["http://creativecommons.org/licenses/by/4.0/",
"https://creativecommons.org/licenses/by/4.0/"]
That the value of label must be one of:
["CC-BY", "CC BY 4.0", "CC-BY 4.0"]
And there are multiple different label options, supporting HTTP or HTTPS. I tried the following, but the validation failed (couldn't validate), and I couldn't find anything about corresponding values, just if one field exists, then another must exist (dependencies).
"license": {
"type": "object",
"properties": {
"oneOf": [
{
"url": { "enum": ["http://creativecommons.org/licenses/by/4.0/", "https://creativecommons.org/licenses/by/4.0/"] },
"label": { "enum": ["CC-BY", "CC BY 4.0", "CC-BY 4.0"] }
},
{
"url": { "enum": ["http://creativecommons.org/publicdomain/zero/1.0/", "https://creativecommons.org/publicdomain/zero/1.0/"] },
"label": { "enum": ["CC-0", "CC0", "CC0 1.0 Universal", "CC0 1.0"] }
},
{
"url": { "enum": ["http://creativecommons.org/licenses/by/3.0/", "https://creativecommons.org/licenses/by/3.0/"] },
"label": { "enum": ["CC-BY", "CC-BY 3.0"] }
}
... <and so on>
I tried a couple of different iterations of dependencies/properties in oneOf
and nothing seemed to work.