To use itemsToParse again inside each section of a multi-document YAML file
R
Rich Rein
It would be helpful and practical to be able to use itemsToParse again inside each section of a multi-document YAML file
For example, something like the below.
resources:
- kind: file
selector:
query: "true"
files:
- path: "config/repos.yaml"
port:
itemsToParse: .file.content | if type== "object" then [.] else . end
entity:
itemsToParse: .item.repos
mappings:
identifier: .item.name
title: .item.name
blueprint: '"repository"'
properties:
url: .item.url
team: .item.team
R
Richard Rein Jr
To create a more concrete example, we have configuration files like the following:
# application.yml (Spring Boot)
spring:
profiles: dev
mydomain:
myproperty: "value1"
---
spring:
profiles: beta
mydomain:
myproperty: "value2"
---
spring:
profiles: prod
mydomain:
myproperty: "value3"
Currently, we are unable to parse the individual contents of this file (e.g., being able to have a "spring_configuration" blueprint, with one entity per "document" in the above file example). Ideally, we wanting to be able to have something like the following for a mapping to ingest this file (using a bit of psuedo code for the actual mapping bits):
- kind: file
selector:
query: 'true'
files:
path:
- src/main/resources/application.yml
port:
itemsToParse: .file.content | if type== "object" then [.] else . end
entity:
itemsToParse: .item
mappings:
identifier: (.repo.name + '_' + .item.spring.profiles)
title: (.repo.name + '_' + .item.spring.profiles)
blueprint: '"spring_configuration"'
properties:
profile: .item.spring.profiles
myproperty: .item.mydomain.myproperty