github.com/solo-io/cue@v0.4.7/doc/tutorial/basics/2_types/65_sumstruct.txt (about)

     1  -- frontmatter.toml --
     2  title = "Disjunctions of Structs"
     3  description = ""
     4  
     5  -- text.md --
     6  Disjunctions work for any type.
     7  
     8  In this example we see that a `floor` of some specific house
     9  has an exit on level 0 and 1, but not on any other floor.
    10  
    11  -- sumstruct.cue --
    12  // floor defines the specs of a floor in some house.
    13  floor: {
    14      level:   int  // the level on which this floor resides
    15      hasExit: bool // is there a door to exit the house?
    16  }
    17  
    18  // constraints on the possible values of floor.
    19  floor: {
    20      level: 0 | 1
    21      hasExit: true
    22  } | {
    23      level: -1 | 2 | 3
    24      hasExit: false
    25  }