-
I was reading through #165 and it seems that what I'm trying to do may come later, but one comment caught my attention that made me think it was already possible. Given the following: #Profile: {
id: string
first_name: "David" | "Brian"
last_name: string
// cat_id: categories[=~".*"]
cat_id: string
}
#Category: {
id: string
name: string
}
profiles: [string]: #Profile
categories: [string]: #Category
I was hoping that I could enforce a category to exist when a Is this currently possible with 0.3.0? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
One way is to use
Note also that I've also assumed
|
Beta Was this translation helpful? Give feedback.
-
This discussion has been migrated to cue-lang/cue#875. For more details about CUE's migration to a new home, please see cue-lang/cue#1078. |
Beta Was this translation helpful? Give feedback.
One way is to use
or()
with a comprehension.Note also that I've also assumed
profiles
andcategories
need to be keyed by their respective ids.or()
is really powerful because it allows you to "invert" the constraint your are looking to apply. Instead of saying "check t…