diff --git a/README.md b/README.md index a6f2a3b..5e7f8a0 100644 --- a/README.md +++ b/README.md @@ -48,6 +48,7 @@ gql_view(request) # <-- the instance is callable and expects a `aiohttp.web.Req - `encoder`: the encoder to use for responses (sensibly defaults to `graphql_server.json_encode`) - `error_formatter`: the error formatter to use for responses (sensibly defaults to `graphql_server.default_format_error`) - `enable_async`: whether `async` mode will be enabled. +- `backend`: the backend to be used to create `GraphQLDocument` from a string (sensibly defaults to `graphql.backend.core.GraphQLCoreBackend`). ## Testing diff --git a/aiohttp_graphql/graphqlview.py b/aiohttp_graphql/graphqlview.py index 362d87e..60f214e 100644 --- a/aiohttp_graphql/graphqlview.py +++ b/aiohttp_graphql/graphqlview.py @@ -36,6 +36,7 @@ def __init__( encoder=None, error_formatter=None, enable_async=True, + backend=None, ): # pylint: disable=too-many-arguments # pylint: disable=too-many-locals @@ -58,6 +59,7 @@ def __init__( self.executor, AsyncioExecutor, ) + self.backend = backend assert isinstance(self.schema, GraphQLSchema), \ 'A Schema is required to be provided to GraphQLView.' @@ -141,6 +143,7 @@ async def __call__(self, request): context_value=self.get_context(request), middleware=self.middleware, executor=self.executor, + backend=self.backend, ) awaited_execution_results = await Promise.all(execution_results)