-
Notifications
You must be signed in to change notification settings - Fork 134
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add example of adding a map to an array in a complex object
- Loading branch information
1 parent
03003d0
commit c5d559f
Showing
3 changed files
with
33 additions
and
0 deletions.
There are no files selected for viewing
17 changes: 17 additions & 0 deletions
17
examples/playground/overlays/example-append-map-to-array/_data.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
--- | ||
id: 1 | ||
type: book | ||
awards: | ||
books: | ||
- id: 1 | ||
title: International Botev | ||
reviewers: | ||
- id: 2 | ||
name: PersonB | ||
- id: 2 | ||
title: Dayton Literary Peace Prize | ||
reviewers: | ||
- id: 3 | ||
name: PersonC | ||
- id: 3 | ||
title: Example Book |
15 changes: 15 additions & 0 deletions
15
examples/playground/overlays/example-append-map-to-array/append-map-to-array.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#@ load("@ytt:overlay", "overlay") | ||
|
||
#! Add a map to an array of maps: | ||
|
||
#@overlay/match by=overlay.all | ||
--- | ||
awards: | ||
books: | ||
#@overlay/match by=overlay.all, expects="1+" | ||
- | ||
#@overlay/match missing_ok=True | ||
reviewers: | ||
#@overlay/append | ||
- id: 1 | ||
name: Person A |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters