-
Notifications
You must be signed in to change notification settings - Fork 33
Open
Description
Input:
{
"Hello": "World/download"
}
Flux:
inputFile
| open-file
| as-records
| decode-json
| fix(transformationFile)
| encode-yaml
| print
;
Fix:
add_array("encoding[]")
if exists("Hello")
copy_field("Hello","encoding[].$append.contentUrl")
add_field("encoding[].$last.type", "MediaObject")
if any_contain("Hello","o")
add_field("encoding[].$append.type", "MediaObject")
copy_field("Hello", "encoding[].$last.embedUrl")
copy_field("Hello", "image")
end
end
replace_all("encoding[].*.embedUrl","download","preview")
replace_all("image","download","thumbnail")
Output:
---
Hello: "World/download"
encoding:
- contentUrl: "World/download"
type: "MediaObject"
embedUrl: "World/preview"
- type: "MediaObject"
embedUrl: "World/download"
image: "World/thumbnail"
Expected:
---
Hello: "World/download"
encoding:
- contentUrl: "World/download"
type: "MediaObject"
- type: "MediaObject"
embedUrl: "World/download"
image: "World/download"
If replace_all("image","download","thumbnail") is outcommented the mapping is working correctly
Metadata
Metadata
Assignees
Type
Projects
Status
Backlog