Mappings caveat or hidded beahaviour or bug with complex json
sviyh opened this issue · comments
This works:
pipeline:
processors:
- mapping: |
root.issue = {
self: this.self,
id: this.id,
key: this.key,
}
root.issue.creator = this.fields.creator.displayName
while this doesn't:
pipeline:
processors:
- mapping: |
root.issue = {
self: this.self,
id: this.id,
key: this.key,
creator:this.fields.creator.displayName
}
It returns the error which explains nothing: "failed assignment (line 1): mapping returned invalid key type: "
Hey @sviyh 👋 I'm really struggling to reproduce the issue you're seeing. At a quick glance, the bloblang code you shared above isn't valid, since the keys in the issue
object you're trying to create aren't double quoted. For example, this works just fine:
root.issue = {
"self": this.self,
"id": this.id,
"key": this.key,
"creator": this.fields.creator.displayName
}
You'd get nulls if the input message doesn't have the fields which are being referenced via this
, but I'm not sure how to reproduce the error you're seeing.
LE: Moving to a discussion as per #2026.