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

Add GraphQL::Query::Partial #5183

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
Open

Add GraphQL::Query::Partial #5183

wants to merge 13 commits into from

Conversation

rmosolgo
Copy link
Owner

@rmosolgo rmosolgo commented Dec 5, 2024

This is to implement partial execution, where you can take a prepared GraphQL::Query and run part of it in isolation.

Fixes #5136

TODO

  • Finish unit tests
  • Add specific tests for Dataloader and lazy resolution
  • DRY between Query and Query::Partial
  • What about when selections are duplicated in the AST? Have to merge fields appropriately
  • Add tests for continuing from non-null fields, unions, interfaces, scalars, enums

@@ -53,9 +53,6 @@ def initialize(query:, schema: query.schema, values:)
@storage = Hash.new { |h, k| h[k] = {} }
@storage[nil] = @provided_values
@errors = []
@path = []
@value = nil
@context = self # for SharedMethods TODO delete sharedmethods
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These were leftover from a previous GraphQL::Query::Context implementation. I rediscovered them while working on this feature because at first, I thought I was going to need to use query.context.dup. I didn't end up doing that (instead, Query::Context.new inside Partial#initialize) but I'm going to keep these clean-ups.

lib/graphql/query/partial.rb Outdated Show resolved Hide resolved
lib/graphql/query/partial.rb Outdated Show resolved Hide resolved
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.

Support running partial graphql queries
1 participant