/spring-graphql-defer

This is an example GraphQL backend service that has support for the `@defer` directive.

Primary LanguageJava

This is an example GraphQL backend service that has support for the @defer directive. Please notice that this service uses experimental graphql-java APIs, and @defer support in graphql-java is still under very active development.

Testing a Query

curl:

curl -v http://localhost:8080/graphql -H "Content-Type:application/json" --data \
'{"query": "query bookTestSimple { bookById(id: \"book-1\") { name ... @defer { author { firstName } } } ... @defer { book2: bookById(id: \"book-2\") { name } } }"}'

Apollo Sandbox:

GraphiQL doen't work due to the GraphQL path being overridden, but you can use Apollo Sandbox instead.

Example query:

query bookTestSimple {
  bookById(id: "book-1") {
    name
    ... @defer {
      author {
         firstName
      }
    }
  }
  ... @defer {
    book2: bookById(id: "book-2") {
      name
    }
  }
}