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

Adding an array method to bloblang #2545

Open
gramian opened this issue Apr 27, 2024 · 1 comment
Open

Adding an array method to bloblang #2545

gramian opened this issue Apr 27, 2024 · 1 comment
Labels
bloblang Bloblang features enhancement

Comments

@gramian
Copy link
Contributor

gramian commented Apr 27, 2024

Dear All,

I would like to propose adding a method array to bloblang, which returns always an array. Specifically, every non-array input is returned as single element array, while an array input is returned as-is. This is similar to the bytes method and motivated originally by parsing XML files transformed to JSON: An XML element with a single child element (or attribute) is returned as sub-object, while multiple child elements/attributes are returned as array. To further process such a subtree, it needs to be ensured always an array is returned. Practically this results in unwieldy constructs like this.with("name").values().flatten(). The newly proposed array method would reduce this to the more readable this.name.array().

Here is the associated pull request: #2538

Thank you for considering this enhancement

Best

@mihaitodor mihaitodor added enhancement bloblang Bloblang features labels Apr 27, 2024
@gramian
Copy link
Contributor Author

gramian commented May 10, 2024

@Jeffail WDYT? Does this addition fit? Is the PR in order?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bloblang Bloblang features enhancement
Projects
None yet
Development

No branches or pull requests

2 participants