blob: e61ed735c547231331c83bcaa33cb5a11294c9e0 [file] [log] [blame]
! cue vet ./yaml.cue
cmp stderr expect-stderr
-- expect-stderr --
phrases: invalid value "phrases:\n # A quote from Mark Twain.\n quote1:\n lang: en\n attribution: Mark Twain\n\n # A Norwegian proverb.\n proverb:\n lang: no\n text: Stemmen som sier at du ikke klarer det, lyver." (does not satisfy encoding/yaml.Validate({phrases:{},#Phrase:{lang:=~"^[a-zA-Z0-9-_]{2,}$" | false,text:!=""},#LanguageTag:=~"^[a-zA-Z0-9-_]{2,}$" | false})): error in call to encoding/yaml.Validate: incomplete value !="":
./yaml.cue:19:10
./yaml.cue:21:10
-- yaml.cue --
import "encoding/yaml"
// Phrases defines a schema for a valid phrase.
#Phrases: {
phrases: {
[string]: #Phrase
}
#Phrase: {
lang: #LanguageTag
text: !=""
attribution?: !="" // must be non-empty when specified
}
#LanguageTag: =~"^[a-zA-Z0-9-_]{2,}$" | false
}
// phrases is a YAML string with a field phrases that is a map of Phrase
// objects.
phrases: yaml.Validate(#Phrases)
phrases: """
phrases:
# A quote from Mark Twain.
quote1:
lang: en
attribution: Mark Twain
# A Norwegian proverb.
proverb:
lang: no
text: Stemmen som sier at du ikke klarer det, lyver.
"""