...
1! exec cue vet schema.cue data.yaml
2cmp stderr expect-stderr
3
4-- frontmatter.toml --
5title = "Validation"
6description = ""
7
8-- text.md --
9Constraints can be used to validate values of concrete instances.
10They can be applied to CUE data, or directly to YAML or JSON.
11
12-- schema.cue --
13#Language: {
14 tag: string
15 name: =~"^\\p{Lu}" // Must start with an uppercase letter.
16}
17languages: [...#Language]
18
19-- data.yaml --
20languages:
21 - tag: en
22 name: English
23 - tag: nl
24 name: dutch
25 - tag: no
26 name: Norwegian
27
28-- expect-stderr --
29languages.1.name: invalid value "dutch" (out of bound =~"^\\p{Lu}"):
30 ./schema.cue:3:8
31 ./data.yaml:5:11
View as plain text