File tree Expand file tree Collapse file tree 1 file changed +63
-2
lines changed Expand file tree Collapse file tree 1 file changed +63
-2
lines changed Original file line number Diff line number Diff line change @@ -92,11 +92,72 @@ Append a ``+`` sign to the attribute name to add given value::
92
92
/download:
93
93
time+: 3
94
94
95
- This operation is possible only for attributes of the same type.
96
- Exception ``MergeError `` is raised if types are different. When
95
+ This operation is possible only for attributes of the same type
96
+ or when merging a dictionary with a list.
97
+ Exception ``MergeError `` is raised if types are not compatible. When
97
98
the ``+ `` suffix is applied on dictionaries ``update() `` method is
98
99
used to merge content of given dictionary instead of replacing it.
99
100
101
+ Example: Merging dictionary with a list::
102
+
103
+ discover:
104
+ how: fmf
105
+ filter: "tier:1"
106
+
107
+ /path:
108
+ discover+:
109
+ - name: upstream
110
+ url: https://some.url
111
+ - name: downstream
112
+ url: https://other.url
113
+
114
+ results in::
115
+
116
+ /path:
117
+ discover:
118
+ - name: upstream
119
+ url: https://some.url
120
+ how: fmf
121
+ filter: "tier:1"
122
+ - name: downstream
123
+ url: https://other.url
124
+ how: fmf
125
+ filter: "tier:1"
126
+
127
+ Example: Merging list with a dictionary::
128
+
129
+ discover:
130
+ - how: fmf
131
+ url: https://github.com/project1
132
+ - how: fmf
133
+ url: https://github.com/project2
134
+
135
+ /tier1:
136
+ discover+:
137
+ filter: "tier:1"
138
+ /tier2:
139
+ discover+:
140
+ filter: "tier:2"
141
+
142
+ results in::
143
+
144
+ /tier1:
145
+ discover:
146
+ - how: fmf
147
+ url: https://github.com/project1
148
+ filter: "tier:1"
149
+ - how: fmf
150
+ url: https://github.com/project2
151
+ filter: "tier:1"
152
+ /tier2:
153
+ discover:
154
+ - how: fmf
155
+ url: https://github.com/project1
156
+ filter: "tier:2"
157
+ - how: fmf
158
+ url: https://github.com/project2
159
+ filter: "tier:2"
160
+
100
161
The special suffix ``+< `` can be used to prepend values instead of
101
162
appending them. This might be handy when adjusting lists::
102
163
You can’t perform that action at this time.
0 commit comments