This Commented CUE demonstrates how to use the built-in function list.UniqueItems to ensure that a list’s items are unique.

file.cue
package example

import "list"

aList: list.UniqueItems
aList: [1, 2.0, 3, "four", 5, 5.0, false,
	{a: 1, b: "2", c: false}, // validation error
	{a: 1, b: "2", c: true},
	{a: 1, b: 2, c: false},
	{a: 1, b: "2", c: false}, // validation error
]
TERMINAL
$ cue vet
some instances are incomplete; use the -c flag to show errors or suppress this message
  • The list built-in package