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: graphiql enable schema description, default headers #2172

Merged
5 changes: 5 additions & 0 deletions .changeset/nice-shirts-beam.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@graphql-yoga/graphiql': patch
---

- fix: enable graphiql schema description, default headers prop
3 changes: 2 additions & 1 deletion packages/graphiql/src/YogaGraphiQL.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,6 @@ export function YogaGraphiQL(props: YogaGraphiQLProps): React.ReactElement {
credentials: 'same-origin',
specifiedByUrl: true,
directiveIsRepeatable: true,
schemaDescription: true,
...props,
headers: props.additionalHeaders || {},
})
Expand Down Expand Up @@ -152,6 +151,8 @@ export function YogaGraphiQL(props: YogaGraphiQLProps): React.ReactElement {
<GraphiQLProvider
plugins={[explorerPlugin]}
query={query}
headers={props.headers}
schemaDescription={true}
fetcher={fetcher}
>
<GraphiQLInterface
Expand Down
4 changes: 3 additions & 1 deletion packages/graphql-yoga/src/plugins/useGraphiQL.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ export type GraphiQLOptions = {
defaultVariableEditorOpen?: boolean
/**
* The initial headers to render inside the header editor. Defaults to `"{}"`.
* The value should be a JSON encoded string, for example:
* `headers: JSON.stringify({Authorization: "Bearer your-auth-key"})`
*/
headers?: string
/**
Expand All @@ -31,7 +33,7 @@ export type GraphiQLOptions = {
*/
headerEditorEnabled?: boolean
/**
* The title to display at the top of the page. Defaults to `"YogaGraphiQL"`.
* The title to display at the top of the page. Defaults to `"Yoga GraphiQL"`.
*/
title?: string
/**
Expand Down