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

New outputKey() and keepInputData() step methods #64

Merged
merged 2 commits into from Dec 21, 2022

Conversation

otsch
Copy link
Member

@otsch otsch commented Dec 7, 2022

New methods outputKey() and keepInputData() that can be used with any step. Using the outputKey() method, the step will convert non array output to an array and use the key provided as an argument to this method as array key for the output value. The keepInputData() method allows you to forward data from the step's input to the output. If the input is non array you can define a key using the method's argument. This is useful e.g. if you're having data in the initial inputs that you also want to add to the final crawling results.

Breaking change: Group steps can now only produce combined outputs, as previously done when combineToSingleOutput() method was called. The method is removed.
This is done because I think there is no real use case for a group step yielding separate outputs for all the different steps it contains. And on the other hand there have already been some Exceptions that have been thrown when certain methods are called without calling combineToSingleOutput() first, because they can only work with combined output. So, this also removes the need for such Exceptions.

keepInputData() can be called on any step, to add data from the input
of a step, to the resulting outputs. It combines the data in an array.
If the input was non array, you can define a key for that input. Same
for non array outputs.
Group steps can now only produce combined outputs, as previously done
when `combineToSingleOutput()` method was called. The method is removed.
This was done because I don't really see any actual use case for a group
with all the steps yielding separate outputs.

Using the new `outputKey()` method, a step will convert non array output
to an array and use the key provided as argument to this method as array
key for the output value.
@otsch otsch changed the title New keepInputData() functionality New outputKey() and keepInputData() step methods Dec 21, 2022
@otsch otsch merged commit 077e243 into main Dec 21, 2022
@otsch otsch deleted the feature/keep-input-data branch December 21, 2022 11:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant