Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mappings caveat or hidded beahaviour or bug with complex json #2560

Closed
sviyh opened this issue May 5, 2024 · 1 comment
Closed

Mappings caveat or hidded beahaviour or bug with complex json #2560

sviyh opened this issue May 5, 2024 · 1 comment

Comments

@sviyh
Copy link

sviyh commented May 5, 2024

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: "

@mihaitodor
Copy link
Collaborator

mihaitodor commented May 5, 2024

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.

@redpanda-data redpanda-data locked and limited conversation to collaborators May 5, 2024
@mihaitodor mihaitodor converted this issue into discussion #2561 May 5, 2024

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants