Created
December 21, 2009 03:04
-
-
Save lloyd/260736 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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