-
Originally opened by @tnarg in cuelang/cue#401 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: 3 comments 5 replies
-
Original reply by @tnarg in cuelang/cue#401 (comment) I can imagine something like
|
Beta Was this translation helpful? Give feedback.
-
Original reply by @myitcv in cuelang/cue#401 (comment) 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.
-
Original reply by @mpvl in cuelang/cue#401 (comment) There is a Edit: this is now supported (updated to reflect new support in new evaluator) |
Beta Was this translation helpful? Give feedback.
Original reply by @mpvl in cuelang/cue#401 (comment)
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)