Skip to content

Commit b4ba778

Browse files
maon-fpFabian Breitkreutzardatan
authored
feat(createGatewayRuntime): expose renderGraphiQL option to pass on t… (#1148)
Co-authored-by: Fabian Breitkreutz <fb@maon.eu> Co-authored-by: Arda TANRIKULU <ardatanrikulu@gmail.com>
1 parent c0e1732 commit b4ba778

File tree

3 files changed

+15
-0
lines changed

3 files changed

+15
-0
lines changed

.changeset/angry-walls-provide.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@graphql-hive/gateway-runtime': minor
3+
---
4+
5+
Introducing `renderGraphiQL` feature to provide GraphiQL without a CDN involved

packages/runtime/src/createGatewayRuntime.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1191,6 +1191,7 @@ export function createGatewayRuntime<
11911191
},
11921192
cors: config.cors,
11931193
graphiql: graphiqlOptionsOrFactory,
1194+
renderGraphiQL: config.renderGraphiQL,
11941195
batching: config.batching,
11951196
graphqlEndpoint: config.graphqlEndpoint,
11961197
maskedErrors: config.maskedErrors,

packages/runtime/src/types.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -447,6 +447,15 @@ interface GatewayConfigBase<TContext extends Record<string, any>> {
447447
* Show, hide or configure GraphiQL.
448448
*/
449449
graphiql?: YogaServerOptions<unknown, GatewayContext & TContext>['graphiql'];
450+
/**
451+
* Accepts a factory function that returns GraphiQL HTML, this replaces the existing GraphiQL
452+
* So this option can be also used to provide an offline GraphiQL
453+
* @see https://the-guild.dev/graphql/yoga-server/docs/features/graphiql#offline-usage
454+
*/
455+
renderGraphiQL?: YogaServerOptions<
456+
unknown,
457+
GatewayContext & TContext
458+
>['renderGraphiQL'];
450459
/**
451460
* Whether the landing page should be shown.
452461
*/

0 commit comments

Comments
 (0)