! exec cue vet file.cue
-- file.cue --
people: [
{name: "alice"},
{name: "bob"},
{name: "bob"},
]
_uniqueNames: {
for i, person in people { (person.name): i }
}
... or maybe this, which allows a set of specific fields to be checked whilst ignoring others:
! exec cue vet file.cue
-- file.cue --
import "list"
people: [
{name: "alice", someOtherField: 1},
{name: "bob", someOtherField: 2},
{name: "bob", someOtherOtherField: 3},
]
_uniqueNames: list.UniqueItems & [
for e in people {name:e.name}
]
The thread this came from was perf-related, so perhaps some tests at scale on the above 2 options might be useful to help decide the approach to be documented.
From a slack thread: https://cuelang.slack.com/archives/CLT3ULF6C/p1708094593391999?thread_ts=1708093684.648429&cid=CLT3ULF6C (not persisted here as the thread is wider than just this doc)
... or maybe this, which allows a set of specific fields to be checked whilst ignoring others:
The thread this came from was perf-related, so perhaps some tests at scale on the above 2 options might be useful to help decide the approach to be documented.