next: Duplicate Fields

Types are values

CUE merges the concepts of values and types. Below is a demonstration of this concept, showing respectively some data, a possible schema for this data, and something in between: a typical CUE constraint.

Data
moscow: {
  name:    "Moscow"
  pop:     11.92M
  capital: true
}
Schema
municipality: {
  name:    string
  pop:     int
  capital: bool
}
CUE
largeCapital: {
  name:    string
  pop:     >5M
  capital: true
}

In general, in CUE one starts with a broad definition of a schema, describing all possible instances, and then narrows down these definitions for particular use cases until a concrete data instance remains.