| cue eval check.cue |
| cmp stdout expect-stdout-cue |
| |
| -- frontmatter.toml -- |
| title = "Constraints" |
| description = "" |
| |
| -- text.md -- |
| Constraints specify what values are allowed. |
| To CUE they are just values like anything else, |
| but conceptually they can be explained as something in between types and |
| concrete values. |
| |
| But constraints can also reduce boilerplate. |
| If a constraint defines a concrete value, there is no need |
| to specify it in values to which this constraint applies. |
| |
| -- check.cue -- |
| schema: { |
| name: string |
| age: int |
| human: true // always true |
| } |
| |
| viola: schema |
| viola: { |
| name: "Viola" |
| age: 38 |
| } |
| |
| -- expect-stdout-cue -- |
| schema: { |
| name: string |
| age: int |
| human: true |
| } |
| viola: { |
| name: "Viola" |
| age: 38 |
| human: true |
| } |