blob: f2a89a2826332738ddcfd292e645d683c7cf3b52 [file] [log] [blame]
! 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.2.tag: conflicting values string and false (mismatched types string and bool):
./data.yaml:6:11
./schema.cue:2:8
languages.1.name: invalid value "dutch" (does not match =~"^\\p{Lu}"):
./schema.cue:3:8
./data.yaml:5:12