Skip to content

sadv1r/spring-graphql-editors

Repository files navigation

Spring GraphQL Editors

build

These starters intend to be used with spring-boot-starter-graphql, but it will work without it, you just need to provide GraphQL path as spring.graphql.path parameter.

GraphQL Voyager

Maven Central GitHub Repo stars

GraphQL Voyager becomes accessible at root /voyager (or as configured in spring.graphql.voyager.path).

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

graphql:
  voyager:
    enabled: true
    path: /voyager
    displayOptions:
      skipRelay: true
      skipDeprecated: true
      rootType: Query
      sortByAlphabet: false
      showLeafFields: true
      hideRoot: false
    hideDocs: false
    hideSettings: false
    cdn: unpkg
    stylePath: /style.css

Dependency

Maven

<dependency>
    <groupId>ru.sadv1r.spring.graphql</groupId>
    <artifactId>graphql-voyager-spring-boot-starter</artifactId>
    <version>0.4.0</version>
</dependency>

Gradle

implementation 'ru.sadv1r.spring.graphql:graphql-voyager-spring-boot-starter:0.4.0'

GraphiQL

Maven Central GitHub Repo stars

GraphiQL becomes accessible at root /graphiql (or as configured in spring.graphql.graphiql.path).

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

graphql:
  graphiql:
    enabled: true
    path: /graphiql
    query: |-
      query($id: ID!) {
        artifactRepository(id: $id) {
           name
           url
        }
      }
    default-editor-tools-visibility: VARIABLES
    variables:
      id: 1
    headers:
      x-test: test
    plugins: EXPLORER
    cdn: unpkg
    stylePath: /style.css

Since setting (large) query in the properties like this isn't very readable, you can provide a file path instead:

graphql:
  graphiql:
    enabled: true
    query: example/query.graphql

Dependency

Maven

<dependency>
    <groupId>ru.sadv1r.spring.graphql</groupId>
    <artifactId>graphql-graphiql-spring-boot-starter</artifactId>
    <version>0.4.0</version>
</dependency>

Gradle

implementation 'ru.sadv1r.spring.graphql:graphql-graphiql-spring-boot-starter:0.4.0'

GraphQL Playground

Maven Central GitHub Repo stars

GraphQL Playground becomes accessible at root /playground (or as configured in spring.graphql.playground.path).

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

graphql:
  playground:
    enabled: true
    path: /playground
    settings:
      editor:
        cursorShape: line
        fontFamily: '"Fira code", "Fira Mono", monospace'
        fontSize: 14
        theme: dark
      general:
        betaUpdates: false
      prettier:
        printWidth: 80
        tabWidth: 2
        useTabs: false
      request:
        credentials: omit
      schema:
        polling:
          enable: true
          endpointFilter: *localhost*
          interval: 2000
        disableComments: false
      tracing:
        hideTracingResponse: false
        tracingSupported: true
    headers:
      x-test: test
    tabs:
      - name: GraphQL
        endpoint: http://localhost:8080/graphql
        query: |-
          query($id: ID!) {
            artifactRepository(id: $id) {
               name
               url
            }
          }
        variables: |-
          {
            "id": 1
          }
        responses:
          - >
            {
              "data": {
                "artifactRepositories": [{
                  "name": "test",
                  "url": "http://localhost:8080"
                }]
              }
            }
        headers:
          x-test2: test2
    cdn: unpkg

Since setting (large) query in the properties like this isn't very readable, you can provide a file path instead:

graphql:
  playground:
    enabled: true
    tabs:
      - endpoint: http://localhost:8080/graphql
        query: example/query.graphql

Dependency

Maven

<dependency>
    <groupId>ru.sadv1r.spring.graphql</groupId>
    <artifactId>graphql-playground-spring-boot-starter</artifactId>
    <version>0.4.0</version>
</dependency>

Gradle

implementation 'ru.sadv1r.spring.graphql:graphql-playground-spring-boot-starter:0.4.0'