Values can often be one of several datatypes (like string or int, class A or class B, ...).
There should be a way to model unions (anonymous or tagged).
Describing this in the schema is a bit tricky though, since the datatype property is just a single value.
Options:
- allow the
datatype property to be an array of possible types
- add an additional property for the
Property class: somehting like alternativeDataTypes
- require defining a custom datatype for each union.
There could be a UnionType class which has a datatypes property, and custom union datatypes specify "isA: "Union". That's rather awkward though, since you could end up with StringOrInt` etc datatypes , which pollute the readability of a schema quite a bit, and more importantly might be duplicated a lot
Non of these is really ideal.
Curios about alternative thoughts here.
Values can often be one of several datatypes (like string or int, class A or class B, ...).
There should be a way to model unions (anonymous or tagged).
Describing this in the schema is a bit tricky though, since the datatype property is just a single value.
Options:
datatypeproperty to be an array of possible typesPropertyclass: somehting likealternativeDataTypesThere could be a
UnionTypeclass which has adatatypesproperty, and custom union datatypes specify "isA: "Union". That's rather awkward though, since you could end up withStringOrInt` etc datatypes , which pollute the readability of a schema quite a bit, and more importantly might be duplicated a lotNon of these is really ideal.
Curios about alternative thoughts here.