github.com/solo-io/cue@v0.4.7/doc/tutorial/basics/0_intro/40_constraints.txt (about)

     1  cue eval check.cue
     2  cmp stdout expect-stdout-cue
     3  
     4  -- frontmatter.toml --
     5  title = "Constraints"
     6  description = ""
     7  
     8  -- text.md --
     9  Constraints specify what values are allowed.
    10  To CUE they are just values like anything else,
    11  but conceptually they can be explained as something in between types and
    12  concrete values.
    13  
    14  But constraints can also reduce boilerplate.
    15  If a constraint defines a concrete value, there is no need
    16  to specify it in values to which this constraint applies.
    17  
    18  -- check.cue --
    19  schema: {
    20      name:  string
    21      age:   int
    22      human: true // always true
    23  }
    24  
    25  viola: schema
    26  viola: {
    27      name: "Viola"
    28      age:  38
    29  }
    30  
    31  -- expect-stdout-cue --
    32  schema: {
    33      name:  string
    34      age:   int
    35      human: true
    36  }
    37  viola: {
    38      name:  "Viola"
    39      age:   38
    40      human: true
    41  }