Field comprehensions can be used to add fields conditionally.
file.cue
price: number
// High prices require a reason and the name of
// the authorising person.
if price > 100 {
reason!: string
authorisedBy!: string
}stock.yaml
price: 200TERMINAL
$ cue export file.cue stock.yaml
authorisedBy: field is required but not present
reason: field is required but not presentWhen
cue export processes multiple files it unifies their contents.
The value of the price field in stock.yaml is available inside file.cue,
and triggers the conditional inclusion of the required fields.