Merge Yaml to a specific File
Sid532001 opened this issue · comments
Sidhant Suman commented
Hi @openrewrite i want to write a recipe which inserts a snippet inside a key in a specific yaml file in my case application.yaml
Current scenario
i have a field
animals:
End result
I want my result to look like this
animals:
dog:
pet:
labrador
Do we have any recipe to perform this operation on a specific file
@timtebeek
Tim te Beek commented
Sure, you can use our merge yaml recipe and combine that with a precondition that limits the recipe to files matching a particular path, as seen here: https://docs.openrewrite.org/reference/yaml-format-reference#preconditions
Hope that helps!