Skip to content

enhance(js-sdk): support graphql-client-name and graphql-client-version as extra default in addition to x- ones#7414

Merged
ardatan merged 4 commits intomainfrom
graphql-client-headers
Dec 19, 2025
Merged

enhance(js-sdk): support graphql-client-name and graphql-client-version as extra default in addition to x- ones#7414
ardatan merged 4 commits intomainfrom
graphql-client-headers

Conversation

@ardatan
Copy link
Copy Markdown
Member

@ardatan ardatan commented Dec 12, 2025

Today by default, x-graphql-client- ones are used by default but Apollo Router plugin and some other popular products are using the ones without x- by default. So in order to have an easier migration from other tools, this PR makes JS SDK to respect unprefixed version of those headers, too.

@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @ardatan, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces an enhancement to the JavaScript SDK by extending its default client information detection to include graphql-client-name and graphql-client-version HTTP headers. Previously, only the x- prefixed versions were recognized. This update aims to provide a smoother migration path and better interoperability for users coming from environments where unprefixed headers are standard, such as with Apollo Router, by allowing the SDK to automatically identify client details from either header format.

Highlights

  • Header Support Expansion: The JavaScript SDK now supports graphql-client-name and graphql-client-version headers in addition to the existing x-graphql-client-name and x-graphql-client-version headers for client identification.
  • Improved Compatibility: This change enhances compatibility with other GraphQL tools like Apollo Router, which commonly use the unprefixed header names, providing an easier migration path.
  • Core Logic Update: The createDefaultClientInfo function in usage.ts has been refactored to check for both prefixed and unprefixed headers, utilizing a new lookupHeader utility function for this purpose.
  • Documentation & Schema Updates: All relevant documentation files (.mdx) and the GraphQL schema (module.graphql.ts) have been updated to reflect the newly supported header names.
  • New Test Case: A new test has been added to the GraphQL Yoga integration to verify the correct handling of the unprefixed client headers.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@ardatan ardatan requested review from enisdenjo and n1ru4l December 12, 2025 11:45
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Dec 12, 2025

🚀 Snapshot Release (alpha)

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

Package Version Info
@graphql-hive/apollo 0.45.1-alpha-20251212115012-f9e6f24cd70db99ed5d5419def6023f461fd1fd6 npm ↗︎ unpkg ↗︎
@graphql-hive/cli 0.56.1-alpha-20251212115012-f9e6f24cd70db99ed5d5419def6023f461fd1fd6 npm ↗︎ unpkg ↗︎
@graphql-hive/core 0.18.1-alpha-20251212115012-f9e6f24cd70db99ed5d5419def6023f461fd1fd6 npm ↗︎ unpkg ↗︎
@graphql-hive/envelop 0.40.1-alpha-20251212115012-f9e6f24cd70db99ed5d5419def6023f461fd1fd6 npm ↗︎ unpkg ↗︎
@graphql-hive/yoga 0.46.1-alpha-20251212115012-f9e6f24cd70db99ed5d5419def6023f461fd1fd6 npm ↗︎ unpkg ↗︎

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Dec 12, 2025

📚 Storybook Deployment

The latest changes are available as preview in: https://pr-7414.hive-storybook.pages.dev

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request enhances the JS SDK by adding support for graphql-client-name and graphql-client-version headers, which is a great improvement for interoperability with other tools. The implementation is well-structured, and the inclusion of tests and documentation updates is appreciated. However, I've identified a high-severity regression regarding the precedence of custom header names and a bug in a conditional check. I've also found a minor typo in the documentation. My review includes specific suggestions to address these points.

Comment thread packages/libraries/core/src/client/usage.ts Outdated
Comment thread packages/libraries/core/src/client/usage.ts Outdated
key within the `connectionParams`.
By default, the client information is retrieved by looking up the client information headers in the
HTTP request. Those are `x-graphql-client-name` or `graphql-client-name` for the client name and
`x-graphql-client-version` or `graphql-client-version` for the client version.For operations
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

There's a missing space after the period, which makes the sentence hard to read.

`x-graphql-client-version` or `graphql-client-version` for the client version. For operations

ardatan and others added 2 commits December 12, 2025 14:48
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
@github-actions
Copy link
Copy Markdown
Contributor

💻 Website Preview

The latest changes are available as preview in: https://pr-7414.hive-landing-page.pages.dev

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Dec 12, 2025

🐋 This PR was built and pushed to the following Docker images:

Targets: build

Platforms: linux/amd64

Image Tag: f9e6f24cd70db99ed5d5419def6023f461fd1fd6

@ardatan ardatan enabled auto-merge (squash) December 12, 2025 14:19
Copy link
Copy Markdown
Contributor

@n1ru4l n1ru4l left a comment

Choose a reason for hiding this comment

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

Looks good!

@ardatan ardatan merged commit 4f9f988 into main Dec 19, 2025
51 of 54 checks passed
@ardatan ardatan deleted the graphql-client-headers branch December 19, 2025 10:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants