next: Order is irrelevant

Validation

Constraints can be used to validate values of concrete instances. They can be applied to CUE data, or directly to YAML or JSON.

schema.cue

#Language: {
	tag:  string
	name: =~"^\\p{Lu}" // Must start with an uppercase letter.
}
languages: [...#Language]

data.yaml

languages:
  - tag: en
    name: English
  - tag: nl
    name: dutch
  - tag: no
    name: Norwegian

$ cue vet schema.cue data.yaml

languages.1.name: invalid value "dutch" (does not match =~"^\\p{Lu}"):
    ./schema.cue:3:8
    ./data.yaml:5:12