Reputation: 4907
I've found several questions similar to my situation, but none I thought were the same. I have an object that can have properties "address" and "geoPoint". It can have either or neither of these properties, just not both. How could this be done with JSONSchema?
Thanks in advance, Dan
Upvotes: 2
Views: 70
Reputation: 24409
The best way to do it is with dependencies
.
{
"type": "object",
"dependencies": {
"address": { "not": { "required": ["geoPoint"] } },
"geoPoint": { "not": { "required": ["address"] } }
}
}
Upvotes: 3