Skip to content

Validating a stringy UUID #3237

Answered by infogulch
hansbogert asked this question in Q&A
Jun 19, 2024 · 1 comments · 6 replies
Discussion options

You must be logged in to vote

You probably want an alias: https://cuelang.org/docs/reference/spec/#aliases

In your case I think it would look like this:

records: RecordName=[=~".*will-have-uuid.*"]: _record & {
  _uuid: strings.Split(RecordName, ".")
  _uuid: uuid.valid
}

Edit: Or maybe [RecordName=~".*will-have-uuid.*"].

Replies: 1 comment 6 replies

Comment options

You must be logged in to vote
6 replies
@hansbogert
Comment options

@infogulch
Comment options

@hansbogert
Comment options

@infogulch
Comment options

@hansbogert
Comment options

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
2 participants