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

[server] introduce execution hooks #1670

Open
dariuszkuc opened this issue Feb 13, 2023 · 0 comments
Open

[server] introduce execution hooks #1670

dariuszkuc opened this issue Feb 13, 2023 · 0 comments
Assignees
Labels
type: enhancement New feature or request

Comments

@dariuszkuc
Copy link
Collaborator

dariuszkuc commented Feb 13, 2023

Was just thinking - it seems like the major feature that this PR brings is the ability to do some logic around parsed GraphQL request. Maybe we should generalize it and provide some server execution hooks?

i.e.

  • when generating the schema we can provide schema generation hooks
  • when processing raw HTTP requests we can use Spring WebFilter (or Ktor equivalent) - great for reading headers (e.g. doing some auth stuff) or adding headers to the response but we shouldn't be parsing the request body (which is our GraphQL request) in the filters
  • during GraphQL engine execution we can use instrumentation

What we are missing is the ability to customize server behavior - yes, folks can provide their own server and override the methods but it is pretty cumbersome. Default server logic is as follows

1. parse HTTP request to a GraphQL request
2. generate GraphQL context
3. process GraphQL request

Wondering whether we should update it to (hook names TBD)

1. [new] hook -> willParseRequest
2. parse HTTP request to a GraphQL request
3. [new] hook -> didParseRequest
4. generate GraphQL context
5. [new] hook -> willProcessRequest
6. process GraphQL request
7. [new] hook -> didProcessRequest

Originally posted by @dariuszkuc in #1663 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement New feature or request
Development

No branches or pull requests

2 participants