Skip to content

Conversation

EmrysMyrddin
Copy link
Collaborator

@EmrysMyrddin EmrysMyrddin commented Jul 10, 2025

Description

This PR aims to ease the development of GraphQL Gateways (like Hive Gateway) by adding an optional subgraphName property to the ExecutionRequest type. This property can be populated with the targeted subgraph name by the Gateway to make it easier to identify them.

Related to graphql-hive/gateway#1311

Type of change

  • New feature (non-breaking change which adds functionality)

Checklist:

  • I have followed the
    CONTRIBUTING doc and the
    style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests and linter rules pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

Further comments

This will allow to remove an annoying point in Hive Gateway Plugin development: The subgraph name can't be access directly from onFetch hook. It has to be retrieve from a global weak map with the execution request as a key. With this change, the subgraph name will be directly accessible and easy to find for new developers.

Copy link

changeset-bot bot commented Jul 10, 2025

🦋 Changeset detected

Latest commit: fde1c74

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

This PR includes changesets to release 26 packages
Name Type
@graphql-tools/utils Minor
@graphql-tools/executor Patch
@graphql-tools/graphql-tag-pluck Patch
@graphql-tools/import Patch
@graphql-tools/links 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
@graphql-tools/url-loader Patch
@graphql-tools/executor-apollo-link Patch
@graphql-tools/executor-envelop Patch
@graphql-tools/executor-legacy-ws Patch
@graphql-tools/executor-urql-exchange Patch
@graphql-tools/executor-yoga Patch
graphql-tools 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

Copy link
Contributor

coderabbitai bot commented Jul 10, 2025

📝 Walkthrough

Summary by CodeRabbit

  • New Features
    • Added support for specifying an optional subgraph name in execution requests, enhancing compatibility with GraphQL Gateway scenarios.

Walkthrough

An optional property named subgraphName was added to the ExecutionRequest interface in the @graphql-tools/utils package. This property is intended to specify the target subgraph in supergraph execution contexts, such as those used by GraphQL Gateways. No additional logic or error handling was introduced.

Changes

File(s) Change Summary
packages/utils/src/Interfaces.ts Added optional subgraphName?: string property to the ExecutionRequest interface.
.changeset/three-impalas-love.md Documented the addition of the subgraphName property to the ExecutionRequest interface.

Poem

A subgraph name now hops along,
ExecutionRequest grows strong.
Gateways cheer with fluffy glee,
As supergraphs roam wild and free.
With every query, rabbits prance—
New properties mean more chance!
🐇✨

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

packages/utils/src/Interfaces.ts

Oops! Something went wrong! :(

ESLint: 9.30.1

ESLint couldn't find an eslint.config.(js|mjs|cjs) file.

From ESLint v9.0.0, the default configuration file is now eslint.config.js.
If you are using a .eslintrc.* file, please follow the migration guide
to update your configuration file to the new format:

https://eslint.org/docs/latest/use/configure/migration-guide

If you still have problems after following the migration guide, please stop by
https://eslint.org/chat/help to chat with the team.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/utils/subgraph-name-in-exeuction-request

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai auto-generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (2)
packages/utils/src/Interfaces.ts (1)

92-93: Consider adding a short JSDoc for subgraphName.

Everything looks correct, but every other optional field in ExecutionRequest is accompanied by a clarifying comment or JSDoc. A one-liner such as “/** Target subgraph, when executing within a Gateway */” keeps the public API self-documenting and consistent with existing style.

.changeset/three-impalas-love.md (1)

5-6: Typo: “preoperty” → “property”.

-Add optional `subgraphName` preoperty to the `ExecutionRequest` interface for usage in Gateways like
+Add optional `subgraphName` property to the `ExecutionRequest` interface for usage in Gateways like
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 391a688 and fde1c74.

📒 Files selected for processing (2)
  • .changeset/three-impalas-love.md (1 hunks)
  • packages/utils/src/Interfaces.ts (1 hunks)
🧰 Additional context used
🪛 LanguageTool
.changeset/three-impalas-love.md

[grammar] ~5-~5: Ensure spelling is correct
Context: ... minor --- Add optional subgraphName preoperty to the ExecutionRequest interface for...

(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (9)
  • GitHub Check: alpha / snapshot
  • GitHub Check: deployment
  • GitHub Check: Unit Test on Bun
  • GitHub Check: Unit Test on Node 18 (windows-latest) and GraphQL v16
  • GitHub Check: Unit Test on Node 24 (ubuntu-latest) and GraphQL v16
  • GitHub Check: Full Check on GraphQL v16
  • GitHub Check: Unit Test on Node 18 (ubuntu-latest) and GraphQL v15
  • GitHub Check: Unit Test on Node 22 (ubuntu-latest) and GraphQL v16
  • GitHub Check: Unit Test on Node 18 (ubuntu-latest) and GraphQL v16

Copy link
Contributor

💻 Website Preview

The latest changes are available as preview in: https://pr-7281.graphql-tools.pages.dev

@EmrysMyrddin EmrysMyrddin merged commit 53db005 into master Jul 16, 2025
15 checks passed
@EmrysMyrddin EmrysMyrddin deleted the feat/utils/subgraph-name-in-exeuction-request branch July 16, 2025 20:14
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.

3 participants