Is there a better way to inject a default list value than what I've come up with so far? #399
-
Hi! 👋 I'm looking for a way to specify a list value that always contains a default value in descendant lists. I've found 2 ways that work, but they both feel cumbersome as the author of the descendant list has to be aware of the default value and explicitly include it for it to work properly. In the example below, is there a way to make option "d" work?
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 4 replies
-
Probably the simplest way to do this for now is as follows:
This has the added advantage that when CUE supports embedded scalars the
(with some variation because the concatenation of lists might well change to be defined in terms of list comprehensions). |
Beta Was this translation helpful? Give feedback.
-
This discussion has been migrated to cue-lang/cue#399. For more details about CUE's migration to a new home, please see cue-lang/cue#1078. |
Beta Was this translation helpful? Give feedback.
Probably the simplest way to do this for now is as follows:
This has the added advantage that when CUE supports embedded scalars the
res
field can be dropped and this example would become:(with some variation because the concatenation of lists might well change to be defined in terms of list comprehensions).