Skip to content

Instantly share code, notes, and snippets.

@lloyd
Created December 21, 2009 03:04
Show Gist options
  • Save lloyd/260736 to your computer and use it in GitHub Desktop.
Save lloyd/260736 to your computer and use it in GitHub Desktop.
union confusion: these are equivalent:
{
"type": [ "string", "integer" ],
"minLength": 10,
"minimum": 7
}
{
"type": [
{ "type": "string", "minLength": 10 },
{ "type": "integer", "minimum": 7 }
]
}
what feels more natural to you? I think type should always be a string and this is a more explicit and natural way to express a "union":
{
"type": "union",
"either": {
{ "type": "string", "minLength": 10 },
{ "type": "integer", "minimum": 7 }
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment