graphql-kotlin-schema-generator will resolve all functions synchronously, i.e. it will block the
underlying thread while executing the target function. While you could configure your GraphQL server with execution
strategies that execute each query in parallel on some thread pools, instead we highly recommend to utilize asynchronous
graphql-kotlin-schema-generator has built-in support for Kotlin coroutines. Provided default
will automatically asynchronously execute suspendable functions and convert the result to
will produce the following schema
graphql-java relies on Java
CompletableFuture for asynchronously processing the requests. In order to simplify the
graphql-kotlin-schema-generator has a built-in hook which will automatically unwrap a
CompletableFuture and use the inner class as the return type in the schema.
will result in the exactly the same schema as in the coroutine example above.
- Create custom
willResolveMonadto provide the necessary logic to correctly unwrap the monad and return the inner class to generate valid schema
- Provide custom data fetcher that will properly process those monad types.
With the above you can then create your schema as follows:
This will produce