Skip to content
This repository was archived by the owner on Dec 19, 2023. It is now read-only.

Commit da45823

Browse files
doc(#212): improved readme for GraphQL Playground settings
1 parent 5eb1bfd commit da45823

File tree

1 file changed

+66
-9
lines changed

1 file changed

+66
-9
lines changed

README.md

Lines changed: 66 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,23 @@
77
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
88
**Table of Contents**
99

10-
- [GraphQL and Graph*i*QL Spring Framework Boot Starters](#graphql-and-graphiql-spring-framework-boot-starters)
1110
- [WARNING: NoClassDefFoundError when using GraphQL Java Tools > 5.4.x](#warning-noclassdeffounderror-when-using-graphql-java-tools--54x)
1211
- [Using Gradle](#using-gradle)
1312
- [Using Maven](#using-maven)
1413
- [Documentation](#documentation)
1514
- [Requirements and Downloads](#requirements-and-downloads)
1615
- [Enable GraphQL Servlet](#enable-graphql-servlet)
1716
- [Enable Graph*i*QL](#enable-graphiql)
17+
- [Enable Altair](#enable-altair)
18+
- [Enable GraphQL Playground](#enable-graphql-playground)
19+
- [Basic settings](#basic-settings)
20+
- [CDN](#cdn)
21+
- [Customizing GraphQL Playground](#customizing-graphql-playground)
22+
- [Tabs](#tabs)
1823
- [Supported GraphQL-Java Libraries](#supported-graphql-java-libraries)
1924
- [GraphQL Java Tools](#graphql-java-tools)
2025
- [Tracing and Metrics](#tracing-and-metrics)
26+
- [Usage](#usage)
2127
- [Contributions](#contributions)
2228
- [Licenses](#licenses)
2329

@@ -55,6 +61,7 @@ Repository contains:
5561
* `graphql-spring-boot-starter` to turn your boot application into GraphQL server (see [graphql-java-servlet](https://github.com/graphql-java-kickstart/graphql-java-servlet))
5662
* `altair-spring-boot-starter`to embed `Altair` tool for schema introspection and query debugging (see [altair](https://github.com/imolorhe/altair))
5763
* `graphiql-spring-boot-starter`to embed `GraphiQL` tool for schema introspection and query debugging (see [graphiql](https://github.com/graphql/graphiql))
64+
* `playground-spring-boot-starter`to embed `GraphQL Playground` tool for schema introspection and query debugging (see [GraphQL Playground](https://github.com/prisma/graphql-playground))
5865
* `voyager-spring-boot-starter`to embed `Voyager` tool for visually explore GraphQL APIs as an interactive graph (see [voyger](https://github.com/APIs-guru/graphql-voyager))
5966

6067
# Requirements and Downloads
@@ -253,29 +260,79 @@ Headers that are used when sending the Altair queries can be set by defining the
253260

254261
# Enable GraphQL Playground
255262

256-
GraphQL Playground becomes accessible at root `/playground` (or as configured in `playground.mapping`)
263+
GraphQL Playground becomes accessible at root `/playground` (or as configured in `graphql.playground.mapping`)
257264
if `playground-spring-boot-starter` is added as a dependency to a boot application.
258265

259-
It uses an embedded `GraphQL Playground React`, according to the [official guide](https://github.com/prisma/graphql-playground#as-html-page),
266+
It uses an embedded `GraphQL Playground React`, in accordance to the [official guide](https://github.com/prisma/graphql-playground#as-html-page),
260267
using the 'minimum HTML' approach.
261268

262269
Available Spring Boot configuration parameters (either `application.yml` or `application.properties`):
263270

264271
```yaml
265-
playground:
272+
graphql.playground:
266273
mapping: /playground
267-
endpoint:
268-
graphql: /graphql
269-
subscriptions: /subscriptions
274+
endpoint: /graphql
275+
subscriptionsEndpoint: /subscriptions
270276
enabled: true
271277
pageTitle: Playground
272278
cdn:
273279
enabled: false
274280
version: latest
281+
settings:
282+
editor.cursorShape: line
283+
editor.fontFamily: "'Source Code Pro', 'Consolas', 'Inconsolata', 'Droid Sans Mono', 'Monaco', monospace"
284+
editor.fontSize: 14
285+
editor.reuseHeaders: true
286+
editor.theme: dark
287+
general.betaUpdates: false
288+
prettier.printWidth: 80
289+
prettier.tabWidth: 2
290+
prettier.useTabs: false
291+
request.credentials: omit
292+
schema.polling.enable: true
293+
schema.polling.endpointFilter: "*localhost*"
294+
schema.polling.interval: 2000
295+
schema.disableComments: true
296+
tracing.hideTracingResponse: true
297+
tabs:
298+
- name: Example Tab
299+
query: classpath:exampleQuery.graphql
300+
headers:
301+
SomeHeader: Some value
302+
variables: classpath:variables.json
303+
responses:
304+
- classpath:exampleResponse1.json
305+
- classpath:exampleResponse2.json
275306
```
307+
## Basic settings
308+
309+
`mapping`, `endpoint` and `subscriptionsEndpoint` will default to `/playground`, `/graphql` and `/subscriptions`,
310+
respectively. Note that these values may not be empty.
311+
312+
`enabled` defaults to `true`, and therefor Playground will be available by default if the dependency is added to a
313+
Spring Boot Web Application project.
314+
315+
`pageTitle` defaults to `Playground`.
316+
317+
## CDN
318+
276319
The currently bundled version is `1.7.20`, which is - as of writing this - the latest release of `GraphQL Playground React`.
277-
The CDN option uses `jsDelivr` CDN. By default, it will load the latest available release.
278-
Available CDN versions can be found here: https://www.jsdelivr.com/package/npm/graphql-playground-react
320+
The CDN option uses `jsDelivr` CDN, if enabled. By default, it will load the latest available release.
321+
Available CDN versions can be found on the project's
322+
[jsDelivr page](https://www.jsdelivr.com/package/npm/graphql-playground-react). The CDN option is disabled by default.
323+
324+
## Customizing GraphQL Playground
325+
326+
Further GraphQL Playground settings can be specified under the `settings` group, which are documented in the official
327+
[GraphQL Playground readme](https://github.com/prisma/graphql-playground#settings). Note that enum-like values are
328+
validated against the available options, and your application will not start if wrong settings are provided. Similarly
329+
there is some basic validation for integer values (they must be valid positive integers).
330+
331+
## Tabs
332+
333+
Optionally, you can specify tabs that will be present when the user first opens GraphQL Playground. You can configure the
334+
query, variables, headers and even supply sample responses. Note that `query`, `variables` and `responses` are expected
335+
to be resources of the appropriate format (GraphQL for `query`, JSON for `variables` and `responses`).
279336

280337
# Supported GraphQL-Java Libraries
281338

0 commit comments

Comments
 (0)