Skip to content

Commit

Permalink
Support document, variables and headers in AS Landing Page config (#5711
Browse files Browse the repository at this point in the history
)
  • Loading branch information
mayakoneval authored Oct 28, 2021
1 parent 8d2e487 commit 1ef5171
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ The version headers in this history reflect the versions of Apollo Server itself

`apollo-server-core`: Fix build error when building with `@rollup/plugin-commonjs`. [PR #5797](https://github.com/apollographql/apollo-server/pull/5797)
- `apollo-server-plugin-response-cache`: Add missing dependency on `apollo-server-types` (broken since v3.0.0). [Issue #5804](https://github.com/apollographql/apollo-server/issues/5804) [PR #5816](https://github.com/apollographql/apollo-server/pull/5816)
- `apollo-server-core`: The default landing page plugins now take `document`, `variables`, and `headers` arguments which fill in default values if you click through to Explorer. [PR #5711](https://github.com/apollographql/apollo-server/pull/5711)

## v3.4.0

Expand Down
45 changes: 45 additions & 0 deletions docs/source/api/plugin/landing-pages.md
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,51 @@ To enable this link, you need to provide `graphRef` here even if you already pro
</td>
</tr>

<tr>
<td>

###### `document`

`string`
</td>
<td>

A GraphQL document (eg, query or mutation) to populate in the Studio Explorer's editor on load.

If you omit this, the Explorer initially loads an example query based on your schema.

</td>
</tr>

<tr>
<td>

###### `variables`

`Record<string, string>`
</td>
<td>

An object containing initial variable values to populate in the Explorer on load.

If provided, these variables should apply to the initial query you provide in `document`.

</td>
</tr>

<tr>
<td>

###### `headers`

`Record<string, string>`
</td>
<td>

An object containing initial HTTP header values to populate in the Explorer on load.

</td>
</tr>

</tbody>
</table>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,13 @@ export interface ApolloServerPluginLandingPageDefaultBaseOptions {
* landing page.
*/
footer?: boolean;
/**
* Folks can configure their landing page to link to Studio Explorer with a
* document, variables and headers loaded in the UI.
*/
document?: string;
variables?: Record<string, string>;
headers?: Record<string, string>;
// For Apollo use only.
__internal_apolloStudioEnv__?: 'staging' | 'prod';
}
Expand All @@ -37,6 +44,9 @@ interface LandingPageConfig {
graphRef?: string | undefined;
isProd?: boolean;
apolloStudioEnv?: 'staging' | 'prod';
document?: string;
variables?: Record<string, string>;
headers?: Record<string, string>;
footer?: boolean;
}

Expand Down

0 comments on commit 1ef5171

Please sign in to comment.