Skip to content

Adding elements to list that is not empty #3800

Answered by lujiajing1126
siredmar asked this question in Q&A
Discussion options

You must be logged in to vote

As hinted by the official implementation, this can be done by using + operator.

https://github.com/oam-dev/kubevela/blob/master/vela-templates/definitions/internal/trait/env.cue#L44-L59

I've tested with the following code snippet,

if parameter["env"] == _|_ {
    env: predefinedEnv
}

if parameter["env"] != _|_ {
    env: predefinedEnv + parameter.env
}

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@delprofundo
Comment options

Answer selected by wonderflow
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants
Converted from issue

This discussion was converted from issue #2852 on May 01, 2022 08:48.