I've tried to use JSON Schema and the big gap I couldn't figure was how to handle polymorphism.<p>That is, if I have a case where object<p><pre><code> {
"Foo": {
"Type":"Fred"
"Bar":1
"Baz":2
"Quux":2
}
}
</code></pre>
and the object<p><pre><code> {
"Foo": {
"Type":"Waldo"
"Bar":1
"Corge":2
"Xyzzy":7
}
}
</code></pre>
are both valid, without just allowing any object members or allowing the union of their members.<p>I did a hack by multiplexing the types into a child-object, but that was ugly and clumsy.<p>In XSD or any statically-typed programming language I could handle this trivially using types and polymorphism, because "Fred" and "Waldo" would be different types.<p>But I can't figure out how to do that in Json Schema.