Skip to content
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

Improve support for ION/JSON processing in Pebble expressions #3715

Closed
3 tasks done
anna-geller opened this issue May 13, 2024 · 0 comments · Fixed by #4289
Closed
3 tasks done

Improve support for ION/JSON processing in Pebble expressions #3715

anna-geller opened this issue May 13, 2024 · 0 comments · Fixed by #4289
Assignees
Labels
area/backend Needs backend code changes enhancement New feature or request kind/customer-request Requested by one or more customers
Milestone

Comments

@anna-geller
Copy link
Member

anna-geller commented May 13, 2024

Required todos:

  • rename the json filter to jsonEncode for more clarity about what it does — it takes a data structure or object and converts it into a JSON string e.g. {{ [1, 2, 3] | jsonEncode }}
  • rename the json() function to jsonDecode() to make it clear that it takes a JSON string and converts it into a data structure or object so the user can access further attributes using a dot notation e.g. '{{ jsonDecode(read(taskrun.items)) }}'
  • add a new ionDecode() function that will take an ION string (from reading an ION file) and convert it into a data structure or object e.g. '{{ ionDecode(read(taskrun.items)) }}'; this function can only process a single row

Important notes:

  • The renaming should ideally be implemented in a non-breaking way e.g. using json() will raise a warning in the UI but it will still work
  • The goal of these tasks is to make it easy to process data split by ForEachItem. However, the ionDecode() function should raise an error when trying to parse a multi-line string (i.e. ION file with multiple rows); this is important for performance reasons
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/backend Needs backend code changes enhancement New feature or request kind/customer-request Requested by one or more customers
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants