! exec cue vet schema.cue data.yaml
cmp stderr expect-stderr

-- frontmatter.toml --
title = "Validation"
description = ""

-- text.md --
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

-- expect-stderr --
languages.1.name: invalid value "dutch" (out of bound =~"^\\p{Lu}"):
    ./schema.cue:3:8
    ./data.yaml:5:11
