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

consolidate Request and ExecutionParams types #3180

Merged
merged 3 commits into from Jul 12, 2021
Merged

Conversation

yaacovCR
Copy link
Collaborator

  • also affixes rootValue to Request
  • when delegating with delegateToSchema, rootValue can be set multiple ways:
    • when using a custom executor, the custom executor can utilize a
      rootValue in whichever custom way it specifies.
    • when using the default executor (execute/subscribe from graphql-js):
      -- rootValue can be passed to delegateToSchema via a named option
      -- rootValue can be included within a subschemaConfig
      -- otherwise, rootValue is inferred from the originating schema
  • when using wrapSchema/stitchSchemas, a subschemaConfig can specify the
    createProxyingResolver function which can pass whatever rootValue it
    wants to delegateToSchema as above.

@changeset-bot
Copy link

changeset-bot bot commented Jul 12, 2021

🦋 Changeset detected

Latest commit: 3931762

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 25 packages
Name Type
@graphql-tools/batch-delegate Major
@graphql-tools/batch-execute Major
@graphql-tools/delegate Major
@graphql-tools/links Major
@graphql-tools/url-loader Major
@graphql-tools/stitch Major
@graphql-tools/utils Major
@graphql-tools/wrap Major
@graphql-tools/stitching-directives Patch
@graphql-tools/prisma-loader Patch
@graphql-tools/graphql-tag-pluck Patch
@graphql-tools/load Patch
@graphql-tools/merge Patch
@graphql-tools/mock Patch
@graphql-tools/node-require Patch
@graphql-tools/relay-operation-optimizer Patch
@graphql-tools/resolvers-composition Patch
@graphql-tools/schema Patch
@graphql-tools/apollo-engine-loader Patch
@graphql-tools/code-file-loader Patch
@graphql-tools/git-loader Patch
@graphql-tools/github-loader Patch
@graphql-tools/graphql-file-loader Patch
@graphql-tools/json-file-loader Patch
@graphql-tools/module-loader Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@theguild-bot
Copy link
Collaborator

theguild-bot commented Jul 12, 2021

The latest changes of this PR are available as alpha in npm (based on the declared changesets):

@graphql-tools/batch-delegate@8.0.0-alpha-d79e1771.0
@graphql-tools/batch-execute@8.0.0-alpha-d79e1771.0
@graphql-tools/delegate@8.0.0-alpha-d79e1771.0
@graphql-tools/graphql-tag-pluck@6.5.2-alpha-d79e1771.0
graphql-tools@7.0.6-alpha-d79e1771.0
@graphql-tools/links@8.0.0-alpha-d79e1771.0
@graphql-tools/load@6.2.9-alpha-d79e1771.0
@graphql-tools/apollo-engine-loader@6.2.6-alpha-d79e1771.0
@graphql-tools/code-file-loader@6.3.2-alpha-d79e1771.0
@graphql-tools/git-loader@6.2.7-alpha-d79e1771.0
@graphql-tools/github-loader@6.2.6-alpha-d79e1771.0
@graphql-tools/graphql-file-loader@6.2.8-alpha-d79e1771.0
@graphql-tools/json-file-loader@6.2.7-alpha-d79e1771.0
@graphql-tools/module-loader@6.2.8-alpha-d79e1771.0
@graphql-tools/prisma-loader@6.3.1-alpha-d79e1771.0
@graphql-tools/url-loader@7.0.0-alpha-d79e1771.0
@graphql-tools/merge@6.2.15-alpha-d79e1771.0
@graphql-tools/mock@8.1.4-alpha-d79e1771.0
@graphql-tools/node-require@6.2.5-alpha-d79e1771.0
@graphql-tools/relay-operation-optimizer@6.3.1-alpha-d79e1771.0
@graphql-tools/resolvers-composition@6.2.9-alpha-d79e1771.0
@graphql-tools/schema@7.1.6-alpha-d79e1771.0
@graphql-tools/stitch@8.0.0-alpha-d79e1771.0
@graphql-tools/stitching-directives@1.3.4-alpha-d79e1771.0
@graphql-tools/utils@8.0.0-alpha-d79e1771.0
@graphql-tools/wrap@8.0.0-alpha-d79e1771.0

- also affixes rootValue to Request
- when delegating with delegateToSchema, rootValue can be set multiple ways:
 * when using a custom executor, the custom executor can utilize a
   rootValue in whichever custom way it specifies.
 * when using the default executor (execute/subscribe from graphql-js):
   -- rootValue can be passed to delegateToSchema via a named option
   -- rootValue can be included within a subschemaConfig
   -- otherwise, rootValue is inferred from the originating schema
- when using wrapSchema/stitchSchemas, a subschemaConfig can specify the
  createProxyingResolver function which can pass whatever rootValue it
  wants to delegateToSchema as above.
@yaacovCR
Copy link
Collaborator Author

@yaacovCR
Copy link
Collaborator Author

I think our Request type can have context/info in it, optional properties that make sense only when the request originates from within execution of a parent GraphQL Request.

It probably makes sense to eventually put these within the extensions map, but I think this is fine for now.

Thoughts?

@yaacovCR yaacovCR requested a review from ardatan July 12, 2021 15:08
@ardatan ardatan merged commit dae6dc7 into master Jul 12, 2021
@ardatan ardatan deleted the root-value-conundrum branch July 12, 2021 15:36
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

3 participants