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

fix(batch-execute): prefix non-provided variables correctly #243

Merged
merged 3 commits into from
Dec 2, 2024

Conversation

ardatan
Copy link
Member

@ardatan ardatan commented Dec 2, 2024

Fixes #225 that batched query generation when optional variables are not prefixed and sent correctly.

See the use case below;

When two batched queries are sent like below;

query TestOne($someOptionalVar: String) {
  foo(someOptionalArg: $someOptionalVar) {
    id
    name
  }
}
query TestTwo($someOptionalVar: String) {
  foo(someOptionalArg: $someOptionalVar) {
    id
    name
  }
}

And then someOptionalVar is not prefixed if the value is not sent by the user. The batched queries will be sent as below, then it will cause issues.

query TestOneTwo($someOptionalVar: String, $someOptionalVar: String) {
  _0_foo: foo(someOptionalArg: $someOptionalVar) {
    id
    name
  }
  _1_foo: foo(someOptionalArg: $someOptionalVar) {
    id
    name
  }
}

@ardatan ardatan force-pushed the prefix-variables-optional branch from cb1d423 to 5fb7ce0 Compare December 2, 2024 13:33
@theguild-bot
Copy link
Collaborator

theguild-bot commented Dec 2, 2024

🚀 Snapshot Release (alpha)

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

Package Version Info
@graphql-tools/batch-delegate 9.0.20-alpha-4c1de074259b33c9e8f35d8ce1850e9ebf153255 npm ↗︎ unpkg ↗︎
@graphql-tools/batch-execute 9.0.8-alpha-4c1de074259b33c9e8f35d8ce1850e9ebf153255 npm ↗︎ unpkg ↗︎
@graphql-tools/delegate 10.2.4-alpha-4c1de074259b33c9e8f35d8ce1850e9ebf153255 npm ↗︎ unpkg ↗︎
@graphql-tools/federation 2.2.35-alpha-4c1de074259b33c9e8f35d8ce1850e9ebf153255 npm ↗︎ unpkg ↗︎
@graphql-mesh/fusion-runtime 0.10.10-alpha-4c1de074259b33c9e8f35d8ce1850e9ebf153255 npm ↗︎ unpkg ↗︎
@graphql-hive/gateway 1.5.7-alpha-4c1de074259b33c9e8f35d8ce1850e9ebf153255 npm ↗︎ unpkg ↗︎
@graphql-mesh/hmac-upstream-signature 1.2.12-alpha-4c1de074259b33c9e8f35d8ce1850e9ebf153255 npm ↗︎ unpkg ↗︎
@graphql-mesh/plugin-opentelemetry 1.3.16-alpha-4c1de074259b33c9e8f35d8ce1850e9ebf153255 npm ↗︎ unpkg ↗︎
@graphql-mesh/plugin-prometheus 1.3.4-alpha-4c1de074259b33c9e8f35d8ce1850e9ebf153255 npm ↗︎ unpkg ↗︎
@graphql-hive/gateway-runtime 1.3.4-alpha-4c1de074259b33c9e8f35d8ce1850e9ebf153255 npm ↗︎ unpkg ↗︎
@graphql-tools/stitch 9.4.5-alpha-4c1de074259b33c9e8f35d8ce1850e9ebf153255 npm ↗︎ unpkg ↗︎
@graphql-tools/stitching-directives 3.1.19-alpha-4c1de074259b33c9e8f35d8ce1850e9ebf153255 npm ↗︎ unpkg ↗︎
@graphql-mesh/transport-common 0.7.19-alpha-4c1de074259b33c9e8f35d8ce1850e9ebf153255 npm ↗︎ unpkg ↗︎
@graphql-mesh/transport-http 0.6.21-alpha-4c1de074259b33c9e8f35d8ce1850e9ebf153255 npm ↗︎ unpkg ↗︎
@graphql-mesh/transport-http-callback 0.5.10-alpha-4c1de074259b33c9e8f35d8ce1850e9ebf153255 npm ↗︎ unpkg ↗︎
@graphql-mesh/transport-ws 0.4.8-alpha-4c1de074259b33c9e8f35d8ce1850e9ebf153255 npm ↗︎ unpkg ↗︎
@graphql-tools/wrap 10.0.22-alpha-4c1de074259b33c9e8f35d8ce1850e9ebf153255 npm ↗︎ unpkg ↗︎

@theguild-bot
Copy link
Collaborator

theguild-bot commented Dec 2, 2024

🚀 Snapshot Release (Binary for Linux-X64)

The latest changes of this PR are available for download (based on the declared changesets).

Download

@theguild-bot
Copy link
Collaborator

theguild-bot commented Dec 2, 2024

🚀 Snapshot Release (Binary for macOS-ARM64)

The latest changes of this PR are available for download (based on the declared changesets).

Download

@theguild-bot
Copy link
Collaborator

theguild-bot commented Dec 2, 2024

🚀 Snapshot Release (Bun Docker Image)

The latest changes of this PR are available as image on GitHub Container Registry (based on the declared changesets):

ghcr.io/graphql-hive/gateway:1.5.7-alpha-4c1de074259b33c9e8f35d8ce1850e9ebf153255-bun

@theguild-bot
Copy link
Collaborator

theguild-bot commented Dec 2, 2024

🚀 Snapshot Release (Node Docker Image)

The latest changes of this PR are available as image on GitHub Container Registry (based on the declared changesets):

ghcr.io/graphql-hive/gateway:1.5.7-alpha-4c1de074259b33c9e8f35d8ce1850e9ebf153255

@theguild-bot
Copy link
Collaborator

theguild-bot commented Dec 2, 2024

🚀 Snapshot Release (Binary for macOS-X64)

The latest changes of this PR are available for download (based on the declared changesets).

Download

@theguild-bot
Copy link
Collaborator

theguild-bot commented Dec 2, 2024

🚀 Snapshot Release (Binary for Windows-X64)

The latest changes of this PR are available for download (based on the declared changesets).

Download

@ardatan ardatan force-pushed the prefix-variables-optional branch from 5fb7ce0 to 35bd336 Compare December 2, 2024 13:56
@ardatan ardatan force-pushed the prefix-variables-optional branch from 35bd336 to 4c1de07 Compare December 2, 2024 13:56
@ardatan ardatan merged commit e53d4af into main Dec 2, 2024
26 of 27 checks passed
@ardatan ardatan deleted the prefix-variables-optional branch December 2, 2024 14:00
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.

duplicate GraphQL Variables for compound queries
2 participants