You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This will add `/graphql` endpoint to your app and enable the GraphiQL IDE.
41
+
42
+
### Supported options for GraphQLView
39
43
40
-
-`schema`: The `GraphQLSchema` object that you want the view to execute when it gets a valid request.
41
-
-`context`: A value to pass as the `context` to the `graphql()` function. By default is set to `dict` with request object at key `request`.
42
-
-`root_value`: The `root_value` you want to provide to `executor.execute`.
43
-
-`pretty`: Whether or not you want the response to be pretty printed JSON.
44
-
-`executor`: The `Executor` that you want to use to execute queries. If an `AsyncioExecutor` instance is provided, performs queries asynchronously within executor’s loop.
45
-
-`graphiql`: If `True`, may present [GraphiQL] when loaded directly from a browser (a useful tool for debugging and exploration).
46
-
-`graphiql_template`: Inject a Jinja template string to customize GraphiQL.
47
-
-`jinja_env`: Sets jinja environment to be used to process GraphiQL template. If Jinja’s async mode is enabled (by `enable_async=True`), uses
44
+
*`schema`: The `GraphQLSchema` object that you want the view to execute when it gets a valid request.
45
+
*`context`: A value to pass as the `context_value` to graphql `execute` function. By default is set to `dict` with request object at key `request`.
46
+
*`root_value`: The `root_value` you want to provide to graphql `execute`.
47
+
*`pretty`: Whether or not you want the response to be pretty printed JSON.
48
+
*`graphiql`: If `True`, may present [GraphiQL](https://github.com/graphql/graphiql) when loaded directly from a browser (a useful tool for debugging and exploration).
49
+
*`graphiql_version`: The graphiql version to load. Defaults to **"1.0.3"**.
50
+
*`graphiql_template`: Inject a Jinja template string to customize GraphiQL.
51
+
*`graphiql_html_title`: The graphiql title to display. Defaults to **"GraphiQL"**.
52
+
*`jinja_env`: Sets jinja environment to be used to process GraphiQL template. If Jinja’s async mode is enabled (by `enable_async=True`), uses
48
53
`Template.render_async` instead of `Template.render`. If environment is not set, fallbacks to simple regex-based renderer.
49
-
-`batch`: Set the GraphQL view as batch (for using in [Apollo-Client] or [ReactRelayNetworkLayer])
54
+
*`batch`: Set the GraphQL view as batch (for using in [Apollo-Client](http://dev.apollodata.com/core/network.html#query-batching) or [ReactRelayNetworkLayer](https://github.com/nodkz/react-relay-network-layer))
55
+
*`middleware`: A list of graphql [middlewares](http://docs.graphene-python.org/en/latest/execution/middleware/).
56
+
*`max_age`: Sets the response header Access-Control-Max-Age for preflight requests.
57
+
*`encode`: the encoder to use for responses (sensibly defaults to `graphql_server.json_encode`).
58
+
*`format_error`: the error formatter to use for responses (sensibly defaults to `graphql_server.default_format_error`.
59
+
*`enable_async`: whether `async` mode will be enabled.
60
+
*`subscriptions`: The GraphiQL socket endpoint for using subscriptions in graphql-ws.
61
+
*`headers`: An optional GraphQL string to use as the initial displayed request headers, if not provided, the stored headers will be used.
62
+
*`default_query`: An optional GraphQL string to use when no query is provided and no stored query exists from a previous session. If not provided, GraphiQL will use its own default query.
63
+
*`header_editor_enabled`: An optional boolean which enables the header editor when true. Defaults to **false**.
64
+
*`should_persist_headers`: An optional boolean which enables to persist headers to storage when true. Defaults to **false**.
65
+
50
66
51
67
You can also subclass `GraphQLView` and overwrite `get_root_value(self, request)` to have a dynamic root value per request.
52
68
@@ -56,8 +72,12 @@ class UserRootValue(GraphQLView):
56
72
return request.user
57
73
```
58
74
59
-
License
60
-
-------
75
+
76
+
## Contributing
77
+
Since v3, `sanic-graphql` code lives at [graphql-server](https://github.com/graphql-python/graphql-server) repository to keep any breaking change on the base package on sync with all other integrations. In order to contribute, please take a look at [CONTRIBUTING.md](https://github.com/graphql-python/graphql-server/blob/master/CONTRIBUTING.md).
78
+
79
+
80
+
## License
61
81
62
82
Copyright for portions of project [sanic-graphql] are held by [Syrus Akbary] as part of project [flask-graphql]. All other copyright
63
83
for project [sanic-graphql] are held by [Sergey Porivaev].
@@ -73,4 +93,3 @@ This project is licensed under MIT License.
0 commit comments