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

Extensions #125

Merged
merged 6 commits into from
Sep 6, 2023
Merged

Extensions #125

merged 6 commits into from
Sep 6, 2023

Conversation

kindermax
Copy link
Collaborator

@kindermax kindermax commented Aug 22, 2023

Adds extension support to Hiku.

  • Introduce ExecutionContext to hold all request-related data
  • Introduce ExtensionsExecutor which encapsulates execution of extensions during the request lifetime and is responsible for lifetime hooks
  • Refactor GraphqlEndpoint
    • support ExecutionContext and ExtensionsExecutor
    • merge batching into GraphqlEndpoint (leave BatchGraphqlEndpoint for compatibility)
    • add the ability to disable introspection
    • add the ability to disable validation
    • add graph, dispatch, parsing, operation, validation, and execution lifetime hooks
  • Add QueryDepthValidator extension
  • Refactor query cache into the ParseQueryCache extension
  • Drop StripQuery transformer, add support for __typename field, as striped query add unnecessary complexity into execution + adds additional overhead during execution

Повний приклад використання ендпоінту:

endpoint = GraphqlEndpoint(
  engine,
  graph,
  introspection=False,
  batching=True,
  extensions=[QueryParserCache(100)],
)

endpoint.dispatch({'query': query})
# or
endpoint.dispatch([{'query': query}])

@kindermax
Copy link
Collaborator Author

image

@kindermax kindermax changed the title PoC extensions Extensions Aug 23, 2023
@kindermax kindermax merged commit 8313e4e into master Sep 6, 2023
6 checks passed
@kindermax kindermax deleted the extentions branch September 6, 2023 20:06
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