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
feat(jinja2/filters): add builtin filter for merge_strategic (#1287)
Fixes #
## Proposed Changes
* Add in jinja2 filter to traverse all items in a supplied struct, and
create a strategic merge like experience where all items in a list will
be merged together if a common key(`name`) is found
## Docs and Tests
* [ ] Tests added
* [x] Updated documentation
Co-authored-by: Jon McLean <[email protected]>
Co-authored-by: Alessandro De Maria <[email protected]>
Copy file name to clipboardExpand all lines: docs/pages/input_types/jinja.md
+4Lines changed: 4 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -171,6 +171,10 @@ We support the following custom filters for use in Jinja2 templates:
171
171
=== "`reveal_maybe`"
172
172
!!! example "reveal `ref/secret` tag only if `compile --reveal` flag is set"
173
173
`{{ "?{base64:my_ref}" | reveal_maybe}}`
174
+
=== "Struct"
175
+
=== "`merge_strategic`"
176
+
!!! example "traverse object(s) and merge lists based on common `name`"
177
+
`{{ data | merge_strategic | yaml | trim | indent(6)}}`
174
178
175
179
!!! tip
176
180
You can also provide path to your custom filter modules in CLI. By default, you can put your filters in `lib/jinja2_filters.py` and they will automatically get loaded.
0 commit comments