Skip to content

Validate YAML string, which itself is YAML #2772

Closed Answered by hansbogert
hansbogert asked this question in Q&A
Discussion options

You must be logged in to vote

It's probably asked before, but I think use-case is missing from the docs, AFAICT.

Well I guess I Can't Tell that much, it's in the docs, though perhaps not explicit with the pipe-sign in the yaml.

For search engine stragglers:

import "encoding/yaml"

spec: values: yaml.Validate(#Annotations)

#Annotations:{
  annotations: [string]: =~ "^(\\w+)(,\\s*\\w+)*$"
}
$ cue  vet foo.yaml foo.cue
[exit code 0]

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by hansbogert
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant