@@ -395,24 +395,24 @@ Example:
395
395
{{- $hasIndexKey := and (hasKey $pathObj "indexKey") (not (empty $pathObj.indexKey)) -}}
396
396
{{- $defaults := index $pathObj "defaultFor" | default list -}}
397
397
{{- range $key, $value := $current -}}
398
- {{/* We need deepCopy here to prevent reference sharing between list items */}}
399
- {{- $newObj := deepCopy $value -}}
400
- {{- if $hasIndexKey -}}
401
- {{/* Strip any suffix after @ from the key, the
402
- driver here is that often there is no single
403
- unique parameter to use as indexKey */}}
404
- {{- $baseKey := regexReplaceAll "@.*$" $key "" -}}
405
- {{- $_ := set $newObj $pathObj.indexKey $baseKey -}}
406
- {{/* Apply defaults if any exist */}}
407
- {{- if $hasDefaults -}}
408
- {{- range $defaultKey := $defaults -}}
409
- {{- if not (hasKey $newObj $defaultKey) -}}
410
- {{- $_ := set $newObj $defaultKey $baseKey -}}
411
- {{- end -}}
412
- {{- end -}}
413
- {{- end -}}
414
- {{- end -}}
415
- {{- $resultList = append $resultList $newObj -}}
398
+ {{/* We need deepCopy here to prevent reference sharing between list items */}}
399
+ {{- $newObj := deepCopy $value -}}
400
+ {{- if $hasIndexKey -}}
401
+ {{/* Strip any suffix after @ from the key, the
402
+ driver here is that often there is no single
403
+ unique parameter to use as indexKey */}}
404
+ {{- $baseKey := regexReplaceAll "@.*$" $key "" -}}
405
+ {{- $_ := set $newObj $pathObj.indexKey $baseKey -}}
406
+ {{/* Apply defaults if any exist */}}
407
+ {{- if $hasDefaults -}}
408
+ {{- range $defaultKey := $defaults -}}
409
+ {{- if not (hasKey $newObj $defaultKey) -}}
410
+ {{- $_ := set $newObj $defaultKey $baseKey -}}
411
+ {{- end -}}
412
+ {{- end -}}
413
+ {{- end -}}
414
+ {{- end -}}
415
+ {{- $resultList = append $resultList $newObj -}}
416
416
{{- end -}}
417
417
{{/* Direct mutation of parent */}}
418
418
{{- $_ := set $parent $lastKey $resultList -}}
0 commit comments