Skip to content

Odd behavior with empty lists, concat, and toJson #10699

@mcg1969

Description

@mcg1969

Output of helm version:

version.BuildInfo{Version:"v3.7.2", GitCommit:"663a896f4a815053445eec4153677ddc24a0a361", GitTreeState:"clean", GoVersion:"go1.16.10"}

Output of kubectl version:

Client Version: version.Info{Major:"1", Minor:"23", GitVersion:"v1.23.3", GitCommit:"816c97ab8cff8a1c72eccca1026f7820e93e0d25", GitTreeState:"clean", BuildDate:"2022-01-25T21:25:17Z", GoVersion:"go1.17.6", Compiler:"gc", Platform:"darwin/amd64"}
Server Version: version.Info{Major:"1", Minor:"23", GitVersion:"v1.23.3", GitCommit:"816c97ab8cff8a1c72eccca1026f7820e93e0d25", GitTreeState:"clean", BuildDate:"2022-01-25T21:19:12Z", GoVersion:"go1.17.6", Compiler:"gc", Platform:"linux/amd64"}

Cloud Provider/Platform (AKS, GKE, Minikube etc.): Minikube 1.25.1

Odd behavior of the Helm/Spring concat function with regards to empty lists:

Input:

# {{ list | toJson }}
# {{ concat (list) (list) | toString }}
# {{ concat (list) (list) | toJson }}
# {{ dict | toJson }}
# {{ merge (dict) (dict) | toString }}
# {{ merge (dict) (dict) | toJson }}

What I would expect:

# []
# []
# []
# {}
# map[]
# {}

What I actually get: in the concat case, a null instead of the empty list.

# []
# []
# null
# {}
# map[]
# {}

I've already worked around this, but I wanted to report it and see if this is intended behavior—because if it is, the docs do not indicate this would be the behavior. Perhaps there is a subtlety of the JSON standard I'm missing!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions