-
In the List tour I see that you can specify lists of exact length, e.g.
For such a small range, this isn't too bad, but for a list between 0 and 50 elements, this becomes exceedingly verbose. |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 4 replies
-
I can imagine something like
|
Beta Was this translation helpful? Give feedback.
-
One way of doing this today is:
There have been discussions about how to make this more idiomatic (and indeed make the constraint on the length reusable) but nothing formalised as yet. |
Beta Was this translation helpful? Give feedback.
-
There is a Edit: this is now supported (updated to reflect new support in new evaluator) |
Beta Was this translation helpful? Give feedback.
-
This discussion has been migrated to cue-lang/cue#401. For more details about CUE's migration to a new home, please see cue-lang/cue#1078. |
Beta Was this translation helpful? Give feedback.
There is a
list.MaxItems
in thelist
package.Builtin validators don't currently work correctly, however, as the evaluator doesn't handle non-monotonic constraints yet. This is addressed in the new evaluator work, which will handle such constraints.Edit: this is now supported (updated to reflect new support in new evaluator)