|
7 | 7 | <!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE --> |
8 | 8 | **Table of Contents** |
9 | 9 |
|
10 | | -- [GraphQL and Graph*i*QL Spring Framework Boot Starters](#graphql-and-graphiql-spring-framework-boot-starters) |
11 | 10 | - [WARNING: NoClassDefFoundError when using GraphQL Java Tools > 5.4.x](#warning-noclassdeffounderror-when-using-graphql-java-tools--54x) |
12 | 11 | - [Using Gradle](#using-gradle) |
13 | 12 | - [Using Maven](#using-maven) |
14 | 13 | - [Documentation](#documentation) |
15 | 14 | - [Requirements and Downloads](#requirements-and-downloads) |
16 | 15 | - [Enable GraphQL Servlet](#enable-graphql-servlet) |
17 | 16 | - [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) |
18 | 23 | - [Supported GraphQL-Java Libraries](#supported-graphql-java-libraries) |
19 | 24 | - [GraphQL Java Tools](#graphql-java-tools) |
20 | 25 | - [Tracing and Metrics](#tracing-and-metrics) |
| 26 | + - [Usage](#usage) |
21 | 27 | - [Contributions](#contributions) |
22 | 28 | - [Licenses](#licenses) |
23 | 29 |
|
@@ -55,6 +61,7 @@ Repository contains: |
55 | 61 | * `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)) |
56 | 62 | * `altair-spring-boot-starter`to embed `Altair` tool for schema introspection and query debugging (see [altair](https://github.com/imolorhe/altair)) |
57 | 63 | * `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)) |
58 | 65 | * `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)) |
59 | 66 |
|
60 | 67 | # Requirements and Downloads |
@@ -253,29 +260,79 @@ Headers that are used when sending the Altair queries can be set by defining the |
253 | 260 |
|
254 | 261 | # Enable GraphQL Playground |
255 | 262 |
|
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`) |
257 | 264 | if `playground-spring-boot-starter` is added as a dependency to a boot application. |
258 | 265 |
|
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), |
260 | 267 | using the 'minimum HTML' approach. |
261 | 268 |
|
262 | 269 | Available Spring Boot configuration parameters (either `application.yml` or `application.properties`): |
263 | 270 |
|
264 | 271 | ```yaml |
265 | | -playground: |
| 272 | +graphql.playground: |
266 | 273 | mapping: /playground |
267 | | - endpoint: |
268 | | - graphql: /graphql |
269 | | - subscriptions: /subscriptions |
| 274 | + endpoint: /graphql |
| 275 | + subscriptionsEndpoint: /subscriptions |
270 | 276 | enabled: true |
271 | 277 | pageTitle: Playground |
272 | 278 | cdn: |
273 | 279 | enabled: false |
274 | 280 | 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 |
275 | 306 | ``` |
| 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 | + |
276 | 319 | 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`). |
279 | 336 |
|
280 | 337 | # Supported GraphQL-Java Libraries |
281 | 338 |
|
|
0 commit comments