-
Notifications
You must be signed in to change notification settings - Fork 238
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
feat: Allow preExecution hook to modify variables #921
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you document this new behavior?
Apologies @mcollina, I didn't expect the "re-review" button to drop the reviewers you requested, but apparently it does for some reason |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Functionally all good - just a small comment to add these changes to the typings :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
I saw discussions about this on #876, which mainly talked about accessing variables, but there is a comment that also mentions updating them.
I require this use-case, where hooks can modify the incoming variables based on logic or contacting external systems. See the test included with the PR for an example.
This could have be achieved by putting the logic in a plugin earlier in the chain than Mercurius, but preventing double query parsing would be difficult, as the hooks need to be query-aware.
I'll admit I don't have a complete understanding of this codebase so forgive me if there are any things I've missed here, it's mainly to frame the requirement I have and start a discussion.
If there is any modifications you'd like here, let me know and I'd be happy to contribute; I can update any documentation as necessary, but wanted to wait until this feature was discussed.