You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -781,6 +782,7 @@ yields the list `[ 1, 2, 3, "alice" ]` for `bar`.
781
782
### `(( map1 map2 ))`
782
783
783
784
Concatenation of maps as expression. Any sequences of maps can be concatenated, given by any dynaml expression. Thereby entries will be merged. Entries with the same key are overwritten from left to right.
785
+
This is a flat map merge, only top level entries are merged. If you want a deep merge you can use [deepmerge(map1, map2)](#-deepmergemap1-map2-)
784
786
785
787
e.g.:
786
788
@@ -2826,6 +2828,54 @@ merged:
2826
2828
sum: 49
2827
2829
```
2828
2830
2831
+
### `(( deepmerge(map1, map2) ))`
2832
+
2833
+
The `merge` function provides a spiff-like merge used for merging templates and stubs. Hereby, only existing entries can be overwritten.
2834
+
If a formal deep merge of map entries is required, the `deepmerge` function can be used.
2835
+
2836
+
If an entry in both maps is a again a map, those maps are merged recursively, again.
2837
+
It is possible to give any number of maps as arguments to `deepmerge`.
2838
+
Alternatively a single list of maps can be given.
2839
+
Merging is done from left to right, where values in later maps replace left values.
2840
+
2841
+
e.g.:
2842
+
2843
+
```yaml
2844
+
map1:
2845
+
a: a
2846
+
b: b
2847
+
c:
2848
+
a: ca
2849
+
b: cb
2850
+
d: d
2851
+
2852
+
map2:
2853
+
a: 2a
2854
+
c:
2855
+
a: 2ca
2856
+
c: 2cc
2857
+
d:
2858
+
a: 2da
2859
+
e: 2e
2860
+
2861
+
merged: (( deepmerge(map1,map2) ))
2862
+
```
2863
+
2864
+
resolves `merged` to
2865
+
2866
+
```yaml
2867
+
merged:
2868
+
a: 2a
2869
+
b: b
2870
+
c:
2871
+
a: 2ca
2872
+
b: cb
2873
+
c: 2cc
2874
+
d:
2875
+
a: 2da
2876
+
e: 2e
2877
+
```
2878
+
2829
2879
### `(( intersect(list1, list2) ))`
2830
2880
2831
2881
The function `intersect` intersects multiple lists. A list may contain entries
0 commit comments