-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Labels
enhancementNew feature or requestNew feature or request
Description
0.0.9 export all changes.
While using a template, we cannot easily describe a list with a separator between each element, if we would like to filter the whole list.
As our template generates an array in json, the comma array syntax is key to be valid.
In short,
a template like this
[
{{ range $index, $item := . }}\
{
"name": "{{ $item.Name }}",
"value": "updated from {{ $item.OldVersion }} to {{ $item.NewVersion }}"
},
{{ end }}\
]
provide this kind of invalid json data (last comma must not exist)
[
{
"name": "ec2",
"value": "updated from 1.40.1 to 1.41"
},
{
"name": "ws-cleanup",
"value": "updated from 0.36 to 0.37"
},
]We need to find a way to detect the last element to avoid printing out the last comma
[
{{ range $index, $item := . }}\
{
"name": "{{ $item.Name }}",
"value": "updated from {{ $item.OldVersion }} to {{ $item.NewVersion }}"
}{{ if not ($List.IsLast $index) }},{{ end }}
{{ end }}\
]
and then generate following valid json:
[
{
"name": "ec2",
"value": "updated from 1.40.1 to 1.41"
},
{
"name": "ws-cleanup",
"value": "updated from 0.36 to 0.37"
}
]Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request