Union
A Union represents a Type whose value can be one of a set of other Types.
This is conceptually similar to an Enum, in that it constrains the set of possible values of instances of the Union. However it is less restrictive than a single Type, because values can be of any of the Types in the Union.
#
ExampleThe following example specifies that User.id
can only be one of string
, int32
or TypeUUID
:
!type TypeUUID: id <: string
!union UnionType: string int32 TypeUUID
!type User: id <: UnionType
#
See also- Application: parent element
- Type
- Enum
External references: